public override void OnDirectEffect(GameLiving target, double effectiveness) { if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) { return; } SendEffectAnimation(target, m_spell.ClientEffect, boltDuration: 0, noSound: false, success: 1); var mesmerizeEffect = target.FindEffectOnTarget("Mesmerize"); if (mesmerizeEffect != null) { mesmerizeEffect.Cancel(false); } var speedDecreaseEffect = target.FindEffectOnTarget("SpeedDecrease"); if (speedDecreaseEffect != null) { speedDecreaseEffect.Cancel(false); } bool targetIsGameplayer = target is GamePlayer; var necroPet = target as NecromancerPet; if (targetIsGameplayer || necroPet != null) { int powerRendValue; if (targetIsGameplayer) { powerRendValue = (int)(target.MaxMana * Spell.Value * GetVariance()); if (powerRendValue > target.Mana) { powerRendValue = target.Mana; } target.Mana -= powerRendValue; target.MessageToSelf(string.Format(m_spell.Message2, powerRendValue), eChatType.CT_Spell); } else { powerRendValue = (int)(necroPet.Owner.MaxMana * Spell.Value * GetVariance()); if (powerRendValue > necroPet.Owner.Mana) { powerRendValue = necroPet.Owner.Mana; } necroPet.Owner.Mana -= powerRendValue; necroPet.Owner.MessageToSelf(string.Format(m_spell.Message2, powerRendValue), eChatType.CT_Spell); } MessageToCaster(string.Format(m_spell.Message1, powerRendValue), eChatType.CT_Spell); } }
/// <summary> /// execute non duration spell effect on target /// </summary> /// <param name="target"></param> /// <param name="effectiveness"></param> public override void OnDirectEffect(GameLiving target, double effectiveness) { base.OnDirectEffect(target, effectiveness); if (target == null || !target.IsAlive) return; // RR4: we remove all the effects foreach (string toRemove in SpellTypesToRemove) { GameSpellEffect effect = target.FindEffectOnTarget(toRemove); if (effect != null) effect.Cancel(false); } SendEffectAnimation(target, 0, false, 1); }
/// <summary> /// execute non duration spell effect on target /// </summary> /// <param name="target"></param> /// <param name="effectiveness"></param> public override void OnDirectEffect(GameLiving target, double effectiveness) { base.OnDirectEffect(target, effectiveness); if (target == null || !target.IsAlive) { return; } // RR4: we remove all the effects foreach (string toRemove in SpellTypesToRemove) { GameSpellEffect effect = target.FindEffectOnTarget(toRemove); effect?.Cancel(false); } SendEffectAnimation(target, 0, false, 1); }