コード例 #1
0
        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);
            }
        }
コード例 #2
0
        private void VerifyStatistics(Creature creature)
        {
            var ordered          = ChallengeRatingConstants.GetOrdered();
            var numbers          = Enumerable.Range(1, 100).Select(i => i.ToString());
            var challengeRatings = ordered.Union(numbers);

            Assert.That(challengeRatings, Contains.Item(creature.ChallengeRating));
            Assert.That(creature.Size, Is.EqualTo(SizeConstants.Large)
                        .Or.EqualTo(SizeConstants.Colossal)
                        .Or.EqualTo(SizeConstants.Gargantuan)
                        .Or.EqualTo(SizeConstants.Huge)
                        .Or.EqualTo(SizeConstants.Tiny)
                        .Or.EqualTo(SizeConstants.Diminutive)
                        .Or.EqualTo(SizeConstants.Medium)
                        .Or.EqualTo(SizeConstants.Small), creature.Summary);

            VerifySpeeds(creature);
        }
コード例 #3
0
        public void OrderedChallengeRatings()
        {
            var orderedChallengeRatings = ChallengeRatingConstants.GetOrdered();

            Assert.That(orderedChallengeRatings[0], Is.EqualTo(ChallengeRatingConstants.Zero));
            Assert.That(orderedChallengeRatings[1], Is.EqualTo(ChallengeRatingConstants.OneTenth));
            Assert.That(orderedChallengeRatings[2], Is.EqualTo(ChallengeRatingConstants.OneEighth));
            Assert.That(orderedChallengeRatings[3], Is.EqualTo(ChallengeRatingConstants.OneSixth));
            Assert.That(orderedChallengeRatings[4], Is.EqualTo(ChallengeRatingConstants.OneFourth));
            Assert.That(orderedChallengeRatings[5], Is.EqualTo(ChallengeRatingConstants.OneThird));
            Assert.That(orderedChallengeRatings[6], Is.EqualTo(ChallengeRatingConstants.OneHalf));
            Assert.That(orderedChallengeRatings[7], Is.EqualTo(ChallengeRatingConstants.One));
            Assert.That(orderedChallengeRatings[8], Is.EqualTo(ChallengeRatingConstants.Two));
            Assert.That(orderedChallengeRatings[9], Is.EqualTo(ChallengeRatingConstants.Three));
            Assert.That(orderedChallengeRatings[10], Is.EqualTo(ChallengeRatingConstants.Four));
            Assert.That(orderedChallengeRatings[11], Is.EqualTo(ChallengeRatingConstants.Five));
            Assert.That(orderedChallengeRatings[12], Is.EqualTo(ChallengeRatingConstants.Six));
            Assert.That(orderedChallengeRatings[13], Is.EqualTo(ChallengeRatingConstants.Seven));
            Assert.That(orderedChallengeRatings[14], Is.EqualTo(ChallengeRatingConstants.Eight));
            Assert.That(orderedChallengeRatings[15], Is.EqualTo(ChallengeRatingConstants.Nine));
            Assert.That(orderedChallengeRatings[16], Is.EqualTo(ChallengeRatingConstants.Ten));
            Assert.That(orderedChallengeRatings[17], Is.EqualTo(ChallengeRatingConstants.Eleven));
            Assert.That(orderedChallengeRatings[18], Is.EqualTo(ChallengeRatingConstants.Twelve));
            Assert.That(orderedChallengeRatings[19], Is.EqualTo(ChallengeRatingConstants.Thirteen));
            Assert.That(orderedChallengeRatings[20], Is.EqualTo(ChallengeRatingConstants.Fourteen));
            Assert.That(orderedChallengeRatings[21], Is.EqualTo(ChallengeRatingConstants.Fifteen));
            Assert.That(orderedChallengeRatings[22], Is.EqualTo(ChallengeRatingConstants.Sixteen));
            Assert.That(orderedChallengeRatings[23], Is.EqualTo(ChallengeRatingConstants.Seventeen));
            Assert.That(orderedChallengeRatings[24], Is.EqualTo(ChallengeRatingConstants.Eighteen));
            Assert.That(orderedChallengeRatings[25], Is.EqualTo(ChallengeRatingConstants.Nineteen));
            Assert.That(orderedChallengeRatings[26], Is.EqualTo(ChallengeRatingConstants.Twenty));
            Assert.That(orderedChallengeRatings[27], Is.EqualTo(ChallengeRatingConstants.TwentyOne));
            Assert.That(orderedChallengeRatings[28], Is.EqualTo(ChallengeRatingConstants.TwentyTwo));
            Assert.That(orderedChallengeRatings[29], Is.EqualTo(ChallengeRatingConstants.TwentyThree));
            Assert.That(orderedChallengeRatings[30], Is.EqualTo(ChallengeRatingConstants.TwentyFour));
            Assert.That(orderedChallengeRatings[31], Is.EqualTo(ChallengeRatingConstants.TwentyFive));
            Assert.That(orderedChallengeRatings[32], Is.EqualTo(ChallengeRatingConstants.TwentySix));
            Assert.That(orderedChallengeRatings[33], Is.EqualTo(ChallengeRatingConstants.TwentySeven));
            Assert.That(orderedChallengeRatings, Has.Length.EqualTo(34));
        }