public void AsDivineWizard_CastIllusionSpellsNotMemorized_Fumble() { Spell animateDead = new Spell("Animate Dead", SpellSchool.Illusion); var wizard = new Wizard(SpellSchool.Divination); Assert.AreEqual("fumble", wizard.Cast(animateDead)); }
public void AsDivineWizard_CastNecromancySpellsFromBook_NotEffective() { Spell animateDead = new Spell("Animate Dead", SpellSchool.Necromancy); var wizard = new Wizard(SpellSchool.Divination); wizard.Memorize(animateDead); Assert.AreEqual("Animate Dead", wizard.Cast(animateDead)); }
public void AsDivineWizard_CastDivineSpellFromBook_Effective() { Spell trueSight = new Spell("TrueSight", SpellSchool.Divination); var wizard = new Wizard(SpellSchool.Divination); wizard.Memorize(trueSight); Assert.AreEqual("Effective TrueSight", wizard.Cast(trueSight)); }
public virtual string Cast(Spell spell) { if (!spellBook.Contains(spell)) { return "fumble"; } return AmISpecializedIn(spell) ? "Effective " + spell.Name : spell.Name; }
private bool AmISpecializedIn(Spell spell) { return specialization.Equals(spell.School); }
public void Memorize(Spell spell) { spellBook.Add(spell); }