예제 #1
0
        public int GetBattleBonus(Tag weaponType = Tag.NULL)
        {
            int retVal                = 0;
            int weaponBonus           = 0;
            EquipmentContainer weapon = GetMainWeapon(out weaponBonus, weaponType);

            retVal += weaponBonus;
            if (weapon == null && (weaponType == Tag.NULL || weaponType == Tag.brawl))
            {
                foreach (TraitContainer trait in traits)
                {
                    if (trait.GetTags().Contains(Tag.brawl) && !trait.trait.tags.Contains(Tag.weapon))
                    {
                        retVal += trait.GetTotalEffectValue(TraitEffectType.CHANGE_BRUTAL);
                    }
                }
            }
            else if (weapon != null)
            {
                if ((weaponType == Tag.NULL && weapon.trait.tags.Contains(Tag.brawl)) || (weaponType == Tag.brawl))
                {
                    foreach (TraitContainer trait in traits)
                    {
                        if (trait.trait.tags.Contains(Tag.brawl) && !trait.trait.tags.Contains(Tag.weapon))
                        {
                            retVal += trait.GetTotalEffectValue(TraitEffectType.CHANGE_BRUTAL);
                        }
                    }
                }
                else if ((weaponType == Tag.NULL && weapon.trait.tags.Contains(Tag.melee_weapon)) || (weaponType == Tag.melee_weapon))
                {
                    foreach (TraitContainer trait in traits)
                    {
                        if (trait.GetTags().Contains(Tag.melee_weapon) && !trait.GetTags().Contains(Tag.weapon))
                        {
                            retVal += trait.GetTotalEffectValue(TraitEffectType.CHANGE_BRUTAL);
                        }
                    }
                }
                else if ((weaponType == Tag.NULL && weapon.trait.tags.Contains(Tag.firearms)) || (weaponType == Tag.firearms))
                {
                    foreach (TraitContainer trait in traits)
                    {
                        if (trait.GetTags().Contains(Tag.firearms) && !trait.GetTags().Contains(Tag.weapon))
                        {
                            retVal += trait.GetTotalEffectValue(TraitEffectType.CHANGE_BRUTAL);
                        }
                    }
                }
            }
            foreach (TraitContainer trait in traits)
            {
                if (trait.GetTags().Contains(Tag.battle))
                {
                    retVal += trait.GetTotalEffectValue(TraitEffectType.CHANGE_BRUTAL);
                }
            }
            return(retVal);
        }
예제 #2
0
        public void ChangeMaxItemSlot(int value)
        {
            maxItemSlots += value;
            int dif = GetEquipment().Count - (maxItemSlots - blockedSlots);

            if (dif > 0)
            {
                for (int i = 0; i < dif; i++)
                {
                    EquipmentContainer equipmentContainer = GetEquipment()[GetEquipment().Count - 1 - dif];
                    items.Add(equipmentContainer.equipment);
                    Destroy(equipmentContainer.gameObject);
                    GetEquipment().RemoveAt(GetEquipment().Count - 1 - dif);
                }
            }
        }
예제 #3
0
        public void AddEquipment(Equipment newEquipment)
        {
            GameObject goEquipment;

            if (newEquipment != null)
            {
                goEquipment = new GameObject(newEquipment.name);
            }
            else
            {
                goEquipment = new GameObject("Equipment_");
            }
            goEquipment.transform.parent = GetEquipmentFolder().transform;
            EquipmentContainer equipment = goEquipment.AddComponent <EquipmentContainer>();

            equipment.equipment = newEquipment;
            equipment.owner     = this;
            equipment.AttachEffects();
            _equipments.Add(equipment);
        }
예제 #4
0
        public EquipmentContainer GetMainWeapon(out int maxBonus, Tag weaponType = Tag.NULL)
        {
            EquipmentContainer retVal = null;

            maxBonus = 0;
            foreach (EquipmentContainer equipment in _equipments)
            {
                if (equipment.trait != null && equipment.trait.tags.Contains(Tag.weapon))
                {
                    if (weaponType == Tag.brawl && !equipment.trait.tags.Contains(Tag.brawl))
                    {
                        continue;
                    }
                    else if (weaponType == Tag.melee_weapon && !equipment.trait.tags.Contains(Tag.melee_weapon))
                    {
                        continue;
                    }
                    else if (weaponType == Tag.firearms && !equipment.trait.tags.Contains(Tag.firearms))
                    {
                        continue;
                    }

                    int bonus = equipment.trait.GetTotalEffectValue(TraitEffectType.CHANGE_BRUTAL);
                    if (retVal == null)
                    {
                        retVal   = equipment;
                        maxBonus = bonus;
                    }
                    else if (maxBonus < bonus)

                    {
                        retVal   = equipment;
                        maxBonus = bonus;
                    }
                }
            }
            return(retVal);
        }