示例#1
0
        public void WeaponPowerGroupsMatch(string itemName)
        {
            var possiblePowers = new List <string>();
            var powers         = table[ItemTypeConstants.Weapon];

            possiblePowers.AddRange(powers);

            var generalWeapons = WeaponConstants.GetAllWeapons(false, true);
            var cursed         = percentileSelector.SelectAllFrom(TableNameConstants.Percentiles.Set.SpecificCursedItems);

            if (!generalWeapons.Contains(itemName))
            {
                possiblePowers.Remove(PowerConstants.Mundane);

                if (!cursed.Contains(itemName))
                {
                    foreach (var power in powers.Except(new[] { PowerConstants.Mundane }))
                    {
                        var tableName = string.Format(TableNameConstants.Percentiles.Formattable.POWERSpecificITEMTYPEs, power, ItemTypeConstants.Weapon);
                        var results   = typeAndAmountPercentileSelector.SelectAllFrom(tableName);

                        if (!results.Any(r => NameMatchesWithReplacements(r.Type, itemName)))
                        {
                            possiblePowers.Remove(power);
                        }
                    }
                }
            }

            base.Collections(itemName, possiblePowers.ToArray());
        }
示例#2
0
        public void AllWeaponsAreInTable()
        {
            var weapons = WeaponConstants.GetAllWeapons(false, false);
            var keys    = GetKeys();

            AssertCollection(keys, weapons);
        }
示例#3
0
        public void AllKeysArePresent()
        {
            var weapons          = WeaponConstants.GetAllWeapons(false, false);
            var specialAbilities = SpecialAbilityConstants.GetAllAbilities(true);

            var expectedKeys = weapons.Union(specialAbilities);
            var actualKeys   = GetKeys();

            AssertCollection(actualKeys, expectedKeys);
        }
示例#4
0
        public void BUG_OversizedWeaponHasCorrectAttackDamage(string creatureName)
        {
            var creature = creatureGenerator.Generate(creatureName, CreatureConstants.Templates.None);

            creatureAsserter.AssertCreature(creature);
            Assert.That(creature.Equipment, Is.Not.Null);
            Assert.That(creature.Equipment.Weapons, Is.Not.Empty.And.All.Not.Null);

            var oversizedFeat = creature.SpecialQualities.FirstOrDefault(sq => sq.Name == FeatConstants.SpecialQualities.OversizedWeapon);

            Assert.That(oversizedFeat, Is.Not.Null);
            Assert.That(oversizedFeat.Foci, Is.Not.Empty);
            Assert.That(oversizedFeat.Foci.Count(), Is.EqualTo(1));

            var oversizedSize = oversizedFeat.Foci.First();

            var weaponNames      = WeaponConstants.GetAllWeapons(true, false);
            var unnaturalAttacks = creature.Attacks.Where(a => !a.IsNatural && weaponNames.Contains(a.Name));

            foreach (var attack in unnaturalAttacks)
            {
                var weapon = creature.Equipment.Weapons.FirstOrDefault(w => w.Name == attack.Name);
                Assert.That(weapon, Is.Not.Null, $"{creature.Summary}: {attack.Name}");
                Assert.That(weapon.DamageDescription, Is.Not.Empty, $"{creature.Summary}: {weapon.Description}");
                Assert.That(weaponNames, Contains.Item(weapon.Name), $"{creature.Summary}: {weapon.Description}");

                Assert.That(attack.Damages, Is.Not.Empty.And.Count.EqualTo(weapon.Damages.Count), $"{creature.Summary}; Weapon: {weapon.Description}");

                for (var i = 0; i < weapon.Damages.Count; i++)
                {
                    if (i == 0)
                    {
                        Assert.That(attack.DamageDescription, Contains.Substring(weapon.Damages[i].Roll), $"{creature.Summary}; Weapon: {weapon.Description}");
                        Assert.That(attack.DamageDescription, Contains.Substring(weapon.Damages[i].Type), $"{creature.Summary}; Weapon: {weapon.Description}");
                        Assert.That(attack.DamageDescription, Contains.Substring(weapon.Damages[i].Condition), $"{creature.Summary}; Weapon: {weapon.Description}");
                    }
                    else
                    {
                        Assert.That(attack.DamageDescription, Contains.Substring(weapon.Damages[i].Description), $"{creature.Summary}; Weapon: {weapon.Description}");
                    }
                }

                if (weapon.Attributes.Contains(AttributeConstants.Melee))
                {
                    Assert.That(attack.AttackType, Contains.Substring("melee"), $"{creature.Summary} ({creature.Size}): {weapon.Description} ({weapon.Size}) [Oversized: {oversizedSize}]");
                }
                else if (weapon.Attributes.Contains(AttributeConstants.Ranged))
                {
                    Assert.That(attack.AttackType, Contains.Substring("ranged"), $"{creature.Summary} ({creature.Size}): {weapon.Description} ({weapon.Size}) [Oversized: {oversizedSize}]");
                }
            }
        }
