예제 #1
0
        protected virtual void OnSpellResist(GameLiving target)
        {
            m_lastdamage -= m_lastdamage / 4;
            SendEffectAnimation(target, 0, false, 0);
            if (target is GameNPC)
            {
                IControlledBrain brain = ((GameNPC)target).Brain as IControlledBrain;
                if (brain != null)
                {
                    GamePlayer owner = brain.GetPlayerOwner();
                    //Worthless checks
                    if (owner != null /* && owner.ControlledNpc != null && target == owner.ControlledNpc.Body*/)
                    {
                        MessageToLiving(owner, "Your " + target.Name + " resists the effect!", eChatType.CT_SpellResisted);
                    }
                }
            }
            else
            {
                MessageToLiving(target, "You resist the effect!", eChatType.CT_SpellResisted);
            }
            MessageToCaster(target.GetName(0, true) + " resists the effect!", eChatType.CT_SpellResisted);

            if (Spell.Damage != 0)
            {
                // notify target about missed attack for spells with damage
                AttackData ad = new AttackData();
                ad.Attacker     = Caster;
                ad.Target       = target;
                ad.AttackType   = AttackData.eAttackType.Spell;
                ad.AttackResult = GameLiving.eAttackResult.Missed;
                ad.SpellHandler = this;
                target.OnAttackedByEnemy(ad);
                target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
            }
            else if (Spell.CastTime > 0)
            {
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            }

            if (target is GameNPC)
            {
                IOldAggressiveBrain aggroBrain = ((GameNPC)target).Brain as IOldAggressiveBrain;
                if (aggroBrain != null)
                {
                    aggroBrain.AddToAggroList(Caster, 1);
                }
            }
            if (target.Realm == 0 || Caster.Realm == 0)
            {
                target.LastAttackedByEnemyTickPvE = target.CurrentRegion.Time;
                Caster.LastAttackTickPvE          = Caster.CurrentRegion.Time;
            }
            else
            {
                target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time;
                Caster.LastAttackTickPvP          = Caster.CurrentRegion.Time;
            }
        }
예제 #2
0
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            if (target == null)
            {
                return;
            }

            if (!target.IsAlive || target.ObjectState != GameObject.eObjectState.Active)
            {
                return;
            }

            // spell damage should 25;
            int end = (int)Spell.Damage;

            target.ChangeEndurance(target, GameLiving.eEnduranceChangeType.Spell, -end);

            if (target is GamePlayer player)
            {
                player.Out.SendMessage($" You lose {end} endurance!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow);
            }

            (Caster as GamePlayer)?.Out.SendMessage($"{string.Empty}{target.Name} loses {end} endurance!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow);
            target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
        }
예제 #3
0
        /// <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)
        {
            if (target == null)
            {
                return;
            }
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active)
            {
                return;
            }

            // no animation on stealthed players
            if (target is GamePlayer)
            {
                if (target.IsStealthed)
                {
                    return;
                }
            }

            SendEffectAnimation(target, 0, false, 1);

            // Create attack data.
            AttackData ad = CalculateDamageToTarget(target, effectiveness);

            DamageTarget(ad, false);

            // Interrupt only if target is actually casting
            if (target.IsCasting && Spell.Target.ToLower() != "cone")
            {
                target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
            }
        }
        /// <summary>
        /// Apply effect on target or do spell action if non duration spell
        /// </summary>
        /// <param name="target">target that gets the effect</param>
        /// <param name="effectiveness">factor from 0..1 (0%-100%)</param>
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            if (target == null || target.CurrentRegion == null)
                return;

            if (target.Realm == 0 || Caster.Realm == 0)
            {
                target.LastAttackedByEnemyTickPvE = target.CurrentRegion.Time;
                Caster.LastAttackTickPvE = Caster.CurrentRegion.Time;
            }
            else
            {
                target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time;
                Caster.LastAttackTickPvP = Caster.CurrentRegion.Time;
            }

            base.ApplyEffectOnTarget(target, effectiveness);

            if (Spell.CastTime > 0)
            {
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            }
            if (target is GameNPC)
            {
                IOldAggressiveBrain aggroBrain = ((GameNPC)target).Brain as IOldAggressiveBrain;
                if (aggroBrain != null)
                    aggroBrain.AddToAggroList(Caster, 1);
            }
        }
예제 #5
0
        /// <summary>
        /// Apply effect on target or do spell action if non duration spell
        /// </summary>
        /// <param name="target">target that gets the effect</param>
        /// <param name="effectiveness">factor from 0..1 (0%-100%)</param>
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            if (target?.CurrentRegion == null)
            {
                return;
            }

            if (target.Realm == 0 || Caster.Realm == 0)
            {
                target.LastAttackedByEnemyTickPvE = target.CurrentRegion.Time;
                Caster.LastAttackTickPvE          = Caster.CurrentRegion.Time;
            }
            else
            {
                target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time;
                Caster.LastAttackTickPvP          = Caster.CurrentRegion.Time;
            }

            base.ApplyEffectOnTarget(target, effectiveness);

            if (Spell.CastTime > 0)
            {
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            }

            if (target is GameNPC npc && npc.Brain is IOldAggressiveBrain aggroBrain)
            {
                aggroBrain.AddToAggroList(Caster, 1);
            }
        }
예제 #6
0
        /// <summary>
        /// When spell was resisted
        /// </summary>
        /// <param name="target">the target that resisted the spell</param>
        protected override void OnSpellResisted(GameLiving target)
        {
            base.OnSpellResisted(target);

            // Interrupt only if target is actually casting
            if (target.IsCasting && Spell.Target.ToLower() != "cone")
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
        }
예제 #7
0
 /// <summary>
 /// When spell was resisted
 /// </summary>
 /// <param name="target">the target that resisted the spell</param>
 protected override void OnSpellResisted(GameLiving target)
 {
     base.OnSpellResisted(target);
     if (Spell.Damage == 0 && Spell.CastTime == 0)
     {
         target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
     }
 }
 /// <summary>
 /// When spell was resisted
 /// </summary>
 /// <param name="target">the target that resisted the spell</param>
 protected override void OnSpellResisted(GameLiving target)
 {
     base.OnSpellResisted(target);
     if (Spell.CastTime == 0)
     {
         // start interrupt even for resisted instant amnesia
         target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
     }
 }
예제 #9
0
        /// <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)
            {
                return;
            }

            if (!target.IsAlive || target.ObjectState != GameObject.eObjectState.Active)
            {
                return;
            }

            target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            GameSpellEffect mez = FindEffectOnTarget(target, "Mesmerize");

            if (mez != null)
            {
                mez.Cancel(false);
                return;
            }

            if (target is GameNPC)
            {
                GameNPC npc = (GameNPC)target;
                if (npc.Brain is IOldAggressiveBrain aggroBrain)
                {
                    aggroBrain.AddToAggroList(Caster, 1);
                }
            }

            // check for spell.
            foreach (GameSpellEffect effect in target.EffectList.GetAllOfType <GameSpellEffect>())
            {
                if (effect.Spell.SpellType == ShearSpellType)
                {
                    if ((effect.Owner != effect.SpellHandler.Caster || effect.Spell.IsShearable) && effect.Spell.Value <= Spell.Value)
                    {
                        SendEffectAnimation(target, 0, false, 1);
                        effect.Cancel(false);
                        MessageToCaster("Your spell rips away some of your target's enhancing magic.", eChatType.CT_Spell);
                        MessageToLiving(target, "Some of your enhancing magic has been ripped away by a spell!", eChatType.CT_Spell);
                    }
                    else
                    {
                        SendEffectAnimation(target, 0, false, 0);
                        MessageToCaster("The target's connection to their enhancement is too strong for you to remove.", eChatType.CT_SpellResisted);
                    }

                    return;
                }
            }

            SendEffectAnimation(target, 0, false, 0);
            MessageToCaster("No enhancement of that type found on the target.", eChatType.CT_SpellResisted);
        }
예제 #10
0
        /// <summary>
        /// When spell was resisted
        /// </summary>
        /// <param name="target">the target that resisted the spell</param>
        protected override void OnSpellResisted(GameLiving target)
        {
            base.OnSpellResisted(target);

            // Interrupt only if target is actually casting
            if (target.IsCasting && Spell.Target.ToLower() != "cone")
            {
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            }
        }
