Esempio n. 1
0
        public CombatStats GetCombinedCombatStats()
        {
            CombatStats combined = new CombatStats();

            combined.Vitality     = BaseStats.Vitality + InvestedStats.Vitality;
            combined.Inteligence  = BaseStats.Inteligence + InvestedStats.Inteligence;
            combined.Strength     = BaseStats.Strength + InvestedStats.Strength;
            combined.Agility      = BaseStats.Agility + InvestedStats.Agility;
            combined.MeleeDefence = BaseStats.MeleeDefence + InvestedStats.MeleeDefence;
            combined.RangeDefence = BaseStats.RangeDefence + InvestedStats.RangeDefence;
            combined.MagicDefence = BaseStats.MagicDefence + InvestedStats.MagicDefence;

            for (int i = 0; i < _equipment.Length; i++)
            {
                if (_equipment[i] != 0)
                {
                    ItemData data = ItemData.GetItemData(_equipment[i] - 1);
                    combined.Vitality     += (int)data.GetItemStat("VitalityBonus");
                    combined.Inteligence  += (int)data.GetItemStat("InteligenceBonus");
                    combined.Strength     += (int)data.GetItemStat("StrengthBonus");
                    combined.Agility      += (int)data.GetItemStat("AgilityBonus");
                    combined.MeleeDefence += (int)data.GetItemStat("MeleeDefenceBonus");
                    combined.RangeDefence += (int)data.GetItemStat("RangeDefenceBonus");
                    combined.MagicDefence += (int)data.GetItemStat("MagicDefenceBonus");
                }
            }

            return(combined);
        }
Esempio n. 2
0
 public int ConsumeAmmo()
 {
     if (_equipedAmmo.Item1 != -1)
     {
         ItemData data       = ItemData.GetItemData(_equipedAmmo.Item1);
         int      projectile = (int)data.GetItemStat("ProjectileID");
         if (projectile != -1)
         {
             int amount = _equipedAmmo.Item2 - 1;
             if (amount == 0)
             {
                 _equipedAmmo = new Tuple <int, int>(-1, 0);
             }
             else
             {
                 _equipedAmmo = new Tuple <int, int>(_equipedAmmo.Item1, amount);
             }
             return(projectile);
         }
     }
     return(-1);
 }
Esempio n. 3
0
 public bool EquipItem(int itemIndex)
 {
     if (itemIndex >= 0 && itemIndex < _inventory.Count)
     {
         ItemData data = ItemData.GetItemData(_inventory[itemIndex].Item1);
         if (data.Equipable())
         {
             EquipmentSlot slot = (EquipmentSlot)data.GetItemStat("EquipmentSlot");
             int           prev = GetEquipedItemID(slot);
             EquipItem(slot, _inventory[itemIndex].Item1);
             if (prev != -1)
             {
                 _inventory[itemIndex] = new Tuple <int, int>(prev, 1);
             }
             else
             {
                 _inventory.RemoveAt(itemIndex);
             }
             return(true);
         }
     }
     return(false);
 }