namespace Server.Game.Dungeon; /// /// Runtime instance of a player in a dungeon /// public class PlayerInstance { public ulong CharacterId { get; set; } public string CharacterName { get; set; } = ""; public float X { get; set; } public float Y { get; set; } public float Rotation { get; set; } public float Health { get; set; } public float MaxHealth { get; set; } public float Mana { get; set; } public float MaxMana { get; set; } public float Stamina { get; set; } public float MaxStamina { get; set; } public float MoveSpeed { get; set; } = 100f; public float AttackSpeed { get; set; } = 1f; public int Strength { get; set; } public int Intelligence { get; set; } public int Wisdom { get; set; } public int Endurance { get; set; } public int Dexterity { get; set; } // Defensive stats (from gear) public int Armor { get; set; } /// /// Weapon damage type key (from equipped weapon, defaults to physical for unarmed) /// public string WeaponDamageTypeKey { get; set; } = "physical"; /// /// Combined resistances from innate + gear /// public Dictionary Resistances { get; set; } = new(); /// /// Active status effects on this player /// public List StatusEffects { get; set; } = new(); public bool IsAlive { get; set; } = true; public bool IsInCombat { get; set; } // Session stats public int XpGained { get; set; } public int MobsKilled { get; set; } public int PlayersKilled { get; set; } // Tick tracking public long LastAttackTick { get; set; } public long LastCombatTick { get; set; } // Input state (set by handler) public float InputX { get; set; } public float InputY { get; set; } public bool WantsToAttack { get; set; } public ulong? AttackTargetId { get; set; } /// Check if player is stunned public bool IsStunned => StatusEffects.Any(e => e.EffectType == "stun" && e.Duration > 0); /// Check if player is rooted public bool IsRooted => StatusEffects.Any(e => e.EffectType == "root" && e.Duration > 0); /// Check if player is feared public bool IsFeared => StatusEffects.Any(e => e.EffectType == "fear" && e.Duration > 0); /// Check if player is silenced public bool IsSilenced => StatusEffects.Any(e => e.EffectType == "silence" && e.Duration > 0); /// Get current speed modifier from status effects 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; } } /// /// A status effect applied to a player /// 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; } }