示例#5
0
        private void VerifyAttribute(IEnumerable <string> weaponsWith, string attribute)
        {
            var keys = GetKeys();

            var entriesWith    = table.Where(kvp => kvp.Value.Contains(attribute));
            var entriesWithout = table.Except(entriesWith);

            var weapons        = WeaponConstants.GetAllWeapons(false, false);
            var weaponsWithout = weapons.Except(weaponsWith);

            AssertCollection(entriesWith.Select(kvp => kvp.Key), weaponsWith);
            AssertCollection(entriesWithout.Select(kvp => kvp.Key), weaponsWithout);
        }
示例#6
0
        private string GetRandomItemName(string itemType)
        {
            var itemNames = Enumerable.Empty <string>();

            switch (itemType)
            {
            case ItemTypeConstants.AlchemicalItem:
                itemNames = AlchemicalItemConstants.GetAllAlchemicalItems(); break;

            case ItemTypeConstants.Armor:
                itemNames = ArmorConstants.GetAllArmorsAndShields(true); break;

            case ItemTypeConstants.Potion:
                itemNames = PotionConstants.GetAllPotions(true); break;

            case ItemTypeConstants.Ring:
                itemNames = RingConstants.GetAllRings(); break;

            case ItemTypeConstants.Rod:
                itemNames = RodConstants.GetAllRods(); break;

            case ItemTypeConstants.Scroll:
                itemNames = new[] { $"Scroll {Guid.NewGuid()}" }; break;

            case ItemTypeConstants.Staff:
                itemNames = StaffConstants.GetAllStaffs(); break;

            case ItemTypeConstants.Tool:
                itemNames = ToolConstants.GetAllTools(); break;

            case ItemTypeConstants.Wand:
                itemNames = new[] { $"Wand {Guid.NewGuid()}" }; break;

            case ItemTypeConstants.Weapon:
                itemNames = WeaponConstants.GetAllWeapons(true, true); break;

            case ItemTypeConstants.WondrousItem:
                itemNames = WondrousItemConstants.GetAllWondrousItems(); break;
            }

            var itemName = collectionSelector.SelectRandomFrom(itemNames);

            return(itemName);
        }
示例#7
0
        private void VerifyFeats(Creature creature)
        {
            Assert.That(creature.Feats, Is.Not.Null, creature.Summary);
            Assert.That(creature.SpecialQualities, Is.Not.Null, creature.Summary);

            var weapons  = WeaponConstants.GetAllWeapons(false, false);
            var allFeats = creature.Feats.Union(creature.SpecialQualities);

            foreach (var feat in allFeats)
            {
                var message = $"Creature: {creature.Summary}\nFeat: {feat.Name}";

                Assert.That(feat.Name, Is.Not.Empty, message);
                Assert.That(feat.Foci, Is.Not.Null, message);
                Assert.That(feat.Foci, Is.All.Not.Null, message);
                Assert.That(feat.Foci, Is.All.Not.EqualTo(FeatConstants.Foci.NoValidFociAvailable), message);
                Assert.That(feat.Power, Is.Not.Negative, message);
                Assert.That(feat.Frequency.Quantity, Is.Not.Negative, message);
                Assert.That(feat.Frequency.TimePeriod, Is.EqualTo(FeatConstants.Frequencies.Constant)
                            .Or.EqualTo(FeatConstants.Frequencies.AtWill)
                            .Or.EqualTo(FeatConstants.Frequencies.Hit)
                            .Or.EqualTo(FeatConstants.Frequencies.Round)
                            .Or.EqualTo(FeatConstants.Frequencies.Minute)
                            .Or.EqualTo(FeatConstants.Frequencies.Hour)
                            .Or.EqualTo(FeatConstants.Frequencies.Day)
                            .Or.EndsWith(FeatConstants.Frequencies.Day)
                            .Or.EqualTo(FeatConstants.Frequencies.Week)
                            .Or.EqualTo(FeatConstants.Frequencies.Month)
                            .Or.EqualTo(FeatConstants.Frequencies.Year)
                            .Or.EqualTo(FeatConstants.Frequencies.Life)
                            .Or.Empty, message);

                if (!creature.CanUseEquipment)
                {
                    var weaponFoci = feat.Foci.Intersect(weapons);
                    Assert.That(weaponFoci, Is.Empty, message);

                    //TODO: Also should assert that equipment is empty, but equipment does not exist on creatures yet
                    //add it once we have added that
                }
            }
        }
