private void OnUserAttack(AttackInfo info) { using (var p = new OutPacket( info is MeleeAttackInfo ? GameSendOperations.UserMeleeAttack : info is ShootAttackInfo ? GameSendOperations.UserShootAttack : info is MagicAttackInfo ? GameSendOperations.UserMagicAttack : info is BodyAttackInfo ? GameSendOperations.UserBodyAttack : GameSendOperations.UserMeleeAttack )) { p.Encode <int>(ID); info.Encode(p); Field.BroadcastPacket(this, p); } info.Entries.ForEach(e => { var fieldObject = Field.GetObject(e.MobID); var totalDamage = e.Damage.Sum(); if (fieldObject is FieldMob mob) { mob.Damage(this, Math.Min(mob.HP, totalDamage)); } }); }