//Cast the spell on the ally. Initiates and send a network event. //from = ID of this spellcaster //to = ID of ally spellcaster public void CastOnAlly(int from, int to, string spellName) { var evnt = CastOnAllyEvent.Create(Bolt.GlobalTargets.Everyone); evnt.FromSpellcaster = from; evnt.ToSpellcaster = to; evnt.Spellname = spellName; evnt.Send(); }
//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); } }