public PurchaseMeleeWeaponTests() { var weapons = new List <Weapon> (); var wpn1 = new Weapon("Mace", 0f, "1d6", DamageTypes.Bludgeoning, 20, 2, 0, WeaponType.OneHanded, WeaponGroup.Hammers, WeaponTrainingLevel.Simple); wpn1.Value = 3000; var wpn2 = new Weapon("Bow", 0, "1d6", DamageTypes.Piercing, 20, 2, 0, WeaponType.Ranged, WeaponGroup.Bows, WeaponTrainingLevel.Martial); var wpn3 = new Weapon("Never Pick", 0, "1d6", DamageTypes.Piercing, 20, 2, 0, WeaponType.Ranged, WeaponGroup.Bows, WeaponTrainingLevel.Exotic); weapons.Add(wpn1); weapons.Add(wpn2); weapons.Add(wpn3); shop = new WeaponShop(weapons); subject = new PurchaseMeleeWeapon(shop); var proficiencies = new string[] { "simple" }; character = CharacterTestTemplates.AverageBob(); character.Inventory.CoinPurse.SetValue(30000); character.Offense.AddWeaponProficiencies(proficiencies); }
public void IfNoAppropriateItemsAreFoundAssignNothing() { var action = new PurchaseMeleeWeapon(shop); var character = CharacterTestTemplates.AverageBob(); //With no specification nothing should match action.ExecuteStep(character); Assert.Empty(character.Inventory.Weapons); }
public void CharactersGetAMeleeWeaponIfTheyAreProficient() { //Bad test, but good enough for now var action = new PurchaseMeleeWeapon(shop); var proficiencies = new string[] { "simple", "martial" }; var character = CharacterTestTemplates.AverageBob(); character.Inventory.CoinPurse.SetValue(30000); character.Offense.AddWeaponProficiencies(proficiencies); action.ExecuteStep(character); Assert.Equal(character.Inventory.Weapons.Count(), 1); Assert.True(character.Inventory.Weapons.Any(x => x.Type != WeaponType.Ranged)); Assert.False(character.Inventory.Weapons.Any(x => x.Type == WeaponType.Ranged)); Assert.False(character.Inventory.Weapons.Any(x => x.Level == WeaponTrainingLevel.Exotic)); }