Пример #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();
            }
        }
Пример #2
0
 public void FromEquipToInventory(IEquiped item)
 {
     try
     {
         item.Equiped = false;
         Equip.RemoveItem(item);
     }
     catch (Exception e)
     {
         throw (e);
     }
     Inventory.AddItem(item);
 }
Пример #3
0
 public void EquipItem(IEquiped item)
 {
     try
     {
         Inventory.RemoveItem(item);
         if (Equip.Items.Any(x => x.Slot == item.Slot))
         {
             IEquiped change = Equip.Items.Where(x => x.Slot == item.Slot).FirstOrDefault();
             FromEquipToInventory(change);
         }
         Equip.AddItem(item);
         item.Equiped = true;
         if (EquipChange != null)
         {
             EquipChange.Invoke();
         }
     }
     catch (Exception e)
     {
         throw (e);
     }
 }