示例#1
0
 public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
 {
     if (target.HasAbility(Abilities.StunImmunity))
     {
         MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
         base.OnSpellResisted(target);
         return;
     }
     //Ceremonial bracer dont intercept physical stun
     if (Spell.SpellType.ToLower() != "stylestun")
     {
         GameSpellEffect stunblock = SpellHandler.FindEffectOnTarget(target, "CeremonialBracerStun");
         if (stunblock != null)
         {
             stunblock.Cancel(false);
             if (target is GamePlayer)
             {
                 (target as GamePlayer).Out.SendMessage("Your item effect intercepts the stun spell and fades!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
             }
             base.OnSpellResisted(target);
             return;
         }
     }
     base.ApplyEffectOnTarget(target, effectiveness);
 }
示例#2
0
        public override int CalcValue(GameLiving living, eProperty property)
        {
            int debuff = living.DebuffCategory[(int)property];

            if (debuff > 0)
            {
                GameSpellEffect nsreduction = SpellHandler.FindEffectOnTarget(living, "NearsightReduction");
                if (nsreduction != null)
                {
                    debuff *= (int)(1.00 - nsreduction.Spell.Value * 0.01);
                }
            }

            int item = Math.Max(0, 100 - debuff + Math.Min(10, living.ItemBonus[(int)property])); // http://www.camelotherald.com/more/1325.shtml

            int ra = 0;

            if (living.RangedAttackType == GameLiving.eRangedAttackType.Long)
            {
                ra = 50;

                IGameEffect effect = living.EffectList.GetOfType <TrueshotEffect>();
                effect?.Cancel(false);
            }

            return(item + ra);
        }
示例#3
0
        public override bool Interact(GamePlayer player)
        {
            if (!base.Interact(player))
            {
                return(false);
            }

            TurnTo(player, 5000);

            GameSpellEffect effect = SpellHandler.FindEffectOnTarget(player, CURED_SPELL_TYPE);

            if (effect != null)
            {
                effect.Cancel(false);
                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Healer.Interact.Text1",
                                                                  GetName(0, false, player.Client.Account.Language, this)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }

            if (player.TotalConstitutionLostAtDeath > 0)
            {
                int oneConCost = GamePlayer.prcRestore[player.Level < GamePlayer.prcRestore.Length ? player.Level : GamePlayer.prcRestore.Length - 1];
                player.TempProperties.setProperty(COST_BY_PTS, (long)oneConCost);
                player.Out.SendCustomDialog(LanguageMgr.GetTranslation(player.Client.Account.Language, "Healer.Interact.Text2",
                                                                       Money.GetString(player.TotalConstitutionLostAtDeath * (long)oneConCost)), new CustomDialogResponse(HealerDialogResponse));
            }
            else
            {
                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Healer.Interact.Text3"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }
            return(true);
        }
        public override bool CheckBeginCast(GameLiving selectedTarget)
        {
            if (!base.CheckBeginCast(selectedTarget))
            {
                return(false);
            }
            GameSpellEffect RangeSpell = SpellHandler.FindEffectOnTarget(Caster, "Range");

            if (RangeSpell != null)
            {
                MessageToCaster("You already preparing a Range spell", eChatType.CT_System); return(false);
            }
            GameSpellEffect UninterruptableSpell = SpellHandler.FindEffectOnTarget(Caster, "Uninterruptable");

            if (UninterruptableSpell != null)
            {
                MessageToCaster("You already preparing a Uninterruptable spell", eChatType.CT_System); return(false);
            }
            GameSpellEffect PowerlessSpell = SpellHandler.FindEffectOnTarget(Caster, "Powerless");

            if (PowerlessSpell != null)
            {
                MessageToCaster("You must finish casting Powerless before you can cast it again", eChatType.CT_System); return(false);
            }
            return(true);
        }
示例#5
0
        /// <summary>
        /// Resurrects target if it accepts
        /// </summary>
        /// <param name="player"></param>
        /// <param name="response"></param>
        protected virtual void ResurrectResponceHandler(GamePlayer player, byte response)
        {
            //DOLConsole.WriteLine("resurrect responce: " + response);
            GameTimer resurrectExpiredTimer = null;

            lock (m_resTimersByLiving.SyncRoot)
            {
                resurrectExpiredTimer = (GameTimer)m_resTimersByLiving[player];
                m_resTimersByLiving.Remove(player);
            }
            if (resurrectExpiredTimer != null)
            {
                resurrectExpiredTimer.Stop();
            }

            GameLiving rezzer = (GameLiving)player.TempProperties.getProperty <object>(RESURRECT_CASTER_PROPERTY, null);

            if (!player.IsAlive)
            {
                if (rezzer == null)
                {
                    player.Out.SendMessage("No one is currently trying to resurrect you.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                }
                else
                {
                    if (response == 1)
                    {
                        ResurrectLiving(player);                         //accepted
                        //VaNaTiC->
                        //#warning VaNaTiC: add this in GamePlayer.OnRevive with my RevivedEventArgs
                        // Patch 1.56: Resurrection sickness now goes from 100% to 50% when doing a "full rez" on another player.
                        // We have do to this here, cause we dont have any other chance to get
                        // an object-relation between the casted spell of the rezzer (here) and
                        // the produced illness for the player (OnRevive()).
                        // -> any better solution -> post :)
                        if (Spell.ResurrectHealth == 100)
                        {
                            GameSpellEffect effect = SpellHandler.FindEffectOnTarget(player, "PveResurrectionIllness");
                            if (effect != null)
                            {
                                effect.Overwrite(new GameSpellEffect(effect.SpellHandler, effect.Duration / 2, effect.PulseFreq));
                            }
                            GameSpellEffect effecttwo = SpellHandler.FindEffectOnTarget(player, "RvrResurrectionIllness");
                            if (effecttwo != null)
                            {
                                effecttwo.Overwrite(new GameSpellEffect(effecttwo.SpellHandler, effecttwo.Duration / 2, effecttwo.PulseFreq));
                            }
                        }
                        //VaNaTiC<-
                    }
                    else
                    {
                        player.Out.SendMessage("You decline to be resurrected.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                        //refund mana
                        m_caster.Mana += PowerCost(player);
                    }
                }
            }
            player.TempProperties.removeProperty(RESURRECT_CASTER_PROPERTY);
        }
示例#6
0
        private void OnAttack(DOLEvent e, object sender, EventArgs arguments)
        {
            GameLiving living = sender as GameLiving;

            if (living == null)
            {
                return;
            }
            AttackedByEnemyEventArgs attackedByEnemy = arguments as AttackedByEnemyEventArgs;
            AttackData ad = null;

            if (attackedByEnemy != null)
            {
                ad = attackedByEnemy.AttackData;
            }
            if ((int)ad.DamageType >= 10 && (int)ad.DamageType <= 15)
            {
                if (ad.Attacker is GamePlayer)
                {
                    (ad.Attacker as GamePlayer).Out.SendMessage("Your target' Ereine Proc absorb " + (ad.Damage + ad.CriticalDamage) + " damages", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
                }
                if (ad.Target is GamePlayer)
                {
                    (ad.Target as GamePlayer).Out.SendMessage("Your Ereine Proc absorb " + (ad.Damage + ad.CriticalDamage) + " damages", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
                }
                ad.Damage = 0; ad.CriticalDamage = 0;
                GameSpellEffect effect = SpellHandler.FindEffectOnTarget(living, this);
                if (effect != null)
                {
                    effect.Cancel(false);
                }
            }
        }
        private void OnAttack(DOLEvent e, object sender, EventArgs arguments)
        {
            GameLiving living = sender as GameLiving;

            if (living == null)
            {
                return;
            }
            AttackedByEnemyEventArgs attackedByEnemy = arguments as AttackedByEnemyEventArgs;
            AttackData ad = null;

            if (attackedByEnemy != null)
            {
                ad = attackedByEnemy.AttackData;
            }

//         Log.DebugFormat("sender:{0} res:{1} IsMelee:{2} Type:{3}", living.Name, ad.AttackResult, ad.IsMeleeAttack, ad.AttackType);

            int    damagereduction = living.TempProperties.getProperty <int>(Damage_Reduction);
            double absorbPercent   = Spell.Damage;
            int    damageAbsorbed  = (int)(0.01 * absorbPercent * (ad.Damage + ad.CriticalDamage));

            if (damageAbsorbed > damagereduction)
            {
                damageAbsorbed = damagereduction;
            }
            damagereduction -= damageAbsorbed;
            ad.Damage       -= damageAbsorbed;
            OnDamageAbsorbed(ad, damageAbsorbed);

            //TODO correct messages
            if (ad.Damage > 0)
            {
                MessageToLiving(ad.Target, string.Format("The damage reduction absorbs {0} damage!", damageAbsorbed), eChatType.CT_Spell);
            }
            MessageToLiving(ad.Attacker, string.Format("A damage reduction absorbs {0} damage of your attack!", damageAbsorbed), eChatType.CT_Spell);
            if (damageAbsorbed > 0)
            {
                MessageToCaster("The barrier returns " + damageAbsorbed + " mana back to you.", eChatType.CT_Spell);
            }
            Caster.Mana = Caster.Mana + damageAbsorbed;
            if (Caster.Mana == Caster.MaxMana)
            {
                MessageToCaster("You cannot absorb any more power.", eChatType.CT_SpellResisted);
            }

            if (damagereduction <= 0)
            {
                GameSpellEffect effect = SpellHandler.FindEffectOnTarget(living, this);
                if (effect != null)
                {
                    effect.Cancel(false);
                }
            }
            else
            {
                living.TempProperties.setProperty(Damage_Reduction, damagereduction);
            }
        }
        /// <summary>
        /// execute non duration spell effect on target
        /// </summary>
        /// <param name="target"></param>
        /// <param name="effectiveness"></param>
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            base.OnDirectEffect(target, effectiveness);
            if (target == null || !target.IsAlive)
            {
                return;
            }

            if (Caster.EffectList.GetOfType <MasteryofConcentrationEffect>() != null)
            {
                return;
            }

            //have to do it here because OnAttackedByEnemy is not called to not get aggro
            if (target.Realm == 0 || Caster.Realm == 0)
            {
                target.LastAttackedByEnemyTickPvE = target.CurrentRegion.Time;
            }
            else
            {
                target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time;
            }
            SendEffectAnimation(target, 0, false, 1);

            if (target is GamePlayer)
            {
                ((GamePlayer)target).NextCombatStyle       = null;
                ((GamePlayer)target).NextCombatBackupStyle = null;
            }
            target.StopCurrentSpellcast();             //stop even if MoC or QC

            if (target is GamePlayer)
            {
                MessageToLiving(target, LanguageMgr.GetTranslation((target as GamePlayer).Client, "Amnesia.MessageToTarget"), eChatType.CT_Spell);
            }

            GameSpellEffect effect;

            effect = SpellHandler.FindEffectOnTarget(target, "Mesmerize");
            if (effect != null)
            {
                effect.Cancel(false);
                return;
            }

            if (target is GameNPC)
            {
                GameNPC             npc        = (GameNPC)target;
                IOldAggressiveBrain aggroBrain = npc.Brain as IOldAggressiveBrain;
                if (aggroBrain != null)
                {
                    if (Util.Chance(Spell.AmnesiaChance))
                    {
                        aggroBrain.ClearAggroList();
                    }
                }
            }
        }
示例#9
0
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            GameSpellEffect mezz = SpellHandler.FindEffectOnTarget(target, "Mesmerize");

            if (mezz != null)
            {
                mezz.Cancel(false);
            }
            base.ApplyEffectOnTarget(target, effectiveness);
        }
示例#10
0
        public override int CalculateSpellResistChance(GameLiving target)
        {
            int             basechance = base.CalculateSpellResistChance(target);
            GameSpellEffect rampage    = SpellHandler.FindEffectOnTarget(target, "Rampage");

            if (rampage != null)
            {
                basechance += (int)rampage.Spell.Value;
            }
            return(Math.Min(100, basechance));
        }
示例#11
0
        /// <summary>
        /// Returns the best target to attack
        /// </summary>
        /// <returns>the best target</returns>
        protected override GameLiving CalculateNextAttackTarget()
        {
            if (AggressionState == eAggressionState.Passive)
            {
                return(null);
            }

            if (m_orderAttackTarget != null)
            {
                if (m_orderAttackTarget.IsAlive &&
                    m_orderAttackTarget.ObjectState == GameObject.eObjectState.Active &&
                    GameServer.ServerRules.IsAllowedToAttack(this.Body, m_orderAttackTarget, true))
                {
                    return(m_orderAttackTarget);
                }

                m_orderAttackTarget = null;
            }

            lock ((m_aggroTable as ICollection).SyncRoot)
            {
                IDictionaryEnumerator aggros    = m_aggroTable.GetEnumerator();
                List <GameLiving>     removable = new List <GameLiving>();
                while (aggros.MoveNext())
                {
                    GameLiving living = (GameLiving)aggros.Key;

                    if (living.IsMezzed ||
                        living.IsAlive == false ||
                        living.ObjectState != GameObject.eObjectState.Active ||
                        Body.GetDistanceTo(living, 0) > MAX_AGGRO_LIST_DISTANCE ||
                        GameServer.ServerRules.IsAllowedToAttack(this.Body, living, true) == false)
                    {
                        removable.Add(living);
                    }
                    else
                    {
                        GameSpellEffect root = SpellHandler.FindEffectOnTarget(living, "SpeedDecrease");
                        if (root != null && root.Spell.Value == 99)
                        {
                            removable.Add(living);
                        }
                    }
                }

                foreach (GameLiving living in removable)
                {
                    RemoveFromAggroList(living);
                    Body.RemoveAttacker(living);
                }
            }

            return(base.CalculateNextAttackTarget());
        }
示例#12
0
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            GameSpellEffect effect2 = SpellHandler.FindEffectOnTarget(target, "Mesmerize");

            if (effect2 != null)
            {
                effect2.Cancel(false);
                return;
            }
            base.ApplyEffectOnTarget(target, effectiveness);
        }
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            base.OnDirectEffect(target, effectiveness);
            GameSpellEffect effect;

            effect = SpellHandler.FindEffectOnTarget(target, "Mesmerize");
            if (effect != null)
            {
                effect.Cancel(false);
                return;
            }
        }
示例#14
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)
        {
            GameSpellEffect effect;

            effect = SpellHandler.FindEffectOnTarget(target, "Silence");
            if (effect != null)
            {
                MessageToCaster("Your target already have an effect of that type!", eChatType.CT_SpellResisted);
                return;
            }
            base.ApplyEffectOnTarget(target, effectiveness);
        }
        /// <summary>
        /// Handles attacks on player/by player
        /// </summary>
        /// <param name="e"></param>
        /// <param name="sender"></param>
        /// <param name="arguments"></param>
        private void OnAttack(DOLEvent e, object sender, EventArgs arguments)
        {
            GameLiving living = sender as GameLiving;

            if (living == null)
            {
                return;
            }
            AttackedByEnemyEventArgs attackedByEnemy = arguments as AttackedByEnemyEventArgs;
            AttackFinishedEventArgs  attackFinished  = arguments as AttackFinishedEventArgs;
            CastingEventArgs         castFinished    = arguments as CastingEventArgs;
            AttackData    ad = null;
            ISpellHandler sp = null;

            if (attackedByEnemy != null)
            {
                ad = attackedByEnemy.AttackData;
            }
            else if (attackFinished != null)
            {
                ad = attackFinished.AttackData;
            }
            else if (castFinished != null)
            {
                sp = castFinished.SpellHandler;
                ad = castFinished.LastAttackData;
            }

            // Speed should drop if the player casts an offensive spell
            if (sp == null && ad == null)
            {
                return;
            }
            else if (sp == null && (ad.AttackResult != GameLiving.eAttackResult.HitStyle && ad.AttackResult != GameLiving.eAttackResult.HitUnstyled))
            {
                return;
            }
            else if (sp != null && (sp.HasPositiveEffect || ad == null))
            {
                return;
            }

            GameSpellEffect speed = SpellHandler.FindEffectOnTarget(living, this);

            if (speed != null)
            {
                speed.Cancel(false);
            }
        }
示例#16
0
        /// <summary>
        /// When an applied effect starts
        /// duration spells only
        /// </summary>
        /// <param name="effect"></param>
        public override void OnEffectStart(GameSpellEffect effect)
        {
            GameSpellEffect mezz = SpellHandler.FindEffectOnTarget(effect.Owner, "Mesmerize");

            if (mezz != null)
            {
                mezz.Cancel(false);
            }
            // percent category
            effect.Owner.DebuffCategory[(int)eProperty.ArcheryRange] += (int)Spell.Value;
            effect.Owner.DebuffCategory[(int)eProperty.SpellRange]   += (int)Spell.Value;
            SendEffectAnimation(effect.Owner, 0, false, 1);
            MessageToLiving(effect.Owner, Spell.Message1, eChatType.CT_Spell);
            Message.SystemToArea(effect.Owner, Util.MakeSentence(Spell.Message2, effect.Owner.GetName(0, false)), eChatType.CT_Spell, effect.Owner);
        }
        public void EventRaised(DOLEvent e, object sender, EventArgs arguments)
        {
            GamePlayer player = sender as GamePlayer;             //attacker

            if (player == null)
            {
                return;
            }
            player.Model = m_model;
            GameSpellEffect effect = SpellHandler.FindEffectOnTarget(player, "SummonMonster");

            if (effect != null)
            {
                effect.Cancel(false);
            }
        }
        public override int CalcValue(GameLiving living, eProperty property)
        {
            int debuff = living.DebuffCategory[(int)property];

            if (debuff > 0)
            {
                GameSpellEffect nsreduction = SpellHandler.FindEffectOnTarget(living, "NearsightReduction");
                if (nsreduction != null)
                {
                    debuff *= (int)(1.00 - nsreduction.Spell.Value * 0.01);
                }
            }
            int buff = CalcValueFromBuffs(living, property);
            int item = CalcValueFromItems(living, property);

            return(Math.Max(0, 100 + (buff + item) - debuff));
        }
示例#19
0
        public override int CalculateSpellResistChance(GameLiving target)
        {
            int             resistvalue = 0;
            int             resist      = 0;
            GameSpellEffect fury        = SpellHandler.FindEffectOnTarget(target, "Fury");

            if (fury != null)
            {
                resist += (int)fury.Spell.Value;
            }

            //bonedancer rr5
            if (target.EffectList.GetOfType <AllureofDeathEffect>() != null)
            {
                return(AllureofDeathEffect.ccchance);
            }

            if (m_spellLine.KeyName == GlobalSpellsLines.Combat_Styles_Effect)
            {
                return(0);
            }
            if (HasPositiveEffect)
            {
                return(0);
            }

            int hitchance = CalculateToHitChance(target);

            //Calculate the Resistchance
            resistvalue = (100 - hitchance + resist);
            if (resistvalue > 100)
            {
                resistvalue = 100;
            }
            //use ResurrectHealth=1 if the CC should not be resisted
            if (Spell.ResurrectHealth == 1)
            {
                resistvalue = 0;
            }
            //always 1% resistchance!
            else if (resistvalue < 1)
            {
                resistvalue = 1;
            }
            return(resistvalue);
        }
示例#20
0
        /// <summary>
        /// When an applied effect starts
        /// duration spells only
        /// </summary>
        /// <param name="effect"></param>
        public override void OnEffectStart(GameSpellEffect effect)
        {
            // Cannot apply if the effect owner has a charging effect
            if (effect.Owner.EffectList.GetOfType <ChargeEffect>() != null || effect.Owner.TempProperties.getProperty("Charging", false))
            {
                MessageToCaster(effect.Owner.Name + " is moving too fast for this spell to have any effect!", eChatType.CT_SpellResisted);
                return;
            }
            base.OnEffectStart(effect);
            GameEventMgr.AddHandler(effect.Owner, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(OnAttacked));
            // Cancels mezz on the effect owner, if applied
            GameSpellEffect mezz = SpellHandler.FindEffectOnTarget(effect.Owner, "Mesmerize");

            if (mezz != null)
            {
                mezz.Cancel(false);
            }
        }
        /// <summary>
        /// Handles attacks on player/by player
        /// </summary>
        /// <param name="e"></param>
        /// <param name="sender"></param>
        /// <param name="arguments"></param>
        private void OnMove(DOLEvent e, object sender, EventArgs arguments)
        {
            GameLiving living = sender as GameLiving;

            if (living == null)
            {
                return;
            }
            if (living.IsMoving)
            {
                // remove speed buff if in combat
                GameSpellEffect effect = SpellHandler.FindEffectOnTarget(living, this);
                if (effect != null)
                {
                    effect.Cancel(false);
                    ((GamePlayer)living).Out.SendMessage("You move and break your modification spell.", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                }
            }
        }
        /// <summary>
        /// execute non duration spell effect on target
        /// </summary>
        /// <param name="target"></param>
        /// <param name="effectiveness"></param>
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            base.OnDirectEffect(target, effectiveness);
            if (target == null || !target.IsAlive)
            {
                return;
            }

            // RR4: we remove all the effects
            foreach (string toRemove in SpellTypesToRemove)
            {
                GameSpellEffect effect = SpellHandler.FindEffectOnTarget(target, toRemove);
                if (effect != null)
                {
                    effect.Cancel(false);
                }
            }
            SendEffectAnimation(target, 0, false, 1);
        }
示例#23
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);
        }
