public void EveryoneGain(Party party, EntitySkillTypes skillType, int amountGained) { AddEntityGain(party.Derpus, skillType, amountGained); foreach (var companion in party.GetCompanions()) { AddEntityGain(companion, skillType, amountGained); } }
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); } }
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); } }
/// <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); }
public string BuildCompanionLossTextItem(Entity companion, int value, EntitySkillTypes lossType) { return($"{companion.Name} lost {value} {GlobalHelper.GetEnumDescription(lossType)}!"); }
private string BuildCompanionRewardTextItem(Entity companion, int attributeGainValue, EntitySkillTypes gainType) { return($"{companion.Name} gained {attributeGainValue} {GlobalHelper.GetEnumDescription(gainType)}!"); }
/// <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))); }
/// <summary> /// Returns all modifiers for the given StatType. /// </summary> private int GetAllModifiersForStat(EntitySkillTypes stat) { return((int)(GetAdditiveModifiers(stat) * (1 + GetPercentageModifiers(stat) / 100))); }