/// <summary> /// This spell is a pulsing spell, not a pulsing effect, so we check spell pulse /// </summary> /// <param name="effect"></param> public override void OnSpellPulse(PulsingSpellEffect effect) { if (m_originalTarget == null || Caster.ObjectState != GameObject.eObjectState.Active || m_originalTarget.ObjectState != GameObject.eObjectState.Active) { MessageToCaster("Your spell was cancelled.", eChatType.CT_SpellExpires); effect.Cancel(false); return; } if (!Caster.IsAlive || !m_originalTarget.IsAlive || Caster.IsMezzed || Caster.IsStunned || Caster.IsSitting || (Caster.TargetObject is GameLiving ? m_originalTarget != Caster.TargetObject as GameLiving : true)) { MessageToCaster("Your spell was cancelled.", eChatType.CT_SpellExpires); effect.Cancel(false); return; } if (!Caster.IsWithinRadius(m_originalTarget, CalculateSpellRange())) { MessageToCaster("Your target is no longer in range.", eChatType.CT_SpellExpires); effect.Cancel(false); return; } if (!Caster.TargetInView) { MessageToCaster("Your target is no longer in view.", eChatType.CT_SpellExpires); effect.Cancel(false); return; } base.OnSpellPulse(effect); }
/// <summary> /// When spell pulses /// </summary> public virtual void OnSpellPulse(PulsingSpellEffect effect) { if (Caster.IsMoving && Spell.IsFocus) { MessageToCaster("Your spell was cancelled.", eChatType.CT_SpellExpires); effect.Cancel(false); return; } if (Caster.IsAlive == false) { effect.Cancel(false); return; } if (Caster.ObjectState != GameObject.eObjectState.Active) return; if (Caster.IsStunned || Caster.IsMezzed) return; // no instrument anymore = stop the song if (m_spell.InstrumentRequirement != 0 && !CheckInstrument()) { MessageToCaster("You stop playing your song.", eChatType.CT_Spell); effect.Cancel(false); return; } if (Caster.Mana >= Spell.PulsePower) { Caster.Mana -= Spell.PulsePower; if (Spell.InstrumentRequirement != 0 || !HasPositiveEffect) { SendEffectAnimation(Caster, 0, true, 1); // pulsing auras or songs } StartSpell(m_spellTarget); } else { MessageToCaster("You do not have enough mana and your spell was cancelled.", eChatType.CT_SpellExpires); effect.Cancel(false); } }
/// <summary> /// When spell pulses /// </summary> public virtual void OnSpellPulse(PulsingSpellEffect effect) { if (Caster.IsMoving && Spell.IsFocus) { MessageToCaster("Your spell was cancelled.", eChatType.CT_SpellExpires); effect.Cancel(false); return; } if (Caster.IsAlive == false) { effect.Cancel(false); return; } if (Caster.ObjectState != GameObject.eObjectState.Active) return; if (Caster.IsStunned || Caster.IsMezzed) return; // no instrument anymore = stop the song if (m_spell.InstrumentRequirement != 0 && !CheckInstrument()) { MessageToCaster("You stop playing your song.", eChatType.CT_Spell); effect.Cancel(false); return; } if (Caster.Mana >= Spell.PulsePower) { Caster.Mana -= Spell.PulsePower; if (Spell.InstrumentRequirement != 0 || !HasPositiveEffect) { SendEffectAnimation(Caster, 0, true, 1); // pulsing auras or songs } StartSpell(m_spellTarget); if (m_spell.SubSpellID > 0 && Spell.SpellType != "Archery" && Spell.SpellType != "Bomber" && Spell.SpellType != "SummonAnimistFnF" && Spell.SpellType != "SummonAnimistPet" && Spell.SpellType != "Grapple") { Spell spell = SkillBase.GetSpellByID(m_spell.SubSpellID); //we need subspell ID to be 0, we don't want spells linking off the subspell if (spell != null && spell.SubSpellID == 0) { ISpellHandler spellhandler = ScriptMgr.CreateSpellHandler(m_caster, spell, SkillBase.GetSpellLine(GlobalSpellsLines.Reserved_Spells)); spellhandler.StartSpell(m_spellTarget); } } } else { MessageToCaster("You do not have enough mana and your spell was cancelled.", eChatType.CT_SpellExpires); effect.Cancel(false); } }
/// <summary> /// When spell pulses /// </summary> public virtual void OnSpellPulse(PulsingSpellEffect effect) { // WHRIA // Cure Poison , Cure Disease if (Spell.SpellType == "CurePoison" || Spell.SpellType == "CureDisease") { if (!m_spellTarget.IsAlive) { MessageToCaster("Target is dead. Your spell is cancelled.", eChatType.CT_SpellExpires); effect.Cancel(false); CancelPulsingSpell(Caster, Spell.SpellType); return; } if (Spell.Range != 0) { if (!Caster.IsWithinRadius(m_spellTarget, Spell.Range)) { // MessageToCaster("WHRIA // Target is too far away.", eChatType.CT_SpellExpires); // effect.Cancel(false); // CancelPulsingSpell(Caster, Spell.SpellType); return; } } } // END // WHRIA CHECK LOS , PULSE SPELLS if (ServerProperties.Properties.CHECK_LOS_DURING_CAST) { if (Spell.SpellType == "CurePoison" || Spell.SpellType == "CureDisease" || Spell.SpellType == "Mesmerize" ) { if (Caster is GamePlayer) { GamePlayer playerChecker = Caster as GamePlayer; playerChecker.Out.SendCheckLOS(Caster, m_spellTarget, new CheckLOSResponse(CheckLOSPlayerToTarget)); } } } if (Caster.IsMoving && Spell.IsFocus) { MessageToCaster("Your spell was cancelled.", eChatType.CT_SpellExpires); effect.Cancel(false); return; } if (Caster.IsAlive == false) { effect.Cancel(false); return; } if (Caster.ObjectState != GameObject.eObjectState.Active) return; if (Caster.IsStunned || Caster.IsMezzed) return; // no instrument anymore = stop the song if (m_spell.InstrumentRequirement != 0 && !CheckInstrument()) { MessageToCaster("You stop playing your song.", eChatType.CT_Spell); effect.Cancel(false); return; } if (Caster.Mana >= Spell.PulsePower) { Caster.Mana -= Spell.PulsePower; if (Spell.InstrumentRequirement != 0 || !HasPositiveEffect) { SendEffectAnimation(Caster, 0, true, 1); // pulsing auras or songs } // WHRIA if (Caster.TargetObject != null) { if ((Spell.SpellType == "CurePoison" || Spell.SpellType == "CureDisease") && Caster.TargetObject is GameLiving) { m_spellTarget = (GameLiving)Caster.TargetObject; MessageToCaster(Util.MakeSentence(Spell.Message2, Caster.TargetObject.Name), eChatType.CT_Spell); } } StartSpell(m_spellTarget); m_pulsecount++; if (m_pulsecount >= (Spell.Pulse-1) && Spell.Pulse > 1 && (Spell.SpellType == "CurePoison" || Spell.SpellType == "CureDisease")) { CancelPulsingSpell(Caster, Spell.SpellType); return; } /* if (Spell.SpellType == "CurePoison" || Spell.SpellType == "CureDisease") { // Only up to three pulses if ((Spell.ID == 14380 || Spell.ID == 14381) && (Caster.CurrentRegion.Time - m_started - Spell.CastTime) > 4000) { CancelPulsingSpell(Caster, Spell.SpellType); return; } // Only up to two pulses if ((Spell.ID == 14379 || Spell.ID == 14378) && (Caster.CurrentRegion.Time - m_started - Spell.CastTime) > 1000) { CancelPulsingSpell(Caster, Spell.SpellType); return; } } */ // END if (m_spell.SubSpellID > 0 && Spell.SpellType != "Archery" && Spell.SpellType != "Bomber" && Spell.SpellType != "SummonAnimistFnF" && Spell.SpellType != "SummonAnimistPet" && Spell.SpellType != "Grapple") { Spell spell = SkillBase.GetSpellByID(m_spell.SubSpellID); //we need subspell ID to be 0, we don't want spells linking off the subspell if (spell != null && spell.SubSpellID == 0) { ISpellHandler spellhandler = ScriptMgr.CreateSpellHandler(m_caster, spell, SkillBase.GetSpellLine(GlobalSpellsLines.Reserved_Spells)); spellhandler.StartSpell(m_spellTarget); } } } else { MessageToCaster("You do not have enough mana and your spell was cancelled.", eChatType.CT_SpellExpires); effect.Cancel(false); } }