MobAIv2 P2

This commit is contained in:
dingo
2025-12-27 11:21:00 -05:00
parent 9c67dd3935
commit 9ace66bea2
7 changed files with 2651 additions and 85 deletions
+42
View File
@@ -39,6 +39,11 @@ public class PlayerInstance
/// </summary>
public Dictionary<string, float> Resistances { get; set; } = new();
/// <summary>
/// Active status effects on this player
/// </summary>
public List<PlayerStatusEffect> StatusEffects { get; set; } = new();
public bool IsAlive { get; set; } = true;
public bool IsInCombat { get; set; }
@@ -56,4 +61,41 @@ public class PlayerInstance
public float InputY { get; set; }
public bool WantsToAttack { get; set; }
public ulong? AttackTargetId { get; set; }
/// <summary>Check if player is stunned</summary>
public bool IsStunned => StatusEffects.Any(e => e.EffectType == "stun" && e.Duration > 0);
/// <summary>Check if player is rooted</summary>
public bool IsRooted => StatusEffects.Any(e => e.EffectType == "root" && e.Duration > 0);
/// <summary>Check if player is feared</summary>
public bool IsFeared => StatusEffects.Any(e => e.EffectType == "fear" && e.Duration > 0);
/// <summary>Check if player is silenced</summary>
public bool IsSilenced => StatusEffects.Any(e => e.EffectType == "silence" && e.Duration > 0);
/// <summary>Get current speed modifier from status effects</summary>
public float GetSpeedModifier()
{
float modifier = 1.0f;
foreach (var effect in StatusEffects.Where(e => e.EffectType == "slow" && e.Duration > 0))
{
modifier *= effect.Modifier;
}
return modifier;
}
}
/// <summary>
/// A status effect applied to a player
/// </summary>
public class PlayerStatusEffect
{
public string EffectType { get; set; } = ""; // poison, bleed, burn, slow, stun, root, fear, silence
public float Duration { get; set; }
public float TickInterval { get; set; }
public float NextTickIn { get; set; }
public int DamagePerTick { get; set; }
public float Modifier { get; set; } = 1.0f; // For slow, etc.
public int SourceMobId { get; set; }
}