コード例 #1
0
        public ArmorClass GenerateWith(Equipment equipment, int adjustedDexterityBonus, IEnumerable<Feat> feats, Race race)
        {
            var armorClass = new ArmorClass();
            armorClass.AdjustedDexterityBonus = adjustedDexterityBonus;
            armorClass.ArmorBonus = GetArmorBonus(equipment);
            armorClass.DeflectionBonus = GetDeflectionBonus(equipment.Treasure.Items);
            armorClass.DodgeBonus = GetDodgeBonus(feats);
            armorClass.NaturalArmorBonus = GetNaturalArmorBonus(equipment.Treasure.Items, feats, race);
            armorClass.ShieldBonus = GetShieldBonus(equipment);
            armorClass.SizeModifier = GetSizeModifier(race);

            var circumstantialDodgeBonus = IsDodgeBonusCircumstantial(feats);
            var circumstantialNaturalArmorBonus = IsNaturalArmorBonusCircumstantial(feats);

            armorClass.CircumstantialBonus = circumstantialDodgeBonus || circumstantialNaturalArmorBonus;

            return armorClass;
        }
コード例 #2
0
        public void GetArmorClassFromGeneratorWithMaxDexterityBonus()
        {
            equipment.Armor = new Item { Name = "armor" };
            maxDexterityBonuses[equipment.Armor.Name] = 5;
            var armorClass = new ArmorClass();
            mockArmorClassGenerator.Setup(g => g.GenerateWith(equipment, 5, feats, race)).Returns(armorClass);

            var baseAttack = combatGenerator.GenerateBaseAttackWith(characterClass, race, stats);
            var combat = combatGenerator.GenerateWith(baseAttack, characterClass, race, feats, stats, equipment);

            Assert.That(combat.ArmorClass, Is.EqualTo(armorClass));
        }