예제 #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);
        }
    }
예제 #2
0
    //Input: spell reference that allows player to cast spell on another player
    public void displayChooseSpellcaster(IAllyCastable spell)
    {
        currentSpell = spell;
        Spell convertedSpell = (Spell)spell;

        panelQueue.Enqueue(chooseSpellcasterPanel.panelID);
        Debug.Log("Queued: " + chooseSpellcasterPanel.panelID);
        chooseSpellcasterPanel.DisplayPlayerChoose(convertedSpell.sSpellName);
        CheckPanelQueue();
    }
예제 #3
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);
     }
 }