private static int GetConstitutionHpBonus(IAttributesModule attributesModule) { var constitutionAttribute = attributesModule.GetAttribute(PersonAttributeType.Constitution); int constitutionHpBonus; if (constitutionAttribute is null) { constitutionHpBonus = 0; } else { const int CONSTITUTION_HP_INFLUENCE = 2; const int BASE_CONSTITUTION = 10; if (constitutionAttribute.Value > 10) { constitutionHpBonus = ((int)constitutionAttribute.Value - BASE_CONSTITUTION) * CONSTITUTION_HP_INFLUENCE; } else { constitutionHpBonus = -(BASE_CONSTITUTION - (int)constitutionAttribute.Value) * CONSTITUTION_HP_INFLUENCE; } } return(constitutionHpBonus); }
public int CalculateCost() { var dexterityAttribute = _attributesModule.GetAttribute(PersonAttributeType.Dexterity); var significantValue = (int)Math.Ceiling(dexterityAttribute.Value); var diffValue = significantValue - BASE_DEXTERITY; return(BASE_COST - (diffValue * COST_PER_DEXTERITY_UNIT)); }