Example #1
0
    //offensive target spell
    public void Fireball()
    {
        string    spellName = "fireball";
        int       manaCost  = 5;
        SpellType spellType = SpellType.DamageTarget;
        float     damage    = CombatEntity.DamageAmount((int)Math.Round(casterObj.attributes.magicTotal * 0.5f), (int)Math.Round(casterObj.attributes.magicTotal * 1.5f), casterObj.attributes.magicTotal, 1.0f);

        //cast spell if in combat, else learn the spell
        if (GameManager.IsCombat())
        {
            SpellTemplate(spellName, damage, manaCost, spellType);
        }
        else
        {
            //learn spell
            try
            {
                spellDictionary.Add(spellName, new spell(Fireball));
            }
            catch (ArgumentException)
            {
                Console.WriteLine("You already know the spell " + spellName);
            }
        }
    }
Example #2
0
    /***************
    ** SPELL LIST **
    ***************/

    //offensive aoe spell
    public void ConeOfCold()
    {
        //spell stats
        string    spellName = "cone of cold";
        int       manaCost  = 10;
        SpellType spellType = SpellType.DamageAll;
        float     damage    = CombatEntity.DamageAmount((int)Math.Round(casterObj.attributes.magicTotal * 0.25f), (int)Math.Round(casterObj.attributes.magicTotal * 1.0f), casterObj.attributes.magicTotal, 1.0f);

        //cast spell if in combat, else learn the spell
        if (GameManager.IsCombat())
        {
            SpellTemplate(spellName, damage, manaCost, spellType);
        }
        else
        {
            //learn spell if not already learned
            try
            {
                spellDictionary.Add(spellName, new spell(ConeOfCold));
                Console.WriteLine("You have learned the spell " + spellName);
            }
            catch (ArgumentException)
            {
                Console.WriteLine("You already know the spell " + spellName);
            }
        }
    }
Example #3
0
    //defensive heal spell
    public void Heal()
    {
        string    spellName = "heal";
        int       manaCost  = 5;
        SpellType spellType = SpellType.HealingTarget;
        float     healing   = CombatEntity.DamageAmount((int)Math.Round(casterObj.attributes.magicTotal * 0.2f), (int)Math.Round(casterObj.attributes.magicTotal * 0.8f), casterObj.attributes.magicTotal, 1.0f);

        if (GameManager.IsCombat())
        {
            SpellTemplate(spellName, healing, manaCost, spellType);
        }
        else
        {
            //learn spell
            try
            {
                spellDictionary.Add(spellName, new spell(Heal));
            }
            catch (ArgumentException)
            {
                Console.WriteLine("You already know the spell " + spellName);
            }
        }
    }