Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        public virtual string Cast(Spell spell)
        {
            if (!spellBook.Contains(spell))
            {
                return "fumble";
            }

            return AmISpecializedIn(spell) ? "Effective " + spell.Name : spell.Name;
        }
Exemplo n.º 5
0
 private bool AmISpecializedIn(Spell spell)
 {
     return specialization.Equals(spell.School);
 }
Exemplo n.º 6
0
 public void Memorize(Spell spell)
 {
     spellBook.Add(spell);
 }