private string AdjustChallengeRating(string originalChallengeRating, int additionalHitDice, string creatureType) { var creatureTypeDivisor = typeAndAmountSelector.SelectOne(TableNameConstants.TypeAndAmount.Advancements, creatureType); var divisor = creatureTypeDivisor.Amount; var advancementAmount = additionalHitDice / divisor; return(ChallengeRatingConstants.IncreaseChallengeRating(originalChallengeRating, advancementAmount)); }
private void UpdateCreatureChallengeRating(Creature creature) { if (creature.HitPoints.RoundedHitDiceQuantity >= 8) { creature.ChallengeRating = ChallengeRatingConstants.IncreaseChallengeRating(creature.ChallengeRating, 2); } else if (creature.HitPoints.RoundedHitDiceQuantity >= 4) { creature.ChallengeRating = ChallengeRatingConstants.IncreaseChallengeRating(creature.ChallengeRating, 1); } }
private void UpdateCreatureChallengeRating(Creature creature) { var challengeRatings = ChallengeRatingConstants.GetOrdered(); var index = Array.IndexOf(challengeRatings, creature.ChallengeRating); var threeIndex = Array.IndexOf(challengeRatings, ChallengeRatingConstants.Three); if (index > -1 && index + 2 < threeIndex) { creature.ChallengeRating = ChallengeRatingConstants.Three; } else { creature.ChallengeRating = ChallengeRatingConstants.IncreaseChallengeRating(creature.ChallengeRating, 2); } }
private string AdjustChallengeRating(string originalSize, string advancedSize, string originalChallengeRating) { var sizes = SizeConstants.GetOrdered(); var originalSizeIndex = Array.IndexOf(sizes, originalSize); var advancedIndex = Array.IndexOf(sizes, advancedSize); var largeIndex = Array.IndexOf(sizes, SizeConstants.Large); if (advancedIndex < largeIndex || originalSize == advancedSize) { return(originalChallengeRating); } var increase = advancedIndex - Math.Max(largeIndex - 1, originalSizeIndex); var adjustedChallengeRating = ChallengeRatingConstants.IncreaseChallengeRating(originalChallengeRating, increase); return(adjustedChallengeRating); }
private void UpdateCreatureChallengeRating(Creature creature, HitPoints animalHitPoints) { var increase = 2; if (animalHitPoints.HitDice[0].Quantity > 20) { increase = 6; } else if (animalHitPoints.HitDice[0].Quantity > 10) { increase = 5; } else if (animalHitPoints.HitDice[0].Quantity > 5) { increase = 4; } else if (animalHitPoints.HitDice[0].Quantity > 2) { increase = 3; } creature.ChallengeRating = ChallengeRatingConstants.IncreaseChallengeRating(creature.ChallengeRating, increase); }
private void UpdateCreatureChallengeRating(Creature creature) { creature.ChallengeRating = ChallengeRatingConstants.IncreaseChallengeRating(creature.ChallengeRating, 2); }
public void IncreaseOutOfRange_Zero(int increase) { var newCr = ChallengeRatingConstants.IncreaseChallengeRating(ChallengeRatingConstants.Zero, increase); Assert.That(newCr, Is.EqualTo(increase.ToString())); }
public void IncreaseOutOfRange_Fractional(string cr, int increase, int expected) { var newCr = ChallengeRatingConstants.IncreaseChallengeRating(cr, increase); Assert.That(newCr, Is.EqualTo(expected.ToString())); }
public void IncreaseOutOfRange_Whole() { var newCr = ChallengeRatingConstants.IncreaseChallengeRating("9266", 90210); Assert.That(newCr, Is.EqualTo(99476.ToString())); }
public void Increase_WholeNumber(string challengeRating, int increase, string expected) { var newCr = ChallengeRatingConstants.IncreaseChallengeRating(challengeRating, increase); Assert.That(newCr, Is.EqualTo(expected)); }