예제 #11
0
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            if (target.HasAbility(Abilities.MezzImmunity))
            {
                MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }
            if (FindStaticEffectOnTarget(target, typeof(MezzRootImmunityEffect)) != null)
            {
                MessageToCaster("Your target is immune!", eChatType.CT_System);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }
            //Do nothing when already mez, but inform caster
            GameSpellEffect mezz = SpellHandler.FindEffectOnTarget(target, "Mesmerize");

            if (mezz != null)
            {
                MessageToCaster("Your target is already mezzed!", eChatType.CT_SpellResisted);
                SendEffectAnimation(target, 0, false, 0);
                return;
            }
            GameSpellEffect mezblock = SpellHandler.FindEffectOnTarget(target, "CeremonialBracerMezz");

            if (mezblock != null)
            {
                mezblock.Cancel(false);
                if (target is GamePlayer)
                {
                    (target as GamePlayer).Out.SendMessage("Your item effect intercepts the mesmerization spell and fades!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
                }
                //inform caster
                MessageToCaster("Ceremonial Bracer intercept your mez!", eChatType.CT_SpellResisted);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }

            base.ApplyEffectOnTarget(target, effectiveness);
        }
예제 #12
0
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            if (target == null) return;
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) return;

            //spell damage shood be 50-100 (thats the amount power tapped on use) i recommend 90 i think thats it but cood be wrong
            int mana = (int)(Spell.Damage);
            target.ChangeMana(target, GameLiving.eManaChangeType.Spell, (-mana));

            target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
        }
예제 #13
0
        /// <summary>
        /// Execute direct effect.
        /// </summary>
        /// <param name="target">Target that takes the damage.</param>
        /// <param name="effectiveness">Effectiveness of the spell (0..1, equalling 0-100%).</param>
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            if (target == null) return;
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) return;

            // Calculate damage to the target.

            AttackData ad = CalculateDamageToTarget(target, effectiveness);
            SendDamageMessages(ad);
            DamageTarget(ad, true);
            DrainPower(ad);
            target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
        }
        protected virtual void DealDamage(GameLiving target, double effectiveness)
        {
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active)
            {
                return;
            }

            // calc damage
            AttackData ad = CalculateDamageToTarget(target, effectiveness);

            DamageTarget(ad, true);
            SendDamageMessages(ad);
            target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
        }
예제 #15
0
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            if (target == null) return;
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) return;
            //spell damage should 25;
            int end = (int)(Spell.Damage);
            target.ChangeEndurance(target, GameLiving.eEnduranceChangeType.Spell, (-end));

            if (target is GamePlayer)
                ((GamePlayer)target).Out.SendMessage(" You lose " + end + " endurance!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow);
            (m_caster as GamePlayer).Out.SendMessage("" + target.Name + " loses " + end + " endurance!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow);

            target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
        }
예제 #16
0
        protected override void DealDamage(GameLiving target, double effectiveness)
        {
            if (target == null || !target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) return;

            if (target is GamePlayer || target is GameNPC)
            {
                // calc damage and healing
                AttackData ad = CalculateDamageToTarget(target, effectiveness);
                SendDamageMessages(ad);
                DamageTarget(ad, true);
                StealLife(ad);
                target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
            }
        }
예제 #17
0
        /// <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)
            {
                return;
            }
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active)
            {
                return;
            }

            target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            if (target is GameNPC)
            {
                GameNPC             npc        = (GameNPC)target;
                IOldAggressiveBrain aggroBrain = npc.Brain as IOldAggressiveBrain;
                if (aggroBrain != null)
                {
                    aggroBrain.AddToAggroList(Caster, 1);
                }
            }

            //check for spell.
            foreach (GameSpellEffect effect in target.EffectList.GetAllOfType <GameSpellEffect>())
            {
                foreach (Type buffType in buffs)
                {
                    if (effect.SpellHandler.GetType().Equals(buffType))
                    {
                        SendEffectAnimation(target, 0, false, 1);
                        effect.Cancel(false);
                        MessageToCaster("Your spell rips away some of your target's enhancing magic.", eChatType.CT_Spell);
                        MessageToLiving(target, "Some of your enhancing magic has been ripped away by a spell!", eChatType.CT_Spell);
                        return;
                    }
                }
            }

            SendEffectAnimation(target, 0, false, 0);
            MessageToCaster("No enhancement of that type found on the target.", eChatType.CT_SpellResisted);

            /*
             * if (!noMessages)
             * {
             *      MessageToLiving(effect.Owner, effect.Spell.Message3, eChatType.CT_SpellExpires);
             *      Message.SystemToArea(effect.Owner, Util.MakeSentence(effect.Spell.Message4, effect.Owner.GetName(0, false)), eChatType.CT_SpellExpires, effect.Owner);
             * }
             */
        }
예제 #18
0
        /// <summary>
        /// Apply effect on target or do spell action if non duration spell
        /// </summary>
        /// <param name="target">target that gets the effect</param>
        /// <param name="effectiveness">factor from 0..1 (0%-100%)</param>
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            // TODO: correct effectiveness formula
            // invoke direct effect if not resisted for DD w/ debuff spells
            if (Caster is GamePlayer player && Spell.Level > 0)
            {
                if (player.CharacterClass.ClassType == eClassType.ListCaster)
                {
                    int specLevel = Caster.GetModifiedSpecLevel(SpellLine.Spec);
                    effectiveness  = 0.75;
                    effectiveness += (specLevel - 1.0) * 0.5 / Spell.Level;
                    effectiveness  = Math.Max(0.75, effectiveness);
                    effectiveness  = Math.Min(1.25, effectiveness);
                    effectiveness *= 1.0 + Caster.GetModified(eProperty.BuffEffectiveness) * 0.01;
                }
                else
                {
                    effectiveness  = 1.0;
                    effectiveness *= 1.0 + Caster.GetModified(eProperty.DebuffEffectivness) * 0.01;
                }
            }

            base.ApplyEffectOnTarget(target, effectiveness);

            if (target.Realm == 0 || Caster.Realm == 0)
            {
                target.LastAttackedByEnemyTickPvE = target.CurrentRegion.Time;
                Caster.LastAttackTickPvE          = Caster.CurrentRegion.Time;
            }
            else
            {
                target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time;
                Caster.LastAttackTickPvP          = Caster.CurrentRegion.Time;
            }

            if (target is GameNPC npc)
            {
                if (npc.Brain is IOldAggressiveBrain aggroBrain)
                {
                    aggroBrain.AddToAggroList(Caster, 1);
                }
            }

            if (Spell.CastTime > 0)
            {
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            }
        }
예제 #19
0
        protected override void DealDamage(GameLiving target, double effectiveness)
        {
            if (target == null || !target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active)
            {
                return;
            }

            if (target is GamePlayer || target is GameNPC)
            {
                // calc damage and healing
                AttackData ad = CalculateDamageToTarget(target, effectiveness);
                SendDamageMessages(ad);
                DamageTarget(ad, true);
                StealLife(ad);
                target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
            }
        }
예제 #20
0
            protected override void OnTick()
            {
                GameLiving target = m_boltTarget;
                GameLiving caster = (GameLiving)m_actionSource;

                if (target == null)
                {
                    return;
                }
                if (target.CurrentRegion.ID != caster.CurrentRegion.ID)
                {
                    return;
                }
                if (target.ObjectState != GameObject.eObjectState.Active)
                {
                    return;
                }
                if (!target.IsAlive)
                {
                    return;
                }
                if (target == null)
                {
                    return;
                }
                if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active)
                {
                    return;
                }

                AttackData ad = m_handler.CalculateDamageToTarget(target, 1);

                ad.Damage = (int)m_handler.Spell.Damage;
                m_handler.SendDamageMessages(ad);
                m_handler.DamageTarget(ad, false);

                //if (m_handler.Spell.SubSpellID != 0) Spell subspell = m_handler.SkillBase.GetSpellByID(m_handler.Spell.SubSpellID);
                if (m_handler.Spell.SubSpellID != 0 && SkillBase.GetSpellByID(m_handler.Spell.SubSpellID) != null)
                {
                    ISpellHandler spellhandler = ScriptMgr.CreateSpellHandler(caster, SkillBase.GetSpellByID(m_handler.Spell.SubSpellID), SkillBase.GetSpellLine("Mob Spells"));
                    spellhandler.StartSpell(target);
                }

                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, caster);
            }
예제 #21
0
        protected virtual void DealDamage(GameLiving target, double effectiveness)
        {
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active)
            {
                return;
            }

            double growthPercent           = Spell.LifeDrainReturn * 0.01;
            double growthCapPercent        = Spell.AmnesiaChance * 0.01;
            double damageIncreaseInPercent = Math.Min(pulseCount * growthPercent, growthCapPercent);

            AttackData ad = CalculateDamageToTarget(target, effectiveness);

            ad.Damage += (int)(ad.Damage * damageIncreaseInPercent);
            DamageTarget(ad, true);
            SendDamageMessages(ad);
            target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
        }
