Пример #1
0
        public void EveryoneGain(Party party, EntitySkillTypes skillType, int amountGained)
        {
            AddEntityGain(party.Derpus, skillType, amountGained);

            foreach (var companion in party.GetCompanions())
            {
                AddEntityGain(companion, skillType, amountGained);
            }
        }
Пример #2
0
        public void AddEntityLoss(Entity targetEntity, EntitySkillTypes skillType, int amountLost)
        {
            if (EntitySkillLosses == null)
            {
                EntitySkillLosses = new Dictionary <Entity, List <KeyValuePair <EntitySkillTypes, int> > >();
            }

            var loss = new KeyValuePair <EntitySkillTypes, int>(skillType, amountLost);

            if (!EntitySkillLosses.ContainsKey(targetEntity))
            {
                EntitySkillLosses.Add(targetEntity, new List <KeyValuePair <EntitySkillTypes, int> > {
                    loss
                });
            }
            else
            {
                EntitySkillLosses[targetEntity].Add(loss);
            }
        }
Пример #3
0
        public void AddEntityGain(Entity targetEntity, EntitySkillTypes skillType, int amountGained)
        {
            if (EntitySkillGains == null)
            {
                EntitySkillGains = new Dictionary <Entity, List <KeyValuePair <EntitySkillTypes, int> > >();
            }

            var gain = new KeyValuePair <EntitySkillTypes, int>(skillType, amountGained);

            if (!EntitySkillGains.ContainsKey(targetEntity))
            {
                EntitySkillGains.Add(targetEntity, new List <KeyValuePair <EntitySkillTypes, int> > {
                    gain
                });
            }
            else
            {
                EntitySkillGains[targetEntity].Add(gain);
            }
        }
Пример #4
0
        /// <summary>
        /// Returns all percentage modifiers in equipment and abilities for the given StatType.
        /// </summary>
        private float GetPercentageModifiers(EntitySkillTypes stat)
        {
            float total = 0;

            var equipment = _parent.GetEquipment();

            if (equipment == null)
            {
                return(total);
            }

            foreach (EquipLocation slot in Enum.GetValues(typeof(EquipLocation)))
            {
                var item = equipment.GetItemInSlot(slot);

                if (item == null)
                {
                    continue;
                }

                total += item.GetPercentageModifiers(stat);
            }

            var abilities = _parent.Abilities;

            foreach (var ability in abilities.Values)
            {
                if (!(ability is IModifierProvider provider))
                {
                    continue;
                }

                total += provider.GetPercentageModifiers(stat);
            }

            return(total);
        }
Пример #5
0
 public string BuildCompanionLossTextItem(Entity companion, int value, EntitySkillTypes lossType)
 {
     return($"{companion.Name} lost {value} {GlobalHelper.GetEnumDescription(lossType)}!");
 }
Пример #6
0
 private string BuildCompanionRewardTextItem(Entity companion, int attributeGainValue, EntitySkillTypes gainType)
 {
     return($"{companion.Name} gained {attributeGainValue} {GlobalHelper.GetEnumDescription(gainType)}!");
 }
Пример #7
0
 /// <summary>
 /// Applies all modifiers to a new value for the given StatType.
 /// </summary>
 private int ModifyNewValueForStat(EntitySkillTypes stat, int value)
 {
     return((int)(GetAdditiveModifiers(stat) + value * (1 + GetPercentageModifiers(stat) / 100)));
 }
Пример #8
0
 /// <summary>
 /// Returns all modifiers for the given StatType.
 /// </summary>
 private int GetAllModifiersForStat(EntitySkillTypes stat)
 {
     return((int)(GetAdditiveModifiers(stat) * (1 + GetPercentageModifiers(stat) / 100)));
 }