Ejemplo n.º 1
0
        public void ReturnsAdjustedBaseAttackBonusForExtraAttacks(int baseAttackBonus, int attack, int expectedBonus)
        {
            var bab = new BaseAttackBonus();

            bab.SetValue(baseAttackBonus);
            Assert.Equal(expectedBonus, bab.GetAttackBonus(attack));
        }
Ejemplo n.º 2
0
        public void IfBaseAttackBonusIsGreaterThanSixGrantAnExtraAttack(int baseAttackValue, int attacks)
        {
            var baseAttack = new BaseAttackBonus();

            baseAttack.SetValue(baseAttackValue);
            Assert.Equal(attacks, baseAttack.NumberOfAttacks);
        }
Ejemplo n.º 3
0
        public void Default()
        {
            // Arrange
            var character = Mock.Of <ICharacter>();
            var bab       = new BaseAttackBonus(character);

            // Assert
            Assert.AreEqual(BaseAttackProgression.AsCleric, bab.Rate,
                            "By default, a BaseAttackBonus should have medium progression (as a cleric).");
        }
Ejemplo n.º 4
0
        public void Wizard_Level3()
        {
            // Arrange
            var mockCharacter = new Mock <ICharacter>();

            mockCharacter.Setup(c => c.Level)
            .Returns(3);

            BaseAttackBonus bab = new BaseAttackBonus(mockCharacter.Object)
            {
                Rate = BaseAttackProgression.AsWizard
            };

            // Act
            var result = bab.GetTotal();

            // Assert
            Assert.AreEqual(1, result,
                            "A level 3 wizard should have a BAB of +1.");
        }
Ejemplo n.º 5
0
        public void Fighter_Level2()
        {
            // Arrange
            var mockCharacter = new Mock <ICharacter>();

            mockCharacter.Setup(c => c.Level)
            .Returns(2);

            BaseAttackBonus bab = new BaseAttackBonus(mockCharacter.Object)
            {
                Rate = BaseAttackProgression.AsFighter
            };

            // Act
            var result = bab.GetTotal();

            // Assert
            Assert.AreEqual(2, result,
                            "A level 2 fighter should have a BAB of +2.");
        }
Ejemplo n.º 6
0
        public void Cleric_Level1()
        {
            // Arrange
            var mockCharacter = new Mock <ICharacter>();

            mockCharacter.Setup(c => c.Level)
            .Returns(1);

            BaseAttackBonus bab = new BaseAttackBonus(mockCharacter.Object)
            {
                Rate = BaseAttackProgression.AsCleric
            };

            // Act
            var result = bab.GetTotal();

            // Assert
            Assert.AreEqual(0, result,
                            "A level 1 cleric should have a BAB of +0.");
        }
Ejemplo n.º 7
0
 public void LevelUp(Class characterClass)
 {
     BaseAttackBonus.AddModifier(new ValueStatModifier(characterClass.BaseAttackBonusRate));
 }
Ejemplo n.º 8
0
        public override void WritePropertyXML(XmlWriter xmlWriter)
        {
            base.WritePropertyXML(xmlWriter);

            xmlWriter.WriteStartElement("Type");
            xmlWriter.WriteString(Methods.GetCreatureTypeString(Type));
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("ChallengeRating");
            xmlWriter.WriteString(ChallengeRating.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("AttackSets");
            foreach (AttackSet attackSet in AttackSets)
            {
                attackSet.WriteXML(xmlWriter);
            }
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Strength");
            xmlWriter.WriteString(Strength.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Dexterity");
            xmlWriter.WriteString(Dexterity.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Constitution");
            xmlWriter.WriteString(Constitution.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Intelligence");
            xmlWriter.WriteString(Intelligence.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Wisdom");
            xmlWriter.WriteString(Wisdom.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Charisma");
            xmlWriter.WriteString(Charisma.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("BaseAttackBonus");
            xmlWriter.WriteString(BaseAttackBonus.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("GrappleModifier");
            xmlWriter.WriteString(GrappleModifier.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("HitPoints");
            xmlWriter.WriteString(HitPoints.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("HitDice");
            xmlWriter.WriteString(HitDice.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("HitDieType");
            xmlWriter.WriteString(Methods.GetDieTypeString(HitDieType));
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("ArmorClass");
            xmlWriter.WriteString(ArmorClass.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("TouchArmorClass");
            xmlWriter.WriteString(TouchArmorClass.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("FlatFootedArmorClass");
            xmlWriter.WriteString(FlatFootedArmorClass.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Speed");
            Speed.WriteXML(xmlWriter);
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("FortitudeSave");
            xmlWriter.WriteString(FortitudeSave.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("ReflexSave");
            xmlWriter.WriteString(ReflexSave.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("WillSave");
            xmlWriter.WriteString(WillSave.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Feats");
            foreach (string feat in Feats)
            {
                xmlWriter.WriteStartElement("Feat");
                xmlWriter.WriteString(feat);
                xmlWriter.WriteEndElement();
            }
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Space");
            xmlWriter.WriteString(Space.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Reach");
            xmlWriter.WriteString(Reach.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Size");
            xmlWriter.WriteString(Methods.GetSizeString(Size));
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("DamageReductions");
            foreach (DamageReduction dr in DamageReductions)
            {
                dr.WriteXML(xmlWriter);
            }
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Immunities");
            Immunities.WriteXML(xmlWriter);
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("EnergyResistances");
            foreach (EnergyResistance er in EnergyResistances)
            {
                er.WriteXML(xmlWriter);
            }
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("SpellResistance");
            xmlWriter.WriteString(SpellResistance.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("FastHealing");
            xmlWriter.WriteString(FastHealing.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("SpecialAttacks");
            xmlWriter.WriteString(SpecialAttacks);
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("SpecialQualities");
            xmlWriter.WriteString(String.Join(", ", SpecialQualities));
            xmlWriter.WriteEndElement();
        }
Ejemplo n.º 9
0
        public void TryingToGetAnAttackBonusForAnInvalidAttackThrowsException()
        {
            var bab = new BaseAttackBonus();

            Assert.Throws(typeof(ForbiddenByRulesException), () => bab.GetAttackBonus(30));
        }