public SpellCastingTests() { spellList = SpellList.CreateForTesting("bard"); spellList.Add(1, "magic missile"); var gateway = EntityGateway <SpellList> .LoadWithSingleItem(spellList); bard = CharacterTestTemplates.BardyBard(); spellCasting = new SpellCasting(configuration, gateway); bard.Add(spellCasting); }
public SpontaneousCastingTests() { spellList = SpellList.CreateForTesting("bard"); spellList.Add(0, "cantrip1"); spellList.Add(0, "cantrip2"); spellList.Add(1, "level1.1"); spellList.Add(1, "level1.2"); spellList.Add(2, "level2.1"); spellList.Add(2, "level2.2"); bard = CharacterTestTemplates.BardyBard(); spellCasting = new SpontaneousCasting(configuration, EntityGateway <SpellList> .LoadWithSingleItem(spellList)); bard.Add(spellCasting); }
private static SpellList CreateGenericSpellList(string className, int spellsPerLevel) { var spellList = SpellList.CreateForTesting(className); //Add a bunch of spells for (int level = 0; level < 10; level++) { for (int spellCount = 0; spellCount < spellsPerLevel; spellCount++) { spellList.Add(level, string.Format("spell {0}-{1}", level, spellCount)); } } return(spellList); }
public void WandsGetMoreExpensiveWithLevels(int level, int expectedValue) { var spellList = SpellList.CreateForTesting("wizard"); spellList.Add(level, "Cure Light Wounds"); var cure = new Spell("Cure Light Wounds", "healing"); var spellGateway = EntityGateway <Spell> .LoadWithSingleItem(cure); var spellListGateway = EntityGateway <SpellList> .LoadWithSingleItem(spellList); var createwands = new WandCreator(spellGateway, spellListGateway); var wand = createwands.Process(); Assert.Equal(expectedValue, wand.Value); }
public void SelectAPotionFromAListOfSpellsAndChargesProperly(int level, int value) { var spellList = SpellList.CreateForTesting("cleric"); spellList.Add(level, "Cure Light Wounds"); var cureSpell = new Spell("Cure Light Wounds", "healing"); var spellLists = EntityGateway <SpellList> .LoadWithSingleItem(spellList); var spells = EntityGateway <Spell> .LoadWithSingleItem(cureSpell); var potionCreator = new PotionCreator(spellLists, spells); var potion = potionCreator.Process(); Assert.Equal(cureSpell, potion.Spell); Assert.Equal(value, potion.Value); }
public void WandsUtilizeAvailableListsToMakeWandsThatMakeSense() { var spellList = SpellList.CreateForTesting("wizard"); spellList.Add(1, "Cure Light Wounds"); var cure = new Spell("Cure Light Wounds", "healing"); var spellGateway = EntityGateway <Spell> .LoadWithSingleItem(cure); var spellListGateway = EntityGateway <SpellList> .LoadWithSingleItem(spellList); var createwands = new WandCreator(spellGateway, spellListGateway); var wand = createwands.Process(); Assert.Equal(cure, wand.Spell); Assert.Equal(50, wand.Charges); Assert.Equal(75000, wand.Value); }
public void MaxSpellLevelIsLevel3() { var spellList = SpellList.CreateForTesting("cleric"); spellList.Add(1, "Cure Light Wounds"); spellList.Add(4, "Cure Serious Wounds"); var cureSpell = new Spell("Cure Light Wounds", "healing"); var cureSeriousSpell = new Spell("Cure Serious Wounds", "healing"); var spellLists = EntityGateway <SpellList> .LoadWithSingleItem(spellList); var spells = EntityGateway <Spell> .LoadFromList(new Spell[] { cureSpell, cureSeriousSpell }); var potionCreator = new PotionCreator(spellLists, spells); var potion = potionCreator.Process(); //Always equals cureSpell Assert.Equal(cureSpell, potion.Spell); }
public void FiltersSpellsOutBasedOnCriteria() { var spellFiltered = new Spell("Fireball", "fire"); var spellReturned = new Spell("Iceball", "cold"); var gateway = EntityGateway <Spell> .LoadFromList(new Spell[] { spellFiltered, spellReturned }); var spellList = SpellList.CreateForTesting("wizard", gateway); spellList.Add(1, "Fireball"); spellList.Add(1, "Iceball"); var criteria = new Mock <ISpellCastingRule>(); criteria.Setup(x => x.CanCastSpell(spellFiltered)).Returns(false); criteria.Setup(x => x.CanCastSpell(spellReturned)).Returns(true); var rule = criteria.Object; AssertExtensions.EquivalentLists( new string[] { "Iceball" }, spellList.GetSpells(1, new ISpellCastingRule[] { rule }) ); }