public void CombatStat_PhysicalDefenseShouldCalculate() { int expectedValue = 16; int actualValue = combatStat.CalculatePhysicalDefense(m.Strength, m.Constitution, m.Dexterity, m.CharacterLevel); Assert.Equal(expectedValue, actualValue); }
private void UpdateCombatStats() { // TODO: Extract this duplicate code for input box parsing bool characterLevelValid = InputHandler.ParseNonNegativeInt(characterLevelInputBox.Text, out int characterLevel); bool strengthValueValid = InputHandler.ParseNonNegativeInt(strengthInputBox.Text, out int strengthValue); bool constitutionValueValid = InputHandler.ParseNonNegativeInt(constitutionInputBox.Text, out int constitutionValue); bool dexterityValueValid = InputHandler.ParseNonNegativeInt(dexterityInputBox.Text, out int dexterityValue); bool intelligenceValueValid = InputHandler.ParseNonNegativeInt(intelligenceInputBox.Text, out int intelligenceValue); bool wisdomValueValid = InputHandler.ParseNonNegativeInt(wisdomInputBox.Text, out int wisdomValue); bool charismaValueValid = InputHandler.ParseNonNegativeInt(charismaInputBox.Text, out int charismaValue); armorClass.Text = (constitutionValueValid || dexterityValueValid || wisdomValueValid || characterLevelValid) ? combatStat.CalculateArmorClass(constitutionValue, dexterityValue, wisdomValue, characterLevel).ToString() : defaultDisplayValue; physicalDefense.Text = (strengthValueValid || constitutionValueValid || dexterityValueValid || characterLevelValid) ? combatStat.CalculatePhysicalDefense(strengthValue, constitutionValue, dexterityValue, characterLevel).ToString() : defaultDisplayValue; mentalDefense.Text = (intelligenceValueValid || wisdomValueValid || charismaValueValid || characterLevelValid) ? combatStat.CalculateMentalDefense(intelligenceValue, wisdomValue, charismaValue, characterLevel).ToString() : defaultDisplayValue; }