示例#8
0
        public void SelectWithQuantityOf1_AllOtherWeapons()
        {
            var allWeapons   = WeaponConstants.GetAllWeapons(false, false);
            var ammos        = WeaponConstants.GetAllAmmunition(false, false);
            var thrown       = WeaponConstants.GetAllThrown(false, false);
            var simple       = WeaponConstants.GetAllSimple(false, false);
            var melee        = WeaponConstants.GetAllMelee(false, false);
            var thrownRanged = thrown.Except(melee).Intersect(simple);

            var weapons = allWeapons.Except(ammos).Except(thrownRanged);

            foreach (var weapon in weapons)
            {
                var item = itemSelector.SelectFrom($"{weapon}[{ItemTypeConstants.Weapon}]");
                Assert.That(item.Name, Is.EqualTo(weapon), weapon);
                Assert.That(item.ItemType, Is.EqualTo(ItemTypeConstants.Weapon), weapon);
                Assert.That(item.Traits, Is.Empty, weapon);
                Assert.That(item.Magic.SpecialAbilities, Is.Empty, weapon);
                Assert.That(item.Magic.Bonus, Is.Zero, weapon);
                Assert.That(item.IsMagical, Is.False, weapon);
                Assert.That(item.Quantity, Is.EqualTo(1), weapon);
            }
        }