예제 #22
0
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            if (target == null)
            {
                return;
            }
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active)
            {
                return;
            }

            AttackData ad = CalculateDamageToTarget(target, effectiveness);

            SendDamageMessages(ad);
            DamageTarget(ad, true);
            DrainPower(ad);
            target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
        }
예제 #23
0
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            if (target == null)
            {
                return;
            }
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active)
            {
                return;
            }

            //spell damage shood be 50-100 (thats the amount power tapped on use) i recommend 90 i think thats it but cood be wrong
            int mana = (int)(Spell.Damage);

            target.ChangeMana(target, GameLiving.eManaChangeType.Spell, (-mana));

            target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
        }
예제 #24
0
        /// <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)
        {
            if (target == null) return;
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) return;

            // no animation on stealthed players
            if (target is GamePlayer)
                if (target.IsStealthed)
                    return;

            SendEffectAnimation(target, 0, false, 1);

            // Create attack data.
            AttackData ad = CalculateDamageToTarget(target, effectiveness);
            DamageTarget(ad, false);

            // Interrupt only if target is actually casting
            if (target.IsCasting && Spell.Target.ToLower() != "cone")
                target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
        }
예제 #25
0
        /// <summary>
        /// Apply effect on target or do spell action if non duration spell
        /// </summary>
        /// <param name="target">target that gets the effect</param>
        /// <param name="effectiveness">factor from 0..1 (0%-100%)</param>
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            //TODO: correct effectiveness formula
            // invoke direct effect if not resisted for DD w/ debuff spells
            if (Spell.Level > 0)
            {
                int specLevel = 0;
                if (Caster is GamePlayer)
                {
                    specLevel = ((GamePlayer)Caster).GetModifiedSpecLevel(m_spellLine.Spec);
                }
                effectiveness = 0.75 + (specLevel - 1) * 0.5 / Spell.Level;
                effectiveness = Math.Max(0.75, effectiveness);
                effectiveness = Math.Min(1.25, effectiveness);
            }

            base.ApplyEffectOnTarget(target, effectiveness);

            if (target.Realm == 0 || Caster.Realm == 0)
            {
                target.LastAttackedByEnemyTickPvE = target.CurrentRegion.Time;
                Caster.LastAttackTickPvE          = Caster.CurrentRegion.Time;
            }
            else
            {
                target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time;
                Caster.LastAttackTickPvP          = Caster.CurrentRegion.Time;
            }
            if (target is GameNPC)
            {
                IOldAggressiveBrain aggroBrain = ((GameNPC)target).Brain as IOldAggressiveBrain;
                if (aggroBrain != null)
                {
                    aggroBrain.AddToAggroList(Caster, 1);
                }
            }
            if (Spell.CastTime > 0)
            {
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            }
        }
예제 #26
0
        /// <summary>
        /// Apply effect on target or do spell action if non duration spell
        /// </summary>
        /// <param name="target">target that gets the effect</param>
        /// <param name="effectiveness">factor from 0..1 (0%-100%)</param>
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            if (target.Realm == 0 || Caster.Realm == 0)
            {
                target.LastAttackedByEnemyTickPvE = target.CurrentRegion.Time;
                Caster.LastAttackTickPvE          = Caster.CurrentRegion.Time;
            }
            else
            {
                target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time;
                Caster.LastAttackTickPvP          = Caster.CurrentRegion.Time;
            }

            if (target.HasAbility(Abilities.CCImmunity))
            {
                MessageToCaster($"{target.Name} is immune to this effect!", eChatType.CT_SpellResisted);
                return;
            }

            if (target.TempProperties.getProperty("Charging", false))
            {
                MessageToCaster($"{target.Name} is moving to fast for this spell to have any effect!", eChatType.CT_SpellResisted);
                return;
            }

            base.ApplyEffectOnTarget(target, effectiveness);

            if (Spell.CastTime > 0)
            {
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            }

            if (target is GameNPC npc)
            {
                if (npc.Brain is IOldAggressiveBrain aggroBrain)
                {
                    aggroBrain.AddToAggroList(Caster, 1);
                }
            }
        }
예제 #27
0
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            GameSpellEffect neweffect = CreateSpellEffect(target, effectiveness);

            if (target == null)
            {
                return;
            }
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active)
            {
                return;
            }
            neweffect.Start(target);


            // calc damage
            AttackData ad = CalculateDamageToTarget(target, effectiveness);

            DamageTarget(ad, true);
            SendDamageMessages(ad);
            target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
        }
        private void DealDamage(GameLiving target, double effectiveness)
        {
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active)
            {
                return;
            }

            if (target is Keeps.GameKeepDoor || target is Keeps.GameKeepComponent)
            {
                MessageToCaster("Your spell has no effect on the keep component!", eChatType.CT_SpellResisted);
                return;
            }
            // calc damage
            AttackData ad = CalculateDamageToTarget(target, effectiveness);

            SendDamageMessages(ad);
            DamageTarget(ad, true);
            target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);

            /*
             * if (target.IsAlive)
             *      base.ApplyEffectOnTarget(target, effectiveness);*/
        }
예제 #29
0
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            if (target == null)
            {
                return;
            }
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active)
            {
                return;
            }
            //spell damage should 25;
            int end = (int)(Spell.Damage);

            target.ChangeEndurance(target, GameLiving.eEnduranceChangeType.Spell, (-end));

            if (target is GamePlayer)
            {
                ((GamePlayer)target).Out.SendMessage(" You lose " + end + " endurance!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow);
            }
            (m_caster as GamePlayer).Out.SendMessage("" + target.Name + " loses " + end + " endurance!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow);

            target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
        }
예제 #30
0
        /// <summary>
        /// Apply effect on target or do spell action if non duration spell
        /// </summary>
        /// <param name="target">target that gets the effect</param>
        /// <param name="effectiveness">factor from 0..1 (0%-100%)</param>
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            //TODO: correct effectiveness formula
            // invoke direct effect if not resisted for DD w/ debuff spells
            if (Spell.Level > 0)
            {
                int specLevel = 0;
                if (Caster is GamePlayer)
                {
                    specLevel = ((GamePlayer)Caster).GetModifiedSpecLevel(m_spellLine.Spec);
                }
                effectiveness = 0.75 + (specLevel - 1) * 0.5 / Spell.Level;
                effectiveness = Math.Max(0.75, effectiveness);
                effectiveness = Math.Min(1.25, effectiveness);
            }

            base.ApplyEffectOnTarget(target, effectiveness);

            if (target.Realm == 0 || Caster.Realm == 0)
            {
                target.LastAttackedByEnemyTickPvE = target.CurrentRegion.Time;
                Caster.LastAttackTickPvE = Caster.CurrentRegion.Time;
            }
            else
            {
                target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time;
                Caster.LastAttackTickPvP = Caster.CurrentRegion.Time;
            }
            if (target is GameNPC)
            {
                IOldAggressiveBrain aggroBrain = ((GameNPC)target).Brain as IOldAggressiveBrain;
                if (aggroBrain != null)
                    aggroBrain.AddToAggroList(Caster, 1);
            }
            if (Spell.CastTime > 0) target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
        }
예제 #31
0
        /// <summary>
        /// Apply effect on target or do spell action if non duration spell
        /// </summary>
        /// <param name="target">target that gets the effect</param>
        /// <param name="effectiveness">factor from 0..1 (0%-100%)</param>
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            if (target.Realm == 0 || Caster.Realm == 0)
            {
                target.LastAttackedByEnemyTickPvE = target.CurrentRegion.Time;
                Caster.LastAttackTickPvE = Caster.CurrentRegion.Time;
            }
            else
            {
                target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time;
                Caster.LastAttackTickPvP = Caster.CurrentRegion.Time;
            }
            if (target.HasAbility(Abilities.CCImmunity))
            {
                MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
                return;
            }
            if (target.TempProperties.getProperty("Charging", false))
            {
                MessageToCaster(target.Name + " is moving to fast for this spell to have any effect!", eChatType.CT_SpellResisted);
                return;
            }
            base.ApplyEffectOnTarget(target, effectiveness);

            if (Spell.CastTime > 0)
            {
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            }
            if(target is GameNPC)
            {
                GameNPC npc = (GameNPC)target;
                IOldAggressiveBrain aggroBrain = npc.Brain as IOldAggressiveBrain;
                if (aggroBrain != null)
                    aggroBrain.AddToAggroList(Caster, 1);
            }
        }
