Exemple #1
0
        public void Attack(IFighter target)
        {
            if (target.Alive())
            {
                List <IEffect> dmg    = new List <IEffect>();
                IEquiped       weapon = this.GetItemFromSlot(EquipSlot.RightHand);
                if (weapon != null)
                {
                    weapon.EquipEffects.ForEach(x =>
                    {
                        dmg.Add(x);
                    });
                }
                else
                {
                    dmg.Add(new InstantEffect(EffectTarget.Character, StatType.Health, -20));
                }

                target.Hit(dmg);

                if (!target.Alive())
                {
                    KillEnemy?.Invoke(target);
                }
            }
            else
            {
                StateMachine.Switch2PreviousState();
            }
        }