double GetAbsoluteMod(object key) { string keyStr = key.ToString() + STR_Absolute; if (CalculatedMods.ContainsKey(keyStr)) { return(CalculatedMods[keyStr]); } return(0); }
double GetCalculatedMod(object key) { string keyStr = key.ToString(); double abilityModifier = 0; if (CalculatedMods.ContainsKey(keyStr + STR_AddAbilityModifier)) { int abilityIndex = (int)CalculatedMods[keyStr + STR_AddAbilityModifier]; Ability ability = (Ability)abilityIndex; switch (ability) { case Ability.Strength: abilityModifier = CalculateAbilityModifier(Strength); break; case Ability.Dexterity: abilityModifier = CalculateAbilityModifier(Dexterity); break; case Ability.Constitution: abilityModifier = CalculateAbilityModifier(Constitution); break; case Ability.Intelligence: abilityModifier = CalculateAbilityModifier(Intelligence); break; case Ability.Wisdom: abilityModifier = CalculateAbilityModifier(Wisdom); break; case Ability.Charisma: abilityModifier = CalculateAbilityModifier(Charisma); break; } double abilityModifierLimit = 0; if (CalculatedMods.ContainsKey(keyStr + STR_LimitAbilityModifier)) { abilityModifierLimit = CalculatedMods[keyStr + STR_LimitAbilityModifier]; } if (abilityModifierLimit != 0 && abilityModifier > abilityModifierLimit) { abilityModifier = abilityModifierLimit; } } if (CalculatedMods.ContainsKey(keyStr)) { return(CalculatedMods[keyStr] + abilityModifier); } return(abilityModifier); }