예제 #32
0
 /// <summary>
 /// When spell was resisted
 /// </summary>
 /// <param name="target">the target that resisted the spell</param>
 protected override void OnSpellResisted(GameLiving target)
 {
     base.OnSpellResisted(target);
     if (Spell.CastTime == 0)
     {
         // start interrupt even for resisted instant amnesia
         target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
     }
 }
예제 #33
0
		/// <summary>
		/// When spell was resisted
		/// </summary>
		/// <param name="target">the target that resisted the spell</param>
		protected virtual void OnSpellResisted(GameLiving target)
		{
			SendEffectAnimation(target, 0, false, 0);

			// Deliver message to the target, if the target is a pet, to its
			// owner instead.

			if (target is GameNPC)
			{
				IControlledBrain brain = ((GameNPC)target).Brain as IControlledBrain;
				if (brain != null)
				{
					GamePlayer owner = brain.GetPlayerOwner();
					if (owner != null)
					{
						MessageToLiving(owner, "Your " + target.Name + " resists the effect!", eChatType.CT_SpellResisted);
					}
				}
			}
			else
			{
				MessageToLiving(target, "You resist the effect!", eChatType.CT_SpellResisted);
			}

			// Deliver message to the caster as well.

			MessageToCaster(target.GetName(0, true) + " resists the effect!", eChatType.CT_SpellResisted);

			// Report resisted spell attack data to any type of living object, no need
			// to decide here what to do. For example, NPCs will use their brain.
			// "Just the facts, ma'am, just the facts."

			AttackData ad = new AttackData();
			ad.Attacker = Caster;
			ad.Target = target;
			ad.AttackType = AttackData.eAttackType.Spell;
			ad.SpellHandler = this;
			ad.AttackResult = GameLiving.eAttackResult.Missed;
			ad.IsSpellResisted = true;
			target.OnAttackedByEnemy(ad);

			// Spells that would have caused damage or are not instant will still
			// interrupt a casting player.

			/*if (target is GamePlayer)
{
if (target.IsCasting && (Spell.Damage > 0 || Spell.CastTime > 0))
target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
}*/
			if(!(Spell.SpellType.ToLower().IndexOf("debuff")>=0 && Spell.CastTime==0))
				target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);


			if (target.Realm == 0 || Caster.Realm == 0)
			{
				target.LastAttackedByEnemyTickPvE = target.CurrentRegion.Time;
				Caster.LastAttackTickPvE = Caster.CurrentRegion.Time;
			}
			else
			{
				target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time;
				Caster.LastAttackTickPvP = Caster.CurrentRegion.Time;
			}
		}
예제 #34
0
 //If mez resisted, just rupt, dont demez
 protected override void OnSpellResisted(GameLiving target)
 {
     SendEffectAnimation(target, 0, false, 0);
     MessageToCaster(target.GetName(0, true) + " resists the effect!", eChatType.CT_SpellResisted);
     target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
 }
        private void DealDamage(GameLiving target, double effectiveness)
        {
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) return;

            // calc damage
            AttackData ad = CalculateDamageToTarget(target, effectiveness);
            DamageTarget(ad, true);
            SendDamageMessages(ad);
            target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
        }
		public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
		{
// WHRIA
// Flute Mez (pulse>0)
            if (this.Spell.Pulse > 0)
            {
                if (Caster.IsWithinRadius(target, this.Spell.Range * 5) == false)
                {
                    CancelPulsingSpell(Caster, this.Spell.SpellType);
                    MessageToCaster("You are far away from the target. You stop playing your song.", eChatType.CT_Spell);
                    return;
                }

                if (target != null && (!target.IsAlive)) 
                {
                    GameSpellEffect effect = SpellHandler.FindEffectOnTarget(target, this);
                    if (effect != null)
                    {
                        effect.Cancel(false);//call OnEffectExpires
                        CancelPulsingSpell(Caster, this.Spell.SpellType);
                        MessageToCaster("You stop playing your song.", eChatType.CT_Spell);
                    }
                    return;
                }

                if (target != Caster.TargetObject)
                    return;

                if (this.Spell.Range != 0)
                {
                    if (!Caster.IsWithinRadius(target, this.Spell.Range))
                        return;
                }

            }

//

			if (target.HasAbility(Abilities.MezzImmunity))
			{
				MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
				SendEffectAnimation(target, 0, false, 0);
				target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
				return;
			}
			if (FindStaticEffectOnTarget(target, typeof(MezzRootImmunityEffect)) != null)
			{
				MessageToCaster("Your target is immune!", eChatType.CT_System);
				SendEffectAnimation(target, 0, false, 0);
				target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
				return;
			}
			//Do nothing when already mez, but inform caster
			GameSpellEffect mezz = SpellHandler.FindEffectOnTarget(target, "Mesmerize");
			if(mezz != null)
			{
				MessageToCaster("Your target is already mezzed!", eChatType.CT_SpellResisted);
//				SendEffectAnimation(target, 0, false, 0);
				return;
			}
			GameSpellEffect mezblock = SpellHandler.FindEffectOnTarget(target, "CeremonialBracerMezz");
			if (mezblock != null)
			{
				mezblock.Cancel(false);
				if (target is GamePlayer)
					(target as GamePlayer).Out.SendMessage("Your item effect intercepts the mesmerization spell and fades!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
				//inform caster
				MessageToCaster("Ceremonial Bracer intercept your mez!", eChatType.CT_SpellResisted);
				SendEffectAnimation(target, 0, false, 0);
				target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
				return;
			}

			base.ApplyEffectOnTarget(target, effectiveness);
		}
예제 #37
0
 public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
 {
     base.ApplyEffectOnTarget(target, effectiveness);
     target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
 }
예제 #38
0
 //If mez resisted, just rupt, dont demez
 protected override void OnSpellResisted(GameLiving target)
 {
     SendEffectAnimation(target, 0, false, 0);
     MessageToCaster(target.GetName(0, true) + " resists the effect!", eChatType.CT_SpellResisted);
     target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
 }
예제 #39
0
        protected virtual void OnSpellResist(GameLiving target)
        {
            m_lastdamage -= m_lastdamage / 4;
            SendEffectAnimation(target, 0, false, 0);
            if (target is GameNPC)
            {
                IControlledBrain brain = ((GameNPC)target).Brain as IControlledBrain;
                if (brain != null)
                {
                    GamePlayer owner = brain.GetPlayerOwner();
                    //Worthless checks
                    if (owner != null/* && owner.ControlledNpc != null && target == owner.ControlledNpc.Body*/)
                    {
                        MessageToLiving(owner, "Your " + target.Name + " resists the effect!", eChatType.CT_SpellResisted);
                    }
                }
            }
            else
            {
                MessageToLiving(target, "You resist the effect!", eChatType.CT_SpellResisted);
            }
            MessageToCaster(target.GetName(0, true) + " resists the effect!", eChatType.CT_SpellResisted);

            if (Spell.Damage != 0)
            {
                // notify target about missed attack for spells with damage
                AttackData ad = new AttackData();
                ad.Attacker = Caster;
                ad.Target = target;
                ad.AttackType = AttackData.eAttackType.Spell;
                ad.AttackResult = GameLiving.eAttackResult.Missed;
                ad.SpellHandler = this;
                target.OnAttackedByEnemy(ad);
                target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
            }
            else if (Spell.CastTime > 0)
            {
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            }

            if (target is GameNPC)
            {
                IOldAggressiveBrain aggroBrain = ((GameNPC)target).Brain as IOldAggressiveBrain;
                if (aggroBrain != null)
                    aggroBrain.AddToAggroList(Caster, 1);
            }
            if (target.Realm == 0 || Caster.Realm == 0)
            {
                target.LastAttackedByEnemyTickPvE = target.CurrentRegion.Time;
                Caster.LastAttackTickPvE = Caster.CurrentRegion.Time;
            }
            else
            {
                target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time;
                Caster.LastAttackTickPvP = Caster.CurrentRegion.Time;
            }
        }
예제 #40
0
            protected override void OnTick()
            {
                GameLiving target = m_boltTarget;
                GameLiving caster = (GameLiving)m_actionSource;

                if (target == null || target.CurrentRegionID != caster.CurrentRegionID || target.ObjectState != GameObject.eObjectState.Active || !target.IsAlive)
                {
                    return;
                }

                if (target is GameNPC || target.Mana > 0)
                {
                    int power;
                    if (target is GameNPC)
                    {
                        power = (int)Math.Round((target.Level * m_handler.Spell.Value * 2) / 100);
                    }
                    else
                    {
                        power = (int)Math.Round(target.MaxMana * (m_handler.Spell.Value / 250));
                    }

                    if (target.Mana < power)
                    {
                        power = target.Mana;
                    }

                    caster.Mana += power;

                    if (target is GamePlayer gamePlayer)
                    {
                        target.Mana -= power;
                        gamePlayer.Out.SendMessage($"{caster.Name} takes {power} power!", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow);
                    }

                    if (caster is GamePlayer player)
                    {
                        player.Out.SendMessage($"You receive {power} power from {target.Name}!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                    }
                }
                else
                {
                    ((GamePlayer)caster).Out.SendMessage($"You did not receive any power from {target.Name}!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                }

                // Place the caster in combat
                if (target is GamePlayer)
                {
                    caster.LastAttackTickPvP = caster.CurrentRegion.Time;
                }
                else
                {
                    caster.LastAttackTickPvE = caster.CurrentRegion.Time;
                }

                // create the attack data for the bolt
                AttackData ad = new AttackData
                {
                    Attacker     = caster,
                    Target       = target,
                    DamageType   = eDamageType.Heat,
                    AttackType   = AttackData.eAttackType.Spell,
                    AttackResult = GameLiving.eAttackResult.HitUnstyled,
                    SpellHandler = m_handler
                };

                target.OnAttackedByEnemy(ad);

                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, caster);
            }
예제 #41
0
        /// <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) return;
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) return;

            target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            if (target is GameNPC)
            {
                GameNPC npc = (GameNPC)target;
                IOldAggressiveBrain aggroBrain = npc.Brain as IOldAggressiveBrain;
                if (aggroBrain != null)
                    aggroBrain.AddToAggroList(Caster, 1);
            }

            //check for spell.
            foreach (GameSpellEffect effect in target.EffectList.GetAllOfType<GameSpellEffect>())
            {
                foreach (Type buffType in buffs)
                {
                    if (effect.SpellHandler.GetType().Equals(buffType))
                    {
                        SendEffectAnimation(target, 0, false, 1);
                        effect.Cancel(false);
                        MessageToCaster("Your spell rips away some of your target's enhancing magic.", eChatType.CT_Spell);
                        MessageToLiving(target, "Some of your enhancing magic has been ripped away by a spell!", eChatType.CT_Spell);
                        return;
                    }
                }
            }

            SendEffectAnimation(target, 0, false, 0);
            MessageToCaster("No enhancement of that type found on the target.", eChatType.CT_SpellResisted);

            /*
            if (!noMessages)
            {
                MessageToLiving(effect.Owner, effect.Spell.Message3, eChatType.CT_SpellExpires);
                Message.SystemToArea(effect.Owner, Util.MakeSentence(effect.Spell.Message4, effect.Owner.GetName(0, false)), eChatType.CT_SpellExpires, effect.Owner);
            }
            */
        }
예제 #42
0
        /// <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) return;
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) return;

            target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            GameSpellEffect mez = SpellHandler.FindEffectOnTarget(target, "Mesmerize");
            if (mez != null)
            {
                mez.Cancel(false);
                return;
            }
            if (target is GameNPC)
            {
                GameNPC npc = (GameNPC)target;
                IOldAggressiveBrain aggroBrain = npc.Brain as IOldAggressiveBrain;
                if (aggroBrain != null)
                    aggroBrain.AddToAggroList(Caster, 1);
            }

            //check for spell.
            foreach (GameSpellEffect effect in target.EffectList.GetAllOfType<GameSpellEffect>())
            {
                if (effect.Spell.SpellType == ShearSpellType)
                {
                    if ((effect.Owner != effect.SpellHandler.Caster || effect.Spell.IsShearable) && effect.Spell.Value <= Spell.Value)
                    {
                        SendEffectAnimation(target, 0, false, 1);
                        effect.Cancel(false);
                        MessageToCaster("Your spell rips away some of your target's enhancing magic.", eChatType.CT_Spell);
                        MessageToLiving(target, "Some of your enhancing magic has been ripped away by a spell!", eChatType.CT_Spell);
                    }
                    else
                    {
                        SendEffectAnimation(target, 0, false, 0);
                        MessageToCaster("The target's connection to their enhancement is too strong for you to remove.", eChatType.CT_SpellResisted);
                    }

                    return;
                }
            }

            SendEffectAnimation(target, 0, false, 0);
            MessageToCaster("No enhancement of that type found on the target.", eChatType.CT_SpellResisted);

            /*
            if (!noMessages)
            {
                MessageToLiving(effect.Owner, effect.Spell.Message3, eChatType.CT_SpellExpires);
                Message.SystemToArea(effect.Owner, Util.MakeSentence(effect.Spell.Message4, effect.Owner.GetName(0, false)), eChatType.CT_SpellExpires, effect.Owner);
            }
            */
        }