示例#9
0
        public Equipment Generate(string creatureName, bool canUseEquipment, IEnumerable <Feat> feats, int level, IEnumerable <Attack> attacks, Dictionary <string, Ability> abilities, string size)
        {
            var equipment = new Equipment();

            var weaponSize = GetWeaponSize(feats, size);

            //Get predetermined items
            var allPredeterminedItems = GetPredeterminedItems(creatureName, size, weaponSize);
            var predeterminedWeapons  = allPredeterminedItems
                                        .Where(i => i is Weapon)
                                        .Select(i => i as Weapon)
                                        .ToList();
            var predeterminedArmors = allPredeterminedItems
                                      .Where(i => i is Armor)
                                      .Select(i => i as Armor)
                                      .ToList();

            equipment.Items = allPredeterminedItems.Except(predeterminedWeapons).Except(predeterminedArmors);

            if (predeterminedArmors.Any())
            {
                equipment.Shield = predeterminedArmors.FirstOrDefault(a => a.Attributes.Contains(AttributeConstants.Shield));
                equipment.Armor  = predeterminedArmors.FirstOrDefault(a => !a.Attributes.Contains(AttributeConstants.Shield));
            }

            //INFO: If there are equipment attacks, but the level is 0, then this is a humanoid character
            //These attacks will be updated when the character is generated
            if (!canUseEquipment || level < 1)
            {
                return(equipment);
            }

            //Generate weapons and attacks
            var unnaturalAttacks = attacks.Where(a => !a.IsNatural);

            var weaponProficiencyFeatNames = collectionSelector.SelectFrom(TableNameConstants.Collection.FeatGroups, GroupConstants.WeaponProficiency);
            var weaponProficiencyFeats     = feats.Where(f => weaponProficiencyFeatNames.Contains(f.Name));

            var weapons = new List <Weapon>();
            var hasMultipleEquippedMeleeAttacks = unnaturalAttacks.Count(a => a.Name == AttributeConstants.Melee) >= 2;

            if (weaponProficiencyFeats.Any() && unnaturalAttacks.Any())
            {
                //Generate melee weapons
                var weaponNames = WeaponConstants.GetAllWeapons(false, false);

                var equipmentMeleeAttacks = unnaturalAttacks.Where(a => a.Name == AttributeConstants.Melee);
                if (equipmentMeleeAttacks.Any())
                {
                    var meleeWeaponNames = WeaponConstants.GetAllMelee(false, false);

                    var nonProficiencyFeats = feats.Except(weaponProficiencyFeats);
                    var hasWeaponFinesse    = feats.Any(f => f.Name == FeatConstants.WeaponFinesse);
                    var light = WeaponConstants.GetAllLightMelee(true, false);

                    var proficientMeleeWeaponNames    = GetProficientWeaponNames(feats, weaponProficiencyFeats, meleeWeaponNames, !hasMultipleEquippedMeleeAttacks);
                    var nonProficientMeleeWeaponNames = meleeWeaponNames
                                                        .Except(proficientMeleeWeaponNames.Common)
                                                        .Except(proficientMeleeWeaponNames.Uncommon);

                    if (hasMultipleEquippedMeleeAttacks)
                    {
                        var twoHandedWeapons = WeaponConstants.GetAllTwoHandedMelee(false, false);
                        nonProficientMeleeWeaponNames = nonProficientMeleeWeaponNames.Except(twoHandedWeapons);
                    }

                    var primaryMeleeAttacks    = equipmentMeleeAttacks.Where(a => a.IsPrimary).ToArray();
                    var primaryLightBonusAdded = false;

                    foreach (var attack in equipmentMeleeAttacks)
                    {
                        Weapon weapon = null;

                        if (predeterminedWeapons.Any(i => i.Attributes.Contains(AttributeConstants.Melee)))
                        {
                            weapon = predeterminedWeapons.First(i => i.Attributes.Contains(AttributeConstants.Melee));

                            predeterminedWeapons.Remove(weapon);
                        }
                        else
                        {
                            var weaponName = collectionSelector.SelectRandomFrom(
                                proficientMeleeWeaponNames.Common,
                                proficientMeleeWeaponNames.Uncommon,
                                null,
                                nonProficientMeleeWeaponNames);
                            weapon = itemGenerator.GenerateAtLevel(level, ItemTypeConstants.Weapon, weaponName, weaponSize) as Weapon;
                        }

                        weapons.Add(weapon);

                        attack.Name = weapon.Description;
                        attack.Damages.AddRange(weapon.Damages);

                        //Is not proficient with the weapon
                        if (!proficientMeleeWeaponNames.Common.Any(weapon.NameMatches) &&
                            !proficientMeleeWeaponNames.Uncommon.Any(weapon.NameMatches))
                        {
                            attack.AttackBonuses.Add(-4);
                        }

                        if (weapon.Magic.Bonus != 0)
                        {
                            attack.AttackBonuses.Add(weapon.Magic.Bonus);
                        }
                        else if (weapon.Traits.Contains(TraitConstants.Masterwork))
                        {
                            attack.AttackBonuses.Add(1);
                        }

                        var bonusFeats = nonProficiencyFeats.Where(f => f.Foci.Any(weapon.NameMatches));
                        foreach (var feat in bonusFeats)
                        {
                            if (feat.Power != 0)
                            {
                                attack.AttackBonuses.Add(feat.Power);
                            }
                        }

                        var isLight = light.Any(weapon.NameMatches);
                        if (hasWeaponFinesse && isLight)
                        {
                            attack.BaseAbility = abilities[AbilityConstants.Dexterity];
                        }

                        if (hasMultipleEquippedMeleeAttacks && !attack.IsPrimary && isLight)
                        {
                            attack.AttackBonuses.Add(2);

                            if (!primaryLightBonusAdded)
                            {
                                foreach (var primaryAttack in primaryMeleeAttacks)
                                {
                                    primaryAttack.AttackBonuses.Add(2);
                                }
                            }

                            primaryLightBonusAdded = true;
                        }
                    }
                }

                //Generate ranged weapons
                var equipmentRangedAttacks = unnaturalAttacks.Where(a => a.Name == AttributeConstants.Ranged);
                if (equipmentRangedAttacks.Any())
                {
                    var rangedWeaponNames = GetRangedWithBowTemplates();

                    var proficientRangedWeaponNames    = GetProficientWeaponNames(feats, weaponProficiencyFeats, rangedWeaponNames, !hasMultipleEquippedMeleeAttacks);
                    var nonProficientRangedWeaponNames = rangedWeaponNames
                                                         .Except(proficientRangedWeaponNames.Common)
                                                         .Except(proficientRangedWeaponNames.Uncommon);

                    var nonProficiencyFeats = feats.Except(weaponProficiencyFeats);
                    var crossbows           = new[]
                    {
                        WeaponConstants.HandCrossbow,
                        WeaponConstants.HeavyCrossbow,
                        WeaponConstants.LightCrossbow,
                    };

                    var rapidReload = feats.FirstOrDefault(f => f.Name == FeatConstants.RapidReload);

                    foreach (var attack in equipmentRangedAttacks)
                    {
                        Weapon weapon = null;

                        if (predeterminedWeapons.Any(i =>
                                                     i.Attributes.Contains(AttributeConstants.Ranged) &&
                                                     !i.Attributes.Contains(AttributeConstants.Melee)))
                        {
                            weapon = predeterminedWeapons.First(i =>
                                                                i.Attributes.Contains(AttributeConstants.Ranged) &&
                                                                !i.Attributes.Contains(AttributeConstants.Melee));

                            predeterminedWeapons.Remove(weapon);
                        }
                        else
                        {
                            var weaponName = collectionSelector.SelectRandomFrom(
                                proficientRangedWeaponNames.Common,
                                proficientRangedWeaponNames.Uncommon,
                                null,
                                nonProficientRangedWeaponNames);
                            weapon = itemGenerator.GenerateAtLevel(level, ItemTypeConstants.Weapon, weaponName, weaponSize) as Weapon;
                        }

                        weapons.Add(weapon);

                        //Get ammunition
                        if (!string.IsNullOrEmpty(weapon.Ammunition))
                        {
                            Weapon ammo = null;

                            if (predeterminedWeapons.Any(i => i.NameMatches(weapon.Ammunition)))
                            {
                                ammo = predeterminedWeapons.First(i => i.NameMatches(weapon.Ammunition));

                                predeterminedWeapons.Remove(ammo);
                            }
                            else
                            {
                                ammo = itemGenerator.GenerateAtLevel(level, ItemTypeConstants.Weapon, weapon.Ammunition, weaponSize) as Weapon;
                            }

                            weapons.Add(ammo);
                        }

                        //Set up the attack
                        attack.Name = weapon.Description;
                        attack.Damages.AddRange(weapon.Damages);

                        if (!proficientRangedWeaponNames.Common.Any(weapon.NameMatches) &&
                            !proficientRangedWeaponNames.Uncommon.Any(weapon.NameMatches))
                        {
                            attack.AttackBonuses.Add(-4);
                        }

                        if (weapon.Magic.Bonus != 0)
                        {
                            attack.AttackBonuses.Add(weapon.Magic.Bonus);
                        }
                        else if (weapon.Traits.Contains(TraitConstants.Masterwork))
                        {
                            attack.AttackBonuses.Add(1);
                        }

                        var bonusFeats = nonProficiencyFeats.Where(f => f.Foci.Any(weapon.NameMatches));
                        foreach (var feat in bonusFeats)
                        {
                            if (feat.Power != 0)
                            {
                                attack.AttackBonuses.Add(feat.Power);
                            }
                        }

                        if (!weapon.Attributes.Contains(AttributeConstants.Thrown) &&
                            !weapon.Attributes.Contains(AttributeConstants.Projectile))
                        {
                            attack.MaxNumberOfAttacks = 1;
                        }

                        if (crossbows.Any(weapon.NameMatches))
                        {
                            attack.MaxNumberOfAttacks = 1;

                            if (rapidReload?.Foci?.Any(weapon.NameMatches) == true &&
                                (weapon.NameMatches(WeaponConstants.LightCrossbow) ||
                                 weapon.NameMatches(WeaponConstants.HandCrossbow)))
                            {
                                attack.MaxNumberOfAttacks = 4;
                            }
                        }
                    }
                }

                equipment.Weapons = weapons;
            }

            var armorProficiencyFeatNames = collectionSelector.SelectFrom(TableNameConstants.Collection.FeatGroups, GroupConstants.ArmorProficiency);
            var armorProficiencyFeats     = feats.Where(f => armorProficiencyFeatNames.Contains(f.Name));

            if (armorProficiencyFeats.Any())
            {
                var armorNames           = ArmorConstants.GetAllArmors(false);
                var proficientArmorNames = GetProficientArmorNames(armorProficiencyFeats);

                if (proficientArmorNames.Any() && equipment.Armor == null)
                {
                    var nonProficientArmorNames = armorNames.Except(proficientArmorNames);
                    var armorName = collectionSelector.SelectRandomFrom(proficientArmorNames, null, null, nonProficientArmorNames);

                    equipment.Armor = itemGenerator.GenerateAtLevel(level, ItemTypeConstants.Armor, armorName, size) as Armor;
                }

                var shieldNames           = ArmorConstants.GetAllShields(false);
                var proficientShieldNames = GetProficientShieldNames(armorProficiencyFeats);
                var hasTwoHandedWeapon    = weapons.Any(w => w.Attributes.Contains(AttributeConstants.Melee) && w.Attributes.Contains(AttributeConstants.TwoHanded));

                if (proficientShieldNames.Any() &&
                    !hasTwoHandedWeapon &&
                    !hasMultipleEquippedMeleeAttacks &&
                    equipment.Shield == null)
                {
                    var nonProficientShieldNames = shieldNames.Except(proficientShieldNames);
                    var shieldName = collectionSelector.SelectRandomFrom(proficientShieldNames, null, null, nonProficientShieldNames);

                    equipment.Shield = itemGenerator.GenerateAtLevel(level, ItemTypeConstants.Armor, shieldName, size) as Armor;
                }
            }

            return(equipment);
        }