示例#24
0
        /// <summary>
        /// When an applied effect starts
        /// duration spells only
        /// </summary>
        /// <param name="effect"></param>
        public override void OnEffectStart(GameSpellEffect effect)
        {
            base.OnEffectStart(effect);

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

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

            if (mezz != null)
            {
                mezz.Cancel(false);
            }
            effect.Owner.Disease(true);
            effect.Owner.BuffBonusMultCategory1.Set((int)eProperty.MaxSpeed, this, 1.0 - 0.15);
            effect.Owner.BuffBonusMultCategory1.Set((int)eProperty.Strength, this, 1.0 - 0.075);

            SendUpdates(effect);

            MessageToLiving(effect.Owner, Spell.Message1, eChatType.CT_Spell);
            Message.SystemToArea(effect.Owner, Util.MakeSentence(Spell.Message2, effect.Owner.GetName(0, true)), eChatType.CT_System, effect.Owner);

            effect.Owner.StartInterruptTimer(effect.Owner.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            if (effect.Owner is GameNPC)
            {
                IOldAggressiveBrain aggroBrain = ((GameNPC)effect.Owner).Brain as IOldAggressiveBrain;
                if (aggroBrain != null)
                {
                    aggroBrain.AddToAggroList(Caster, 1);
                }
            }
        }
示例#25
0
        private void PlayerAction(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = (GamePlayer)sender;

            if (player == null)
            {
                return;
            }
            MessageToLiving((GameLiving)player, "You are moving. Your concentration fades!", eChatType.CT_SpellResisted);
            GameSpellEffect effect = SpellHandler.FindEffectOnTarget(m_target, "Loockout");

            if (effect != null)
            {
                effect.Cancel(false);
            }
            IGameEffect effect2 = SpellHandler.FindStaticEffectOnTarget(Caster, typeof(LoockoutOwner));

            if (effect2 != null)
            {
                effect2.Cancel(false);
            }
            OnEffectExpires(effect, true);
        }
示例#26
0
        protected void StopRelicEffect()
        {
            if (RelicSpell == null || m_spellHandler == null || m_gameSpellEffect == null)
            {
                return;
            }

            lock (Playerlist)
            {
                foreach (GamePlayer plr in Playerlist)
                {
                    if (plr == null)
                    {
                        continue;
                    }
                    try
                    {
                        lock (plr.EffectList)
                        {
                            GameSpellEffect check = SpellHandler.FindEffectOnTarget(plr, m_gameSpellEffect.Spell.SpellType);
                            if (check != null)
                            {
                                check.Cancel(false);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        if (log.IsErrorEnabled)
                        {
                            log.Error("Minotaur Relics : Stop Relic Effect : " + e);
                        }
                    }
                }
                Playerlist.Clear();
            }
        }
示例#27
0
        public override AttackData CalculateDamageToTarget(GameLiving target, double effectiveness)
        {
            AttackData ad = base.CalculateDamageToTarget(target, effectiveness);

            if (this.SpellLine.KeyName == GlobalSpellsLines.Mundane_Poisons)
            {
                RealmAbilities.L3RAPropertyEnhancer ra = Caster.GetAbility <RealmAbilities.ViperAbility>();
                if (ra != null)
                {
                    int additional = (int)((float)ad.Damage * ((float)ra.Amount / 100));
                    ad.Damage += additional;
                }
            }

            GameSpellEffect iWarLordEffect = SpellHandler.FindEffectOnTarget(target, "CleansingAura");

            if (iWarLordEffect != null)
            {
                ad.Damage *= (int)(1.00 - (iWarLordEffect.Spell.Value * 0.01));
            }

            //ad.CriticalDamage = 0; - DoTs can crit.
            return(ad);
        }
示例#28
0
        private void StopRelicEffect()
        {
            if (RelicSpell == null || _spellHandler == null || _gameSpellEffect == null)
            {
                return;
            }

            lock (Playerlist)
            {
                foreach (GamePlayer plr in Playerlist)
                {
                    if (plr == null)
                    {
                        continue;
                    }

                    try
                    {
                        lock (plr.EffectList)
                        {
                            GameSpellEffect check = SpellHandler.FindEffectOnTarget(plr, _gameSpellEffect.Spell.SpellType);
                            check?.Cancel(false);
                        }
                    }
                    catch (Exception e)
                    {
                        if (Log.IsErrorEnabled)
                        {
                            Log.Error($"Minotaur Relics : Stop Relic Effect : {e}");
                        }
                    }
                }

                Playerlist.Clear();
            }
        }
示例#29
0
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active)
            {
                return;
            }

            GamePlayer player = target as GamePlayer;

            if (target is GamePlayer)
            {
                int mana;
                int health;
                int end;

                int value = (int)Spell.Value;
                mana   = (player.Mana * value) / 100;
                end    = (player.Endurance * value) / 100;
                health = (player.Health * value) / 100;

                //You don't gain RPs from this Spell
                if (player.Health < health)
                {
                    player.Health = 1;
                }
                else
                {
                    player.Health -= health;
                }

                if (player.Mana < mana)
                {
                    player.Mana = 1;
                }
                else
                {
                    player.Mana -= mana;
                }

                if (player.Endurance < end)
                {
                    player.Endurance = 1;
                }
                else
                {
                    player.Endurance -= end;
                }

                GameSpellEffect effect2 = SpellHandler.FindEffectOnTarget(target, "Mesmerize");
                if (effect2 != null)
                {
                    effect2.Cancel(true);
                    return;
                }
                foreach (GamePlayer ply in player.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    SendEffectAnimation(player, 0, false, 1);
                }
                player.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            }
        }
示例#30
0
		public override bool CheckBeginCast(GameLiving selectedTarget)
		{
			if (m_caster.ObjectState != GameLiving.eObjectState.Active)	return false;
			if (!m_caster.IsAlive)
			{
				MessageToCaster("You are dead and can't cast!", eChatType.CT_System);
				return false;
			}
			
			// Is PS ?
			GameSpellEffect Phaseshift = SpellHandler.FindEffectOnTarget(Caster, "Phaseshift");
			if (Phaseshift != null && (Spell.InstrumentRequirement == 0 || Spell.SpellType == "Mesmerize"))
			{
				MessageToCaster("You're phaseshifted and can't cast a spell", eChatType.CT_System);
				return false;
			}

			// Is Shield Disarm ?
			ShieldTripDisarmEffect shieldDisarm = Caster.EffectList.GetOfType<ShieldTripDisarmEffect>();
			if (shieldDisarm != null)
			{
				MessageToCaster("You're disarmed and can't cast a spell", eChatType.CT_System);
				return false;
			}

			// Is Mentalist RA5L ?
			SelectiveBlindnessEffect SelectiveBlindness = Caster.EffectList.GetOfType<SelectiveBlindnessEffect>();
			if (SelectiveBlindness != null)
			{
				GameLiving EffectOwner = SelectiveBlindness.EffectSource;
				if(EffectOwner==selectedTarget)
				{
					if (m_caster is GamePlayer)
						((GamePlayer)m_caster).Out.SendMessage(string.Format("{0} is invisible to you!", selectedTarget.GetName(0, true)), eChatType.CT_Missed, eChatLoc.CL_SystemWindow);
					
					return false;
				}
			}
			
			// Is immune ?
			if (selectedTarget!=null&&selectedTarget.HasAbility("DamageImmunity"))
			{
				MessageToCaster(selectedTarget.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
				return false;
			}
			
			if (m_caster.IsSitting)
			{
				MessageToCaster("You can't cast while sitting!", eChatType.CT_SpellResisted);
				return false;
			}
			if (m_spell.RecastDelay > 0)
			{
				int left = m_caster.GetSkillDisabledDuration(m_spell);
				if (left > 0)
				{
					MessageToCaster("You must wait " + (left / 1000 + 1).ToString() + " seconds to use this spell!", eChatType.CT_System);
					return false;
				}
			}
			String targetType = m_spell.Target.ToLower();
			if (targetType == "area")
			{
				if (!m_caster.IsWithinRadius(m_caster.GroundTarget, CalculateSpellRange()))
				{
					MessageToCaster("Your area target is out of range.  Select a closer target.", eChatType.CT_SpellResisted);
					return false;
				}
			}

			if (targetType == "enemy")
			{
				if (m_caster.IsObjectInFront(selectedTarget, 180) == false)
				{
					MessageToCaster("Your target is not in view!", eChatType.CT_SpellResisted);
					Caster.Notify(GameLivingEvent.CastFailed, new CastFailedEventArgs(this, CastFailedEventArgs.Reasons.TargetNotInView));
					return false;
				}

				if (m_caster.TargetInView == false)
				{
					MessageToCaster("Your target is not visible!", eChatType.CT_SpellResisted);
					Caster.Notify(GameLivingEvent.CastFailed, new CastFailedEventArgs(this, CastFailedEventArgs.Reasons.TargetNotInView));
					return false;
				}
			}
			
			if (Caster != null && Caster is GamePlayer && Caster.AttackWeapon != null && GlobalConstants.IsBowWeapon((eObjectType)Caster.AttackWeapon.Object_Type))
			{
				if (Spell.LifeDrainReturn == (int)eShotType.Critical && (!(Caster.IsStealthed)))
				{
					MessageToCaster("You must be stealthed and wielding a bow to use this ability!", eChatType.CT_SpellResisted);
					return false;
				}

				return true;
			}
			else
			{
				if (Spell.LifeDrainReturn == (int)eShotType.Critical)
				{
					MessageToCaster("You must be stealthed and wielding a bow to use this ability!", eChatType.CT_SpellResisted);
					return false;
				}

				MessageToCaster("You must be wielding a bow to use this ability!", eChatType.CT_SpellResisted);
				return false;
			}
		}