// FUNCTION: GetAbilityScoreModifier // PARAMETERS: abilityScore:string, name of ability score // RETURNS: int, the caluclated ability score mod // Takes the name of an ability score, grabs the score from the Characters AbilityScores dictionary, // and calculates the ability score modifier. private int GetAbilityScoreModifier(string abilityScore) { if (!string.IsNullOrEmpty(abilityScore)) { int abilityScoreValue = 0; if (AbilityScores.ContainsKey(abilityScore)) { abilityScoreValue = AbilityScores[abilityScore]; } int totalAS = abilityScoreValue; double modifier = ((Convert.ToDouble(totalAS) - 10) / 2.0); return((int)Math.Floor(modifier)); } return(0); }