예제 #43
0
 /// <summary>
 /// Start Spell Interrupt Timer when Spell is Resisted
 /// </summary>
 /// <param name="target"></param>
 public virtual void StartSpellResistInterruptTimer(GameLiving target)
 {
     // Spells that would have caused damage or are not instant will still
     // interrupt a casting player.
     if(!(Spell.SpellType.IndexOf("debuff", StringComparison.OrdinalIgnoreCase) >= 0 && Spell.CastTime == 0))
         target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
 }
예제 #44
0
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            if (target.HasAbility(Abilities.MezzImmunity))
            {
                MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }
            if (FindStaticEffectOnTarget(target, typeof(MezzRootImmunityEffect)) != null)
            {
                MessageToCaster("Your target is immune!", eChatType.CT_System);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }
            //Do nothing when already mez, but inform caster
            GameSpellEffect mezz = SpellHandler.FindEffectOnTarget(target, "Mesmerize");
            if (mezz != null)
            {
                MessageToCaster("Your target is already mezzed!", eChatType.CT_SpellResisted);
                SendEffectAnimation(target, 0, false, 0);
                return;
            }
            GameSpellEffect mezblock = SpellHandler.FindEffectOnTarget(target, "CeremonialBracerMezz");
            if (mezblock != null)
            {
                mezblock.Cancel(false);
                if (target is GamePlayer)
                    (target as GamePlayer).Out.SendMessage("Your item effect intercepts the mesmerization spell and fades!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
                //inform caster
                MessageToCaster("Ceremonial Bracer intercept your mez!", eChatType.CT_SpellResisted);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }

            base.ApplyEffectOnTarget(target, effectiveness);
        }