示例#10
0
        private void VerifyEquipment(Creature creature)
        {
            Assert.That(creature.Equipment, Is.Not.Null, creature.Summary);

            if (!creature.CanUseEquipment)
            {
                Assert.That(creature.Equipment.Weapons, Is.Empty, creature.Summary);
                Assert.That(creature.Equipment.Items, Is.Empty, creature.Summary);

                if (creature.Name == CreatureConstants.HellHound_NessianWarhound)
                {
                    Assert.That(creature.Equipment.Armor, Is.Not.Null, creature.Summary);
                }
                else
                {
                    Assert.That(creature.Equipment.Armor, Is.Null, creature.Summary);
                }
            }

            var armorNames  = ArmorConstants.GetAllArmors(true);
            var shieldNames = ArmorConstants.GetAllShields(true);
            var weaponNames = WeaponConstants.GetAllWeapons(true, false);

            if (creature.Equipment.Armor != null)
            {
                Assert.That(creature.Equipment.Armor.ArmorBonus, Is.Positive, creature.Summary + creature.Equipment.Armor.Name);
                Assert.That(armorNames, Contains.Item(creature.Equipment.Armor.Name), creature.Summary + creature.Equipment.Armor.Name);
            }

            if (creature.Equipment.Shield != null)
            {
                Assert.That(creature.Equipment.Shield.ArmorBonus, Is.Positive, creature.Summary + creature.Equipment.Shield.Name);
                Assert.That(shieldNames, Contains.Item(creature.Equipment.Shield.Name), creature.Summary + creature.Equipment.Shield.Name);
            }

            var unnaturalAttacks = creature.Attacks.Where(a => !a.IsNatural && creature.Equipment.Weapons.Any(w => a.Name.StartsWith(w.Description)));

            foreach (var attack in unnaturalAttacks)
            {
                Weapon weapon = null;

                //INFO: Lycanthropes have a modifed name for the attack based on their form
                if (creature.Template.Contains("Lycanthrope"))
                {
                    weapon = creature.Equipment.Weapons.FirstOrDefault(w => attack.Name.StartsWith($"{w.Description} ("));
                }
                else
                {
                    weapon = creature.Equipment.Weapons.FirstOrDefault(w => attack.Name == w.Description);
                }

                Assert.That(weapon, Is.Not.Null, $"{creature.Summary}: {attack.Name}");
                Assert.That(weapon.DamageDescription, Is.Not.Empty, $"{creature.Summary}: {weapon.Description}");
                Assert.That(weaponNames, Contains.Item(weapon.Name), $"{creature.Summary}: {weapon.Description}");

                Assert.That(attack.Damages, Is.Not.Empty.And.Count.EqualTo(weapon.Damages.Count));

                for (var i = 0; i < weapon.Damages.Count; i++)
                {
                    if (i == 0)
                    {
                        Assert.That(attack.DamageDescription, Contains.Substring(weapon.Damages[i].Roll), $"{creature.Summary}; Weapon: {weapon.Description}");
                        Assert.That(attack.DamageDescription, Contains.Substring(weapon.Damages[i].Type), $"{creature.Summary}; Weapon: {weapon.Description}");
                        Assert.That(attack.DamageDescription, Contains.Substring(weapon.Damages[i].Condition), $"{creature.Summary}; Weapon: {weapon.Description}");
                    }
                    else
                    {
                        Assert.That(attack.DamageDescription, Contains.Substring(weapon.Damages[i].Description), $"{creature.Summary}; Weapon: {weapon.Description}");
                    }
                }

                if (weapon.Attributes.Contains(AttributeConstants.Melee))
                {
                    Assert.That(attack.AttackType, Contains.Substring("melee"), $"{creature.Summary}: {weapon.Description}");
                }
                else if (weapon.Attributes.Contains(AttributeConstants.Ranged))
                {
                    Assert.That(attack.AttackType, Contains.Substring("ranged"), $"{creature.Summary}: {weapon.Description}");
                }
            }
        }
