/// <summary> /// Cast Confusion /// </summary> /// <param name="caster">Caster.</param> /// <param name="EffectID">Effect ID of the spell</param> void Cast_VasAnWis(GameObject caster, int EffectID) { //Confusion. RaycastHit hit= new RaycastHit(); NPC npc = GetNPCTargetRandom(caster, ref hit); if (npc != null) { SpellProp_Mind mindspell = new SpellProp_Mind(); mindspell.init (EffectID,caster); //Apply a impact effect to the npc Impact.SpawnHitImpact(npc.transform.name + "_impact",npc.GetImpactPoint(),mindspell.impactFrameStart,mindspell.impactFrameEnd); if (npc.gameObject.GetComponent<SpellEffectConfusion>()!=null) {//Npc already has this effect. Only allow one cast. npc.gameObject.GetComponent<SpellEffectConfusion>().counter=5;//Restart the counter } else {//A new cast int EffectSlot = CheckPassiveSpellEffectNPC(npc.gameObject); if (EffectSlot!=-1) { SpellEffectConfusion sec= (SpellEffectConfusion)SetSpellEffect(npc.gameObject, npc.NPCStatusEffects, EffectSlot, EffectID); sec.counter=mindspell.counter; sec.Go (); } } } }
/// <summary> /// Casts the hallucination effect /// </summary> /// <param name="caster">Caster.</param> /// <param name="ActiveSpellArray">Active spell array.</param> /// <param name="EffectID">Effect I.</param> /// <param name="EffectSlot">Effect slot.</param> void Cast_Hallucination(GameObject caster, SpellEffect[] ActiveSpellArray, int EffectID, int EffectSlot) { SpellProp_Mind mindspell = new SpellProp_Mind(); mindspell.init (EffectID,caster); SpellEffect hn= (SpellEffectHallucination)SetSpellEffect(caster, ActiveSpellArray, EffectSlot, EffectID); hn.counter= mindspell.counter; //sel.ApplyEffect();//Apply the effect. hn.Go ();// Apply the effect and Start the timer. //StartCoroutine(sel.timer()); }
/// <summary> /// Casts the roaming sight generic /// </summary> /// <param name="caster">Caster.</param> /// <param name="ActiveSpellArray">Active spell array.</param> /// <param name="EffectID">Effect ID of the spell</param> /// <param name="EffectSlot">Effect slot.</param> void Cast_RoamingSight(GameObject caster, SpellEffect[] ActiveSpellArray, int EffectID, int EffectSlot) { SpellProp_Mind mindspell = new SpellProp_Mind(); mindspell.init (EffectID,caster); SpellEffect srs = (SpellEffectRoamingSight)SetSpellEffect (caster, ActiveSpellArray,EffectSlot,EffectID); srs.counter=mindspell.counter; srs.Go (); }
/// <summary> /// Casts detect monster. /// </summary> /// <param name="caster">Caster.</param> /// <param name="EffectID">Effect ID of the spell</param> void Cast_DetectMonster(GameObject caster, int EffectID) { SpellProp_Mind mind = new SpellProp_Mind(); mind.init (EffectID,caster); Skills.TrackMonsters(caster,(float)mind.BaseDamage,true); }
/// <summary> /// Casts freeze time (generic) /// </summary> /// <param name="caster">Caster.</param> /// <param name="ActiveSpellArray">Active spell array.</param> /// <param name="EffectID">Effect ID of the spell</param> /// <param name="EffectSlot">Effect slot.</param> void Cast_FreezeTime(GameObject caster, SpellEffect[] ActiveSpellArray, int EffectID, int EffectSlot) { SpellProp_Mind mind = new SpellProp_Mind(); mind.init (EffectID,caster); //Apply to the player SpellEffectFreezeTime timeFreezePlayer= (SpellEffectFreezeTime)SetSpellEffect(caster, ActiveSpellArray, EffectSlot, EffectID); timeFreezePlayer.counter= mind.counter; long Key = Random.Range(1,200000); timeFreezePlayer.Key=Key; timeFreezePlayer.Go(); GameObject[] npcs= GameObject.FindGameObjectsWithTag("NPCs"); for (int i = 0; i<=npcs.GetUpperBound(0); i++) { if (npcs[i].GetComponent<SpellEffectFreezeTime>()==null)//Don't apply if they already have it { int NPCEffectSlot =CheckPassiveSpellEffectNPC(npcs[i]); //Cast_FreezeTime(npcs[i],npcs[i].GetComponent<NPC>().NPCStatusEffects,EffectID,EffectSlot); if (NPCEffectSlot!=-1) {//Check if the NPC has a freeze time already. SpellEffectFreezeTime timeFreezeNPC=(SpellEffectFreezeTime)SetSpellEffect(npcs[i],npcs[i].GetComponent<NPC>().NPCStatusEffects,NPCEffectSlot,EffectID); timeFreezeNPC.Key=Key; timeFreezeNPC.isNPC=true; timeFreezeNPC.counter=mind.counter; timeFreezeNPC.Go(); } } else {//Restart the effect timer and match the key npcs[i].GetComponent<SpellEffectFreezeTime>().Key=Key; npcs[i].GetComponent<SpellEffectFreezeTime>().counter=mind.counter; } } }
/// <summary> /// Casts Paralyze /// </summary> /// <param name="caster">Caster.</param> /// <param name="EffectID">Effect ID of the spell</param> void Cast_AnExPor(GameObject caster,int EffectID) { //Paralyze RaycastHit hit= new RaycastHit(); NPC npc = GetNPCTargetRandom(caster, ref hit); if (npc != null) { SpellProp_Mind mindspell = new SpellProp_Mind(); mindspell.init (EffectID,caster); //Apply a impact effect to the npc Impact.SpawnHitImpact(npc.transform.name + "_impact",npc.GetImpactPoint(),mindspell.impactFrameStart,mindspell.impactFrameEnd); int EffectSlot = CheckPassiveSpellEffectNPC(npc.gameObject); if (EffectSlot!=-1) { SpellEffectParalyze sep= (SpellEffectParalyze)SetSpellEffect(npc.gameObject, npc.NPCStatusEffects, EffectSlot, EffectID); sep.isNPC=true; sep.counter=mindspell.counter; sep.Go (); } } }
/// <summary> /// Casts smite undead /// </summary> /// <param name="caster">Caster.</param> /// <param name="EffectID">Effect ID of the spell</param> /// Only affects undead as set by GetNPCTargetRandom void Cast_AnCorpMani(GameObject caster, int EffectID) { //Smite undead RaycastHit hit= new RaycastHit(); NPC npc = GetNPCTargetRandom(caster, ref hit, 1); if (npc != null) { SpellProp_Mind mindspell = new SpellProp_Mind(); mindspell.init (EffectID,caster); //Apply a impact effect to the npc Impact.SpawnHitImpact(npc.transform.name + "_impact",npc.GetImpactPoint(),mindspell.impactFrameStart,mindspell.impactFrameEnd); SpellProp_DirectDamage damage = new SpellProp_DirectDamage(); damage.init (EffectID,caster); npc.ApplyAttack(damage.BaseDamage,caster); } }
/// <summary> /// Casts the telekinesis spell generic /// </summary> /// <param name="caster">Caster.</param> /// <param name="ActiveSpellArray">Active spell array.</param> /// <param name="EffectID">Effect ID of the spell</param> /// <param name="EffectSlot">Effect slot.</param> public void Cast_Telekinesis(GameObject caster, SpellEffect[] ActiveSpellArray, int EffectID, int EffectSlot) { //Telekenisis SpellProp_Mind mindspell = new SpellProp_Mind(); mindspell.init (EffectID,caster); SpellEffectTelekinesis setk = (SpellEffectTelekinesis)SetSpellEffect (caster, ActiveSpellArray,EffectSlot,EffectID); setk.counter=mindspell.counter; //It will run for x ticks. setk.Go (); }
/// <summary> /// Casts the paralyze spells (generic) /// </summary> /// <param name="caster">Caster.</param> /// <param name="ActiveSpellArray">Active spell array.</param> /// <param name="EffectID">Effect ID of the spell</param> /// <param name="EffectSlot">Effect slot.</param> public void Cast_Paralyze(GameObject caster, SpellEffect[] ActiveSpellArray, int EffectID, int EffectSlot) { //Paralyze SpellProp_Mind mindspell = new SpellProp_Mind(); mindspell.init (EffectID,caster); SpellEffectParalyze sep = (SpellEffectParalyze)SetSpellEffect (caster, ActiveSpellArray,EffectSlot,EffectID); sep.counter=mindspell.counter; //It will run for x ticks. if (caster.name!=GameWorldController.instance.playerUW.name) { sep.isNPC=true; } sep.Go (); }
/// <summary> /// Casts the maze navigation spell generic /// </summary> /// <param name="caster">Caster.</param> /// <param name="ActiveSpellArray">Active spell array.</param> /// <param name="EffectID">Effect ID of the spell</param> /// <param name="EffectSlot">Effect slot.</param> public void Cast_MazeNavigation(GameObject caster, SpellEffect[] ActiveSpellArray, int EffectID, int EffectSlot) { SpellProp_Mind mindspell = new SpellProp_Mind(); mindspell.init (EffectID,caster); SpellEffectMazeNavigation sem = (SpellEffectMazeNavigation)SetSpellEffect (caster, ActiveSpellArray,EffectSlot,EffectID); sem.counter=mindspell.counter; sem.Go (); }