예제 #45
0
            /// <summary>
            /// Called on every timer tick
            /// </summary>
            protected override void OnTick()
            {
                GameLiving target = m_boltTarget;
                GameLiving caster = (GameLiving)m_actionSource;

                if (target == null)
                {
                    return;
                }
                if (target.CurrentRegionID != caster.CurrentRegionID)
                {
                    return;
                }
                if (target.ObjectState != GameObject.eObjectState.Active)
                {
                    return;
                }
                if (!target.IsAlive)
                {
                    return;
                }

                // Related to PvP hitchance
                // http://www.camelotherald.com/news/news_article.php?storyid=2444
                // No information on bolt hitchance against npc's
                // Bolts are treated as physical attacks for the purpose of ABS only
                // Based on this I am normalizing the miss rate for npc's to be that of a standard spell

                int missrate = 0;

                if (caster is GamePlayer && target is GamePlayer)
                {
                    if (target.InCombat)
                    {
                        foreach (GameLiving attacker in target.Attackers)
                        {
                            if (attacker != caster && target.GetDistanceTo(attacker) <= 200)
                            {
                                // each attacker within 200 units adds a 20% chance to miss
                                missrate += 20;
                            }
                        }
                    }
                }

                if (target is GameNPC || caster is GameNPC)
                {
                    missrate += (int)(ServerProperties.Properties.PVE_SPELL_CONHITPERCENT * caster.GetConLevel(target));
                }

                // add defence bonus from last executed style if any
                AttackData targetAD = (AttackData)target.TempProperties.getProperty <object>(GameLiving.LAST_ATTACK_DATA, null);

                if (targetAD != null &&
                    targetAD.AttackResult == GameLiving.eAttackResult.HitStyle &&
                    targetAD.Style != null)
                {
                    missrate += targetAD.Style.BonusToDefense;
                }

                AttackData ad = m_handler.CalculateDamageToTarget(target, 0.5 - (caster.GetModified(eProperty.SpellDamage) * 0.01));

                if (Util.Chance(missrate))
                {
                    ad.AttackResult = GameLiving.eAttackResult.Missed;
                    m_handler.MessageToCaster("You miss!", eChatType.CT_YouHit);
                    m_handler.MessageToLiving(target, caster.GetName(0, false) + " missed!", eChatType.CT_Missed);
                    target.OnAttackedByEnemy(ad);
                    target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, caster);
                    if (target is GameNPC)
                    {
                        IOldAggressiveBrain aggroBrain = ((GameNPC)target).Brain as IOldAggressiveBrain;
                        if (aggroBrain != null)
                        {
                            aggroBrain.AddToAggroList(caster, 1);
                        }
                    }
                    return;
                }

                ad.Damage = (int)((double)ad.Damage * (1.0 + caster.GetModified(eProperty.SpellDamage) * 0.01));

                // Block
                bool blocked = false;

                if (target is GamePlayer)
                {                 // mobs left out yet
                    GamePlayer    player   = (GamePlayer)target;
                    InventoryItem lefthand = player.Inventory.GetItem(eInventorySlot.LeftHandWeapon);
                    if (lefthand != null && (player.AttackWeapon == null || player.AttackWeapon.Item_Type == Slot.RIGHTHAND || player.AttackWeapon.Item_Type == Slot.LEFTHAND))
                    {
                        if (target.IsObjectInFront(caster, 180) && lefthand.Object_Type == (int)eObjectType.Shield)
                        {
                            double shield      = 0.5 * player.GetModifiedSpecLevel(Specs.Shields);
                            double blockchance = ((player.Dexterity * 2) - 100) / 40.0 + shield + 5;
                            // Removed 30% increased chance to block, can find no clear evidence this is correct - tolakram
                            blockchance -= target.GetConLevel(caster) * 5;
                            if (blockchance >= 100)
                            {
                                blockchance = 99;
                            }
                            if (blockchance <= 0)
                            {
                                blockchance = 1;
                            }

                            if (target.IsEngaging)
                            {
                                EngageEffect engage = target.EffectList.GetOfType <EngageEffect>();
                                if (engage != null && target.AttackState && engage.EngageTarget == caster)
                                {
                                    // Engage raised block change to 85% if attacker is engageTarget and player is in attackstate
                                    // You cannot engage a mob that was attacked within the last X seconds...
                                    if (engage.EngageTarget.LastAttackedByEnemyTick > engage.EngageTarget.CurrentRegion.Time - EngageAbilityHandler.ENGAGE_ATTACK_DELAY_TICK)
                                    {
                                        if (engage.Owner is GamePlayer)
                                        {
                                            (engage.Owner as GamePlayer).Out.SendMessage(engage.EngageTarget.GetName(0, true) + " has been attacked recently and you are unable to engage.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                                        }
                                    }                                      // Check if player has enough endurance left to engage
                                    else if (engage.Owner.Endurance < EngageAbilityHandler.ENGAGE_DURATION_LOST)
                                    {
                                        engage.Cancel(false);                                         // if player ran out of endurance cancel engage effect
                                    }
                                    else
                                    {
                                        engage.Owner.Endurance -= EngageAbilityHandler.ENGAGE_DURATION_LOST;
                                        if (engage.Owner is GamePlayer)
                                        {
                                            (engage.Owner as GamePlayer).Out.SendMessage("You concentrate on blocking the blow!", eChatType.CT_Skill, eChatLoc.CL_SystemWindow);
                                        }

                                        if (blockchance < 85)
                                        {
                                            blockchance = 85;
                                        }
                                    }
                                }
                            }

                            if (blockchance >= Util.Random(1, 100))
                            {
                                m_handler.MessageToLiving(player, "You partially block " + caster.GetName(0, false) + "'s spell!", eChatType.CT_Missed);
                                m_handler.MessageToCaster(player.GetName(0, true) + " blocks!", eChatType.CT_YouHit);
                                blocked = true;
                            }
                        }
                    }
                }

                double effectiveness = 1.0 + (caster.GetModified(eProperty.SpellDamage) * 0.01);

                // simplified melee damage calculation
                if (blocked == false)
                {
                    // TODO: armor resists to damage type

                    double damage = m_handler.Spell.Damage / 2;                     // another half is physical damage
                    if (target is GamePlayer)
                    {
                        ad.ArmorHitLocation = ((GamePlayer)target).CalculateArmorHitLocation(ad);
                    }

                    InventoryItem armor = null;
                    if (target.Inventory != null)
                    {
                        armor = target.Inventory.GetItem((eInventorySlot)ad.ArmorHitLocation);
                    }

                    double ws = (caster.Level * 8 * (1.0 + (caster.GetModified(eProperty.Dexterity) - 50) / 200.0));

                    damage     *= ((ws + 90.68) / (target.GetArmorAF(ad.ArmorHitLocation) + 20 * 4.67));
                    damage     *= 1.0 - Math.Min(0.85, ad.Target.GetArmorAbsorb(ad.ArmorHitLocation));
                    ad.Modifier = (int)(damage * (ad.Target.GetResist(ad.DamageType) + SkillBase.GetArmorResist(armor, ad.DamageType)) / -100.0);
                    damage     += ad.Modifier;

                    damage  = damage * effectiveness;
                    damage *= (1.0 + RelicMgr.GetRelicBonusModifier(caster.Realm, eRelicType.Magic));

                    if (damage < 0)
                    {
                        damage = 0;
                    }
                    ad.Damage += (int)damage;
                }

                if (m_handler is SiegeArrow == false)
                {
                    ad.UncappedDamage = ad.Damage;
                    ad.Damage         = (int)Math.Min(ad.Damage, m_handler.DamageCap(effectiveness));
                }

                ad.Damage = (int)(ad.Damage * caster.Effectiveness);

                if (blocked == false && ad.CriticalDamage > 0)
                {
                    int critMax = (target is GamePlayer) ? ad.Damage / 2 : ad.Damage;
                    ad.CriticalDamage = Util.Random(critMax / 10, critMax);
                }

                m_handler.SendDamageMessages(ad);
                m_handler.DamageTarget(ad, false, (blocked ? 0x02 : 0x14));
                target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, caster);
            }
예제 #46
0
        //If mez resisted, just rupt, dont demez
        protected override void OnSpellResisted(GameLiving target)
        {
// WHRIA
// Flute Mez (pulse>0)
            if (this.Spell.Pulse > 0)
            {
                if (target != null && (!target.IsAlive))
                {
                    GameSpellEffect effect = SpellHandler.FindEffectOnTarget(target, this);
                    if (effect != null)
                    {
                        effect.Cancel(false);//call OnEffectExpires
                        CancelPulsingSpell(Caster, this.Spell.SpellType);
                        MessageToCaster("You stop playing your song.", eChatType.CT_Spell);
                    }
                    return;
                }

                if (this.Spell.Range != 0)
                {
                    if (!Caster.IsWithinRadius(target, this.Spell.Range))
                    {
                        return;
                    }
                }

                if (target != Caster.TargetObject)
                {
                    return;
                }
            }

            GameSpellEffect mezz = SpellHandler.FindEffectOnTarget(target, "Mesmerize");

            if (mezz != null)
            {
                MessageToCaster("Your target is already mezzed!!!", eChatType.CT_SpellResisted);
                return;
            }

            lock (target.EffectList)
            {
                foreach (IGameEffect effect in target.EffectList)
                {
                    if (effect is GameSpellEffect)
                    {
                        GameSpellEffect gsp = (GameSpellEffect)effect;
                        if (gsp is GameSpellAndImmunityEffect)
                        {
                            GameSpellAndImmunityEffect immunity = (GameSpellAndImmunityEffect)gsp;
                            if (immunity.ImmunityState &&
                                target == immunity.Owner)
                            {
                                MessageToCaster(immunity.Owner.GetName(0, true) + " can't have that effect again yet!!!", eChatType.CT_SpellPulse);
                                return;
                            }
                        }
                    }
                }
            }
// END
            SendEffectAnimation(target, 0, false, 0);
            MessageToCaster(target.GetName(0, true) + " resists the effect!", eChatType.CT_SpellResisted);
            target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
        }
