Beispiel #1
0
    public override void UseItem(SpellCaster player)
    {
        SoundManager.instance.PlaySingle(SoundManager.glimmeringCabochon);
        player.RemoveFromInventory(this);

        List <Spell> spells = new List <Spell>();

        // only include spell if it's non-combat
        foreach (Spell s in player.chapter.spellsCollected)
        {
            if (!s.combatSpell)
            {
                if (!s.sSpellName.Equals("Deja Vu"))     // don't allow cabochon to cast Deja vu (too complicated)
                {
                    spells.Add(s);
                }
            }
        }

        Spell spell = spells[Random.Range(0, spells.Count)];

        if (spell is IAllyCastable)
        {
            IAllyCastable spellToCast = (IAllyCastable)spell;

            // cast the spell
            spellToCast.RecieveCastFromAlly(player);
        }
        else
        {
            player.CollectMana(spell.iManaCost);
            spell.SpellCast(player);
        }
    }
Beispiel #2
0
 //The ally recieves this event.
 public override void OnEvent(CastOnAllyEvent evnt)
 {
     playerSpellcaster = playerEntity.GetComponent <Player>().spellcaster;
     // 8 stands for all spellcasters, the spell is targeting everyone
     if (playerSpellcaster.spellcasterID == evnt.ToSpellcaster || evnt.ToSpellcaster == 8)
     {
         //PanelHolder.instance.displayNotify(evnt.EventName, "Lose " + ((int)(evnt.PercentDmgDecimal * 100)) + "% health", "OK");
         IAllyCastable spell = (IAllyCastable)AllSpellsDict.AllSpells[evnt.Spellname];
         spell.RecieveCastFromAlly(playerSpellcaster);
     }
 }