示例#11
0
 protected override IEnumerable <string> GetItemNames()
 {
     return(WeaponConstants.GetAllWeapons());
 }
示例#12
0
        public void AllWeapons()
        {
            var weapons = WeaponConstants.GetAllWeapons();

            Assert.That(weapons, Contains.Item(WeaponConstants.Arrow));
            Assert.That(weapons, Contains.Item(WeaponConstants.AssassinsDagger));
            Assert.That(weapons, Contains.Item(WeaponConstants.BastardSword));
            Assert.That(weapons, Contains.Item(WeaponConstants.Battleaxe));
            Assert.That(weapons, Contains.Item(WeaponConstants.Club));
            Assert.That(weapons, Contains.Item(WeaponConstants.CompositeLongbow));
            Assert.That(weapons, Contains.Item(WeaponConstants.CompositeShortbow));
            Assert.That(weapons, Contains.Item(WeaponConstants.CrossbowBolt));
            Assert.That(weapons, Contains.Item(WeaponConstants.Dagger));
            Assert.That(weapons, Contains.Item(WeaponConstants.DaggerOfVenom));
            Assert.That(weapons, Contains.Item(WeaponConstants.Dart));
            Assert.That(weapons, Contains.Item(WeaponConstants.DireFlail));
            Assert.That(weapons, Contains.Item(WeaponConstants.DwarvenThrower));
            Assert.That(weapons, Contains.Item(WeaponConstants.DwarvenUrgrosh));
            Assert.That(weapons, Contains.Item(WeaponConstants.DwarvenWaraxe));
            Assert.That(weapons, Contains.Item(WeaponConstants.Falchion));
            Assert.That(weapons, Contains.Item(WeaponConstants.FlameTongue));
            Assert.That(weapons, Contains.Item(WeaponConstants.FrostBrand));
            Assert.That(weapons, Contains.Item(WeaponConstants.Gauntlet));
            Assert.That(weapons, Contains.Item(WeaponConstants.Glaive));
            Assert.That(weapons, Contains.Item(WeaponConstants.GnomeHookedHammer));
            Assert.That(weapons, Contains.Item(WeaponConstants.Greataxe));
            Assert.That(weapons, Contains.Item(WeaponConstants.Greatclub));
            Assert.That(weapons, Contains.Item(WeaponConstants.GreaterSlayingArrow));
            Assert.That(weapons, Contains.Item(WeaponConstants.Greatsword));
            Assert.That(weapons, Contains.Item(WeaponConstants.Guisarme));
            Assert.That(weapons, Contains.Item(WeaponConstants.Halberd));
            Assert.That(weapons, Contains.Item(WeaponConstants.Halfspear));
            Assert.That(weapons, Contains.Item(WeaponConstants.Handaxe));
            Assert.That(weapons, Contains.Item(WeaponConstants.HandCrossbow));
            Assert.That(weapons, Contains.Item(WeaponConstants.HeavyCrossbow));
            Assert.That(weapons, Contains.Item(WeaponConstants.HeavyFlail));
            Assert.That(weapons, Contains.Item(WeaponConstants.HeavyMace));
            Assert.That(weapons, Contains.Item(WeaponConstants.HeavyPick));
            Assert.That(weapons, Contains.Item(WeaponConstants.HeavyRepeatingCrossbow));
            Assert.That(weapons, Contains.Item(WeaponConstants.HolyAvenger));
            Assert.That(weapons, Contains.Item(WeaponConstants.Javelin));
            Assert.That(weapons, Contains.Item(WeaponConstants.JavelinOfLightning));
            Assert.That(weapons, Contains.Item(WeaponConstants.Kama));
            Assert.That(weapons, Contains.Item(WeaponConstants.Kukri));
            Assert.That(weapons, Contains.Item(WeaponConstants.Lance));
            Assert.That(weapons, Contains.Item(WeaponConstants.LifeDrinker));
            Assert.That(weapons, Contains.Item(WeaponConstants.LightCrossbow));
            Assert.That(weapons, Contains.Item(WeaponConstants.LightFlail));
            Assert.That(weapons, Contains.Item(WeaponConstants.LightHammer));
            Assert.That(weapons, Contains.Item(WeaponConstants.LightMace));
            Assert.That(weapons, Contains.Item(WeaponConstants.LightPick));
            Assert.That(weapons, Contains.Item(WeaponConstants.LightRepeatingCrossbow));
            Assert.That(weapons, Contains.Item(WeaponConstants.Longbow));
            Assert.That(weapons, Contains.Item(WeaponConstants.Longspear));
            Assert.That(weapons, Contains.Item(WeaponConstants.Longsword));
            Assert.That(weapons, Contains.Item(WeaponConstants.LuckBlade));
            Assert.That(weapons, Contains.Item(WeaponConstants.MaceOfSmiting));
            Assert.That(weapons, Contains.Item(WeaponConstants.MaceOfTerror));
            Assert.That(weapons, Contains.Item(WeaponConstants.Morningstar));
            Assert.That(weapons, Contains.Item(WeaponConstants.Net));
            Assert.That(weapons, Contains.Item(WeaponConstants.NineLivesStealer));
            Assert.That(weapons, Contains.Item(WeaponConstants.Nunchaku));
            Assert.That(weapons, Contains.Item(WeaponConstants.Oathbow));
            Assert.That(weapons, Contains.Item(WeaponConstants.OrcDoubleAxe));
            Assert.That(weapons, Contains.Item(WeaponConstants.PunchingDagger));
            Assert.That(weapons, Contains.Item(WeaponConstants.Quarterstaff));
            Assert.That(weapons, Contains.Item(WeaponConstants.Ranseur));
            Assert.That(weapons, Contains.Item(WeaponConstants.Rapier));
            Assert.That(weapons, Contains.Item(WeaponConstants.RapierOfPuncturing));
            Assert.That(weapons, Contains.Item(WeaponConstants.Sap));
            Assert.That(weapons, Contains.Item(WeaponConstants.Scimitar));
            Assert.That(weapons, Contains.Item(WeaponConstants.ScreamingBolt));
            Assert.That(weapons, Contains.Item(WeaponConstants.Scythe));
            Assert.That(weapons, Contains.Item(WeaponConstants.Shatterspike));
            Assert.That(weapons, Contains.Item(WeaponConstants.ShiftersSorrow));
            Assert.That(weapons, Contains.Item(WeaponConstants.Shortbow));
            Assert.That(weapons, Contains.Item(WeaponConstants.Shortspear));
            Assert.That(weapons, Contains.Item(WeaponConstants.ShortSword));
            Assert.That(weapons, Contains.Item(WeaponConstants.Shuriken));
            Assert.That(weapons, Contains.Item(WeaponConstants.Siangham));
            Assert.That(weapons, Contains.Item(WeaponConstants.Sickle));
            Assert.That(weapons, Contains.Item(WeaponConstants.SlayingArrow));
            Assert.That(weapons, Contains.Item(WeaponConstants.SleepArrow));
            Assert.That(weapons, Contains.Item(WeaponConstants.Sling));
            Assert.That(weapons, Contains.Item(WeaponConstants.SlingBullet));
            Assert.That(weapons, Contains.Item(WeaponConstants.SpikedChain));
            Assert.That(weapons, Contains.Item(WeaponConstants.SpikedGauntlet));
            Assert.That(weapons, Contains.Item(WeaponConstants.SunBlade));
            Assert.That(weapons, Contains.Item(WeaponConstants.SwordOfLifeStealing));
            Assert.That(weapons, Contains.Item(WeaponConstants.SwordOfSubtlety));
            Assert.That(weapons, Contains.Item(WeaponConstants.SwordOfThePlanes));
            Assert.That(weapons, Contains.Item(WeaponConstants.SylvanScimitar));
            Assert.That(weapons, Contains.Item(WeaponConstants.ThrowingAxe));
            Assert.That(weapons, Contains.Item(WeaponConstants.Trident));
            Assert.That(weapons, Contains.Item(WeaponConstants.TridentOfFishCommand));
            Assert.That(weapons, Contains.Item(WeaponConstants.TridentOfWarning));
            Assert.That(weapons, Contains.Item(WeaponConstants.TwoBladedSword));
            Assert.That(weapons, Contains.Item(WeaponConstants.Warhammer));
            Assert.That(weapons, Contains.Item(WeaponConstants.Whip));
            Assert.That(weapons, Contains.Item(WeaponConstants.BerserkingSword));
            Assert.That(weapons, Contains.Item(WeaponConstants.CursedBackbiterSpear));
            Assert.That(weapons, Contains.Item(WeaponConstants.CursedMinus2Sword));
            Assert.That(weapons, Contains.Item(WeaponConstants.MaceOfBlood));
            Assert.That(weapons, Contains.Item(WeaponConstants.NetOfSnaring));

            Assert.That(weapons, Is.All.Not.EqualTo(WeaponConstants.SilverDagger));
            Assert.That(weapons, Is.All.Not.EqualTo(WeaponConstants.LuckBlade0));
            Assert.That(weapons, Is.All.Not.EqualTo(WeaponConstants.LuckBlade1));
            Assert.That(weapons, Is.All.Not.EqualTo(WeaponConstants.LuckBlade2));
            Assert.That(weapons, Is.All.Not.EqualTo(WeaponConstants.LuckBlade3));
            Assert.That(weapons, Is.All.Not.EqualTo(WeaponConstants.CompositePlus0Longbow));
            Assert.That(weapons, Is.All.Not.EqualTo(WeaponConstants.CompositePlus0Shortbow));
            Assert.That(weapons, Is.All.Not.EqualTo(WeaponConstants.CompositePlus1Longbow));
            Assert.That(weapons, Is.All.Not.EqualTo(WeaponConstants.CompositePlus1Shortbow));
            Assert.That(weapons, Is.All.Not.EqualTo(WeaponConstants.CompositePlus2Longbow));
            Assert.That(weapons, Is.All.Not.EqualTo(WeaponConstants.CompositePlus2Shortbow));
            Assert.That(weapons, Is.All.Not.EqualTo(WeaponConstants.CompositePlus3Longbow));
            Assert.That(weapons, Is.All.Not.EqualTo(WeaponConstants.CompositePlus4Longbow));

            Assert.That(weapons.Count(), Is.EqualTo(100));
        }