예제 #47
0
파일: Arrow.cs 프로젝트: JVirant/DOLSharp
            protected override void OnTick()
            {
                GameLiving target = m_arrowTarget;
                GameLiving caster = (GameLiving)m_actionSource;

                if (target == null || !target.IsAlive || target.ObjectState != GameObject.eObjectState.Active || target.CurrentRegionID != caster.CurrentRegionID)
                {
                    return;
                }

                int missrate = 100 - m_handler.CalculateToHitChance(target);
                // add defence bonus from last executed style if any
                AttackData targetAD = (AttackData)target.TempProperties.getProperty <object>(GameLiving.LAST_ATTACK_DATA, null);

                if (targetAD != null &&
                    targetAD.AttackResult == GameLiving.eAttackResult.HitStyle &&
                    targetAD.Style != null)
                {
                    missrate += targetAD.Style.BonusToDefense;
                }

                // half of the damage is magical
                // subtract any spelldamage bonus and re-calculate after half damage is calculated
                AttackData ad = m_handler.CalculateDamageToTarget(target, 0.5 - (caster.GetModified(eProperty.SpellDamage) * 0.01));

                // check for bladeturn miss
                if (ad.AttackResult == GameLiving.eAttackResult.Missed)
                {
                    return;
                }

                if (Util.Chance(missrate))
                {
                    ad.AttackResult = GameLiving.eAttackResult.Missed;
                    m_handler.MessageToCaster("You miss!", eChatType.CT_YouHit);
                    m_handler.MessageToLiving(target, caster.GetName(0, false) + " missed!", eChatType.CT_Missed);
                    target.OnAttackedByEnemy(ad);
                    target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, caster);
                    if (target is GameNPC)
                    {
                        IOldAggressiveBrain aggroBrain = ((GameNPC)target).Brain as IOldAggressiveBrain;
                        if (aggroBrain != null)
                        {
                            aggroBrain.AddToAggroList(caster, 1);
                        }
                    }
                    return;
                }

                ad.Damage = (int)((double)ad.Damage * (1.0 + caster.GetModified(eProperty.SpellDamage) * 0.01));

                bool arrowBlock = false;

                if (target is GamePlayer && !target.IsStunned && !target.IsMezzed && !target.IsSitting && m_handler.Spell.LifeDrainReturn != (int)Archery.eShotType.Critical)
                {
                    GamePlayer    player   = (GamePlayer)target;
                    InventoryItem lefthand = player.Inventory.GetItem(eInventorySlot.LeftHandWeapon);
                    if (lefthand != null && (player.AttackWeapon == null || player.AttackWeapon.Item_Type == Slot.RIGHTHAND || player.AttackWeapon.Item_Type == Slot.LEFTHAND))
                    {
                        if (target.IsObjectInFront(caster, 180) && lefthand.Object_Type == (int)eObjectType.Shield)
                        {
                            // TODO: shield size vs number of attackers not calculated
                            double shield      = 0.5 * player.GetModifiedSpecLevel(Specs.Shields);
                            double blockchance = ((player.Dexterity * 2) - 100) / 40.0 + shield + (0 * 3) + 5;
                            blockchance += 30;
                            blockchance -= target.GetConLevel(caster) * 5;
                            if (blockchance >= 100)
                            {
                                blockchance = 99;
                            }
                            if (blockchance <= 0)
                            {
                                blockchance = 1;
                            }

                            if (target.IsEngaging)
                            {
                                EngageEffect engage = target.EffectList.GetOfType <EngageEffect>();
                                if (engage != null && target.AttackState && engage.EngageTarget == caster)
                                {
                                    // Engage raised block change to 85% if attacker is engageTarget and player is in attackstate
                                    // You cannot engage a mob that was attacked within the last X seconds...
                                    if (engage.EngageTarget.LastAttackedByEnemyTick > engage.EngageTarget.CurrentRegion.Time - EngageAbilityHandler.ENGAGE_ATTACK_DELAY_TICK)
                                    {
                                        if (engage.Owner is GamePlayer)
                                        {
                                            (engage.Owner as GamePlayer).Out.SendMessage(engage.EngageTarget.GetName(0, true) + " has been attacked recently and you are unable to engage.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                                        }
                                    }                                      // Check if player has enough endurance left to engage
                                    else if (engage.Owner.Endurance < EngageAbilityHandler.ENGAGE_DURATION_LOST)
                                    {
                                        engage.Cancel(false);                                         // if player ran out of endurance cancel engage effect
                                    }
                                    else
                                    {
                                        engage.Owner.Endurance -= EngageAbilityHandler.ENGAGE_DURATION_LOST;
                                        if (engage.Owner is GamePlayer)
                                        {
                                            (engage.Owner as GamePlayer).Out.SendMessage("You concentrate on blocking the blow!", eChatType.CT_Skill, eChatLoc.CL_SystemWindow);
                                        }

                                        if (blockchance < 85)
                                        {
                                            blockchance = 85;
                                        }
                                    }
                                }
                            }

                            if (blockchance >= Util.Random(1, 100))
                            {
                                arrowBlock = true;
                                m_handler.MessageToLiving(player, "You block " + caster.GetName(0, false) + "'s arrow!", eChatType.CT_System);
                                if (m_handler.Spell.Target.ToLower() != "area")
                                {
                                    m_handler.MessageToCaster(player.GetName(0, true) + " blocks your arrow!", eChatType.CT_System);
                                    m_handler.DamageTarget(ad, false, 0x02);
                                }
                            }
                        }
                    }
                }

                if (arrowBlock == false)
                {
                    // now calculate the magical part of arrow damage (similar to bolt calculation).  Part 1 Physical, Part 2 Magical

                    double damage = m_handler.Spell.Damage / 2;                     // another half is physical damage
                    if (target is GamePlayer)
                    {
                        ad.ArmorHitLocation = ((GamePlayer)target).CalculateArmorHitLocation(ad);
                    }

                    InventoryItem armor = null;
                    if (target.Inventory != null)
                    {
                        armor = target.Inventory.GetItem((eInventorySlot)ad.ArmorHitLocation);
                    }

                    double ws = (caster.Level * 8 * (1.0 + (caster.GetModified(eProperty.Dexterity) - 50) / 200.0));

                    damage     *= ((ws + 90.68) / (target.GetArmorAF(ad.ArmorHitLocation) + 20 * 4.67));
                    damage     *= 1.0 - Math.Min(0.85, ad.Target.GetArmorAbsorb(ad.ArmorHitLocation));
                    ad.Modifier = (int)(damage * (ad.Target.GetResist(ad.DamageType) + SkillBase.GetArmorResist(armor, ad.DamageType)) / -100.0);
                    damage     += ad.Modifier;

                    double effectiveness = caster.Effectiveness;
                    effectiveness += (caster.GetModified(eProperty.SpellDamage) * 0.01);
                    damage         = damage * effectiveness;

                    damage *= (1.0 + RelicMgr.GetRelicBonusModifier(caster.Realm, eRelicType.Magic));

                    if (damage < 0)
                    {
                        damage = 0;
                    }

                    ad.Damage += (int)damage;

                    if (caster.AttackWeapon != null)
                    {
                        // Quality
                        ad.Damage -= (int)(ad.Damage * (100 - caster.AttackWeapon.Quality) * .01);

                        // Condition
                        ad.Damage = (int)((double)ad.Damage * Math.Min(1.0, (double)caster.AttackWeapon.Condition / (double)caster.AttackWeapon.MaxCondition));

                        // Patch Note:  http://support.darkageofcamelot.com/kb/article.php?id=931
                        // - The Damage Per Second (DPS) of your bow will have an effect on your damage for archery shots. If the effective DPS
                        //   of your equipped bow is less than that of your max DPS for the level of archery shot you are using, the damage of your
                        //   shot will be reduced. Max DPS for a particular level can be found by using this equation: (.3 * level) + 1.2

                        int spellRequiredDPS = 12 + 3 * m_handler.Spell.Level;

                        if (caster.AttackWeapon.DPS_AF < spellRequiredDPS)
                        {
                            double percentReduction = (double)caster.AttackWeapon.DPS_AF / (double)spellRequiredDPS;
                            ad.Damage = (int)(ad.Damage * percentReduction);
                        }
                    }

                    if (ad.Damage < 0)
                    {
                        ad.Damage = 0;
                    }

                    ad.UncappedDamage = ad.Damage;
                    ad.Damage         = (int)Math.Min(ad.Damage, m_handler.DamageCap(effectiveness));

                    if (ad.CriticalDamage > 0)
                    {
                        if (m_handler.Spell.Target.ToLower() == "area")
                        {
                            ad.CriticalDamage = 0;
                        }
                        else
                        {
                            int critMax = (target is GamePlayer) ? ad.Damage / 2 : ad.Damage;
                            ad.CriticalDamage = Util.Random(critMax / 10, critMax);
                        }
                    }

                    target.ModifyAttack(ad);

                    m_handler.SendDamageMessages(ad);
                    m_handler.DamageTarget(ad, false, 0x14);
                    target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, caster);
                }


                if (m_handler.Spell.SubSpellID != 0)
                {
                    Spell subspell = SkillBase.GetSpellByID(m_handler.Spell.SubSpellID);
                    if (subspell != null)
                    {
                        subspell.Level = m_handler.Spell.Level;
                        ISpellHandler spellhandler = ScriptMgr.CreateSpellHandler(m_handler.Caster, subspell, SkillBase.GetSpellLine(GlobalSpellsLines.Combat_Styles_Effect));
                        if (spellhandler != null)
                        {
                            spellhandler.StartSpell(target);
                        }
                    }
                }

                if (arrowBlock == false && m_handler.Caster.AttackWeapon != null && GlobalConstants.IsBowWeapon((eObjectType)m_handler.Caster.AttackWeapon.Object_Type))
                {
                    if (ad.AttackResult == GameLiving.eAttackResult.HitUnstyled || ad.AttackResult == GameLiving.eAttackResult.HitStyle)
                    {
                        caster.CheckWeaponMagicalEffect(ad, m_handler.Caster.AttackWeapon);
                    }
                }
            }
예제 #48
0
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
// WHRIA
// Flute Mez (pulse>0)
            if (this.Spell.Pulse > 0)
            {
                if (Caster.IsWithinRadius(target, this.Spell.Range * 5) == false)
                {
                    CancelPulsingSpell(Caster, this.Spell.SpellType);
                    MessageToCaster("You are far away from the target. You stop playing your song.", eChatType.CT_Spell);
                    return;
                }

                if (target != null && (!target.IsAlive))
                {
                    GameSpellEffect effect = SpellHandler.FindEffectOnTarget(target, this);
                    if (effect != null)
                    {
                        effect.Cancel(false);//call OnEffectExpires
                        CancelPulsingSpell(Caster, this.Spell.SpellType);
                        MessageToCaster("You stop playing your song.", eChatType.CT_Spell);
                    }
                    return;
                }

                if (target != Caster.TargetObject)
                {
                    return;
                }

                if (this.Spell.Range != 0)
                {
                    if (!Caster.IsWithinRadius(target, this.Spell.Range))
                    {
                        return;
                    }
                }
            }

//

            if (target.HasAbility(Abilities.MezzImmunity))
            {
                MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }
            if (FindStaticEffectOnTarget(target, typeof(MezzRootImmunityEffect)) != null)
            {
                MessageToCaster("Your target is immune!", eChatType.CT_System);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }
            //Do nothing when already mez, but inform caster
            GameSpellEffect mezz = SpellHandler.FindEffectOnTarget(target, "Mesmerize");

            if (mezz != null)
            {
                MessageToCaster("Your target is already mezzed!", eChatType.CT_SpellResisted);
//				SendEffectAnimation(target, 0, false, 0);
                return;
            }
            GameSpellEffect mezblock = SpellHandler.FindEffectOnTarget(target, "CeremonialBracerMezz");

            if (mezblock != null)
            {
                mezblock.Cancel(false);
                if (target is GamePlayer)
                {
                    (target as GamePlayer).Out.SendMessage("Your item effect intercepts the mesmerization spell and fades!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
                }
                //inform caster
                MessageToCaster("Ceremonial Bracer intercept your mez!", eChatType.CT_SpellResisted);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }

            base.ApplyEffectOnTarget(target, effectiveness);
        }
		//If mez resisted, just rupt, dont demez
		protected override void OnSpellResisted(GameLiving target)
		{
// WHRIA
// Flute Mez (pulse>0)
            if (this.Spell.Pulse > 0)
            {
                if (target != null && (!target.IsAlive))
                {
                    GameSpellEffect effect = SpellHandler.FindEffectOnTarget(target, this);
                    if (effect != null)
                    {
                        effect.Cancel(false);//call OnEffectExpires
                        CancelPulsingSpell(Caster, this.Spell.SpellType);
                        MessageToCaster("You stop playing your song.", eChatType.CT_Spell);
                    }
                    return;
                }

                if (this.Spell.Range != 0)
                {
                    if (!Caster.IsWithinRadius(target, this.Spell.Range))
                        return;
                }

                if (target != Caster.TargetObject)
                    return;
            }

            GameSpellEffect mezz = SpellHandler.FindEffectOnTarget(target, "Mesmerize");
            if (mezz != null)
            {
                MessageToCaster("Your target is already mezzed!!!", eChatType.CT_SpellResisted);
                return;
            }

            lock (target.EffectList)
            {
                foreach (IGameEffect effect in target.EffectList)
                {
                    if (effect is GameSpellEffect)
                    {
                        GameSpellEffect gsp = (GameSpellEffect)effect;
                        if (gsp is GameSpellAndImmunityEffect)
                        {
                            GameSpellAndImmunityEffect immunity = (GameSpellAndImmunityEffect)gsp;
                            if (immunity.ImmunityState
                                && target == immunity.Owner)
                            {
                                MessageToCaster(immunity.Owner.GetName(0, true) + " can't have that effect again yet!!!", eChatType.CT_SpellPulse);
                                return;
                            }
                        }
                    }
                }
            }
// END
			SendEffectAnimation(target, 0, false, 0);
			MessageToCaster(target.GetName(0, true) + " resists the effect!", eChatType.CT_SpellResisted);
			target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
		}
예제 #50
0
 public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
 {
     base.ApplyEffectOnTarget(target, effectiveness);
     target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
 }
예제 #51
0
        protected virtual void OnSpellResist(GameLiving target)
        {
            m_lastdamage -= Convert.ToInt32(m_lastdamage * 0.25);
            SendEffectAnimation(target, 0, false, 0);
            if (target is GameNPC npc)
            {
                if (npc.Brain is IControlledBrain brain)
                {
                    GamePlayer owner = brain.GetPlayerOwner();
                    if (owner != null)
                    {
                        MessageToLiving(owner, $"Your {target.Name} resists the effect!", eChatType.CT_SpellResisted);
                    }
                }
            }
            else
            {
                MessageToLiving(target, "You resist the effect!", eChatType.CT_SpellResisted);
            }

            MessageToCaster($"{target.GetName(0, true)} resists the effect!", eChatType.CT_SpellResisted);

            if (Spell.Damage != 0)
            {
                // notify target about missed attack for spells with damage
                AttackData ad = new AttackData
                {
                    Attacker     = Caster,
                    Target       = target,
                    AttackType   = AttackData.eAttackType.Spell,
                    AttackResult = GameLiving.eAttackResult.Missed,
                    SpellHandler = this
                };

                target.OnAttackedByEnemy(ad);
                target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
            }
            else if (Spell.CastTime > 0)
            {
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            }

            if (target is GameNPC gameNpc)
            {
                if (gameNpc.Brain is IOldAggressiveBrain aggroBrain)
                {
                    aggroBrain.AddToAggroList(Caster, 1);
                }
            }

            if (target.Realm == 0 || Caster.Realm == 0)
            {
                target.LastAttackedByEnemyTickPvE = target.CurrentRegion.Time;
                Caster.LastAttackTickPvE          = Caster.CurrentRegion.Time;
            }
            else
            {
                target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time;
                Caster.LastAttackTickPvP          = Caster.CurrentRegion.Time;
            }
        }
예제 #52
0
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            GameSpellEffect neweffect = CreateSpellEffect(target, effectiveness);
            if (target == null) return;
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) return;
            neweffect.Start(target);

            // calc damage
            AttackData ad = CalculateDamageToTarget(target, effectiveness);
            DamageTarget(ad, true);
            SendDamageMessages(ad);
            target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
        }
        private void DealDamage(GameLiving target, double effectiveness)
        {
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) return;

            if (target is Keeps.GameKeepDoor || target is Keeps.GameKeepComponent)
            {
                MessageToCaster("Your spell has no effect on the keep component!", eChatType.CT_SpellResisted);
                return;
            }
            // calc damage
            AttackData ad = CalculateDamageToTarget(target, effectiveness);
            SendDamageMessages(ad);
            DamageTarget(ad, true);
            target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
            /*
            if (target.IsAlive)
                base.ApplyEffectOnTarget(target, effectiveness);*/
        }
예제 #54
0
 /// <summary>
 /// When spell was resisted
 /// </summary>
 /// <param name="target">the target that resisted the spell</param>
 protected override void OnSpellResisted(GameLiving target)
 {
     base.OnSpellResisted(target);
     if (Spell.Damage == 0 && Spell.CastTime == 0)
     {
         target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
     }
 }