示例#1
0
        protected virtual int PulseTimer(RegionTimer timer)
        {
            if (currentTick >= m_lifeTime || m_caster == null)
            {
                this.RemoveFromWorld();
                timer.Stop();
                timer = null;
                return 0;
            }
            if (currentTick % m_pulseFrequency == 0)
            {
                currentPulse++;
                foreach (GamePlayer target in this.GetPlayersInRadius(m_radius))
                {
                    CastSpell(target);
                }
                foreach (GameNPC npc in this.GetNPCsInRadius(m_radius))
                {
                    CastSpell(npc);
                }
            }

            currentTick++;
            return 1000;
        }
 /// <summary>
 /// Stops the timers for this effect
 /// </summary>
 protected virtual void StopTimers()
 {
     if (_expireTimer != null)
     {
         // DOLConsole.WriteLine("effect stop expire on "+Owner.Name+" "+this.InternalID);
         _expireTimer.Stop();
         _expireTimer = null;
     }
 }
示例#3
0
        public override void Stop()
        {
            if (_tickTimer.IsAlive)
            {
                _tickTimer.Stop();
            }

            base.Stop();
        }
        protected virtual int EndCast(RegionTimer timer)
        {
            if (m_caster.TargetObject == null)
            {
                m_caster.Out.SendMessage("You need a target for this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                m_caster.DisableSkill(this, 3 * 1000);
                return(0);
            }

            if (!m_caster.IsWithinRadius(m_caster.TargetObject, (int)(1500 * m_caster.GetModified(eProperty.SpellRange) * 0.01)))
            {
                m_caster.Out.SendMessage(m_caster.TargetObject + " is too far away.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                return(0);
            }

            foreach (GamePlayer player in m_caster.TargetObject.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                player.Out.SendSpellEffectAnimation(m_caster, (m_caster.TargetObject as GameLiving), 7025, 0, false, 1);
            }

            foreach (GameNPC mob in m_caster.TargetObject.GetNPCsInRadius(500))
            {
                if (!GameServer.ServerRules.IsAllowedToAttack(m_caster, mob, true))
                {
                    continue;
                }

                mob.TakeDamage(m_caster, eDamageType.Heat, m_dmgValue, 0);
                m_caster.Out.SendMessage("You hit the " + mob.Name + " for " + m_dmgValue + " damage.", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
                foreach (GamePlayer player2 in m_caster.TargetObject.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    player2.Out.SendSpellEffectAnimation(m_caster, mob, 7025, 0, false, 1);
                }
            }

            foreach (GamePlayer aeplayer in m_caster.TargetObject.GetPlayersInRadius(500))
            {
                if (!GameServer.ServerRules.IsAllowedToAttack(m_caster, aeplayer, true))
                {
                    continue;
                }

                aeplayer.TakeDamage(m_caster, eDamageType.Heat, m_dmgValue, 0);
                m_caster.Out.SendMessage("You hit " + aeplayer.Name + " for " + m_dmgValue + " damage.", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
                aeplayer.Out.SendMessage(m_caster.Name + " hits you for " + m_dmgValue + " damage.", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow);
                foreach (GamePlayer player3 in m_caster.TargetObject.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    player3.Out.SendSpellEffectAnimation(m_caster, aeplayer, 7025, 0, false, 1);
                }
            }

            DisableSkill(m_caster);
            timer.Stop();
            timer = null;
            return(0);
        }
示例#5
0
 /// <summary>
 /// Stops the effect
 /// </summary>
 public override void Stop()
 {
     base.Stop();
     Owner.EffectList.Remove(this);
     if (_countDownTimer != null)
     {
         _countDownTimer.Stop();
         _countDownTimer = null;
     }
 }
示例#6
0
        protected virtual int RootExpires(RegionTimer timer)
        {
            if (timer.Owner is GameLiving living)
            {
                living.BuffBonusMultCategory1.Remove((int)eProperty.MaxSpeed, this);
                SendUpdates(living);
            }

            timer.Stop();
            return(0);
        }
示例#7
0
        public int ShowEffect(RegionTimer timer)
        {
            foreach (GamePlayer vplayer in this.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                vplayer.Out.SendSpellEffectAnimation(this, tplayer, spell, 0, false, 1);      //vergessen,GameObject,SpellID,vergessen,vergessen,vergessen
            }
            RegionTimer timer2 = new RegionTimer(tplayer, new RegionTimerCallback(Teleport), 2000);

            timer.Stop();
            timer = null;
            return(0);
        }
示例#8
0
 /// <summary>
 /// Stop the timed effect on owner
 /// </summary>
 public override void Stop()
 {
     lock (m_LockObject)
     {
         if (m_expireTimer != null)
         {
             m_expireTimer.Stop();
             m_expireTimer = null;
         }
         base.Stop();
     }
 }
        public override void Stop()
        {
            base.Stop();
            GamePlayer player = Owner as GamePlayer;

            player.Out.SendUpdateMaxSpeed();
            if (m_countDownTimer != null)
            {
                m_countDownTimer.Stop();
                m_countDownTimer = null;
            }
        }
示例#10
0
        public override void Stop()
        {
            if (pulseTimer != null)
            {
                pulseTimer.Stop(); pulseTimer = null;
            }
            if (EffectOwner != null)
            {
                GameEventMgr.RemoveHandler(EffectOwner, GamePlayerEvent.Quit, new DOLEventHandler(PlayerLeftWorld));
            }

            base.Stop();
        }
示例#11
0
文件: ABrain.cs 项目: mywebext/DOL
 /// <summary>
 /// Stops the brain thinking
 /// </summary>
 /// <returns>true if stopped</returns>
 public virtual bool Stop()
 {
     lock (m_LockObject)
     {
         if (!IsActive)
         {
             return(false);
         }
         m_brainTimer.Stop();
         m_brainTimer = null;
     }
     return(true);
 }
示例#12
0
 protected virtual int EndCast(RegionTimer timer)
 {
     if (m_player.IsMezzed || m_player.IsStunned || m_player.IsSitting)
     {
         return(0);
     }
     Statics.ThornweedFieldBase twf = new Statics.ThornweedFieldBase(m_dmgValue);
     twf.CreateStatic(m_player, m_player.GroundTarget.Value, m_duration, 3, 500);
     DisableSkill(m_player);
     timer.Stop();
     timer = null;
     return(0);
 }
示例#13
0
 public int ShowEffect(RegionTimer timer)
 {
     foreach (GamePlayer player in this.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
     {
         player.Out.SendSpellEffectAnimation(this, this, 4321, 0, false, 1);
     }
     foreach (GamePlayer player in this.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
     {
         player.Out.SendMessage("My job is to find any hackers! (0) hackers in the last 20 seconds.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
     }
     timer.Stop();
     timer = null;
     return(0);
 }
示例#14
0
        public override void Stop()
        {
            base.Stop();
            if (Owner is GamePlayer player)
            {
                player.Out.SendUpdateMaxSpeed();
            }

            if (_mCountDownTimer != null)
            {
                _mCountDownTimer.Stop();
                _mCountDownTimer = null;
            }
        }
示例#15
0
        // Make titan growing, and activate it on completition
        private int TitanGrows(RegionTimer timer)
        {
            if (summoned != null && summoned.Size != 60)
            {
                summoned.Size += 10;
                return(C_GROWTIMER);
            }

            summoned.Flags = 0;
            m_growTimer.Stop();
            m_growTimer = null;

            return(0);
        }
示例#16
0
 private int CauldronCallBack(RegionTimer timer)
 {
     if (Cauldron != null && EffectOwner != null)
     {
         foreach (GamePlayer target in Cauldron.GetPlayersInRadius(spellRadius))
         {
             if (GameServer.ServerRules.IsAllowedToAttack(EffectOwner, target, true))
             {
                 target.TakeDamage(EffectOwner, eDamageType.Heat, spellDamage, 0);
             }
         }
     }
     timer.Stop();
     timer = null;
     return(0);
 }
示例#17
0
 public int ShowEffect(RegionTimer timer)
 {
     if (base.IsAlive)
     {
         foreach (GamePlayer player in this.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
         {
             player.Out.SendSpellEffectAnimation(this, this, 4321, 0, false, 1);
         }
         foreach (GamePlayer player in this.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
         {
             player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GuardCaster.SkinsHardens", this.Name), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
         }
     }
     timer.Stop();
     timer = null;
     return(0);
 }
示例#18
0
 public int ShowEffect(RegionTimer timer)
 {
     if (base.IsAlive)
     {
         foreach (GamePlayer player in this.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
         {
             player.Out.SendSpellEffectAnimation(this, this, 4321, 0, false, 1);
         }
         foreach (GamePlayer player in this.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
         {
             player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "GuardCaster.SkinsHardens", this.Name), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
         }
     }
     timer.Stop();
     timer = null;
     return 0;
 }
 protected virtual int EndCast(RegionTimer timer)
 {
     bool castWasSuccess = player.TempProperties.getProperty(NM_CAST_SUCCESS, false);
     player.TempProperties.removeProperty(IS_CASTING);
     GameEventMgr.RemoveHandler(player, GamePlayerEvent.Moving, new DOLEventHandler(CastInterrupted));
     GameEventMgr.RemoveHandler(player, GamePlayerEvent.AttackFinished, new DOLEventHandler(CastInterrupted));
     GameEventMgr.RemoveHandler(player, GamePlayerEvent.Dying, new DOLEventHandler(CastInterrupted));
     if (player.IsMezzed || player.IsStunned || player.IsSitting)
         return 0;
     if (!castWasSuccess)
         return 0;
     Statics.NegativeMaelstromBase nm = new Statics.NegativeMaelstromBase(dmgValue);
     nm.CreateStatic(player, player.GroundTarget, duration, 5, 350);
     DisableSkill(player);
     timer.Stop();
     timer = null;
     return 0;
 }
示例#20
0
        public override bool RemoveFromWorld()
        {
            // remove teleporters
            foreach (GameNPC tp in m_teleporters)
            {
                GameNPC teleporter = tp;
                teleporter.RemoveFromWorld();
            }

            m_teleporters.Clear();

            // remove pad
            m_worldObject.RemoveFromWorld();

            // Stop Timer !
            m_teleportTimer.Stop();
            m_teleportTimer = null;

            return(base.RemoveFromWorld());
        }
示例#21
0
 protected virtual int PulseTimer(RegionTimer timer)
 {
     if (EffectOwner == null || pet == null || pbaoe == null)
     {
         timer.Stop();
         timer = null;
         return(0);
     }
     if (currentTick % spellFrequency == 0)
     {
         foreach (GamePlayer target in pet.GetPlayersInRadius(spellRadius))
         {
             pbaoe.StartSpell(target);
         }
         foreach (GameNPC npc in pet.GetNPCsInRadius(spellRadius))
         {
             pbaoe.StartSpell(npc);
         }
     }
     currentTick++;
     return(1000);
 }
        public override void Stop()
        {
            base.Stop();

            if (owner != null)
            {
                for (eProperty property = eProperty.Stat_First; property <= eProperty.Stat_Last; property++)
                {
                    if (m_debuffs.ContainsKey(property))
                    {
                        owner.DebuffCategory[(int)property] -= m_debuffs[property];
                    }
                }
                owner.Out.SendCharStatsUpdate();
            }

            if (m_timer != null)
            {
                m_timer.Stop();
                m_timer = null;
            }
        }
        protected virtual int EndCast(RegionTimer timer)
        {
            bool castWasSuccess = player.TempProperties.getProperty(NM_CAST_SUCCESS, false);

            player.TempProperties.removeProperty(IS_CASTING);
            GameEventMgr.RemoveHandler(player, GamePlayerEvent.Moving, new DOLEventHandler(CastInterrupted));
            GameEventMgr.RemoveHandler(player, GamePlayerEvent.AttackFinished, new DOLEventHandler(CastInterrupted));
            GameEventMgr.RemoveHandler(player, GamePlayerEvent.Dying, new DOLEventHandler(CastInterrupted));
            if (player.IsMezzed || player.IsStunned || player.IsSitting)
            {
                return(0);
            }
            if (!castWasSuccess)
            {
                return(0);
            }
            Statics.NegativeMaelstromBase nm = new Statics.NegativeMaelstromBase(dmgValue);
            nm.CreateStatic(player, player.GroundTarget.Value, duration, 5, 350);
            DisableSkill(player);
            timer.Stop();
            timer = null;
            return(0);
        }
示例#24
0
        protected virtual int EndCast(RegionTimer timer)
        {
            bool castWasSuccess = _player.TempProperties.getProperty(NmCastSuccess, false);

            _player.TempProperties.removeProperty(IsCasting);
            GameEventMgr.RemoveHandler(_player, GameLivingEvent.Moving, new DOLEventHandler(CastInterrupted));
            GameEventMgr.RemoveHandler(_player, GameLivingEvent.AttackFinished, new DOLEventHandler(CastInterrupted));
            GameEventMgr.RemoveHandler(_player, GameLivingEvent.Dying, new DOLEventHandler(CastInterrupted));
            if (_player.IsMezzed || _player.IsStunned || _player.IsSitting)
            {
                return(0);
            }

            if (!castWasSuccess)
            {
                return(0);
            }

            Statics.NegativeMaelstromBase nm = new Statics.NegativeMaelstromBase(_dmgValue);
            nm.CreateStatic(_player, _player.GroundTarget, _duration, 5, 350);
            DisableSkill(_player);
            timer.Stop();
            return(0);
        }
示例#25
0
		protected virtual int RootExpires(RegionTimer timer)
		{
			GameLiving living = timer.Owner as GameLiving;
			if (living != null)
			{
				living.BuffBonusMultCategory1.Remove((int)eProperty.MaxSpeed, this);
				SendUpdates(living);
			}
			timer.Stop();
			timer = null;
			return 0;
		}
示例#26
0
		protected virtual int EndCast(RegionTimer timer)
		{
			if (caster.TargetObject == null)
			{
				caster.Out.SendMessage("You need a target for this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				caster.DisableSkill(this, 3 * 1000);
				return 0;
			}

			if (caster.IsMoving)
			{
                caster.Out.SendMessage(LanguageMgr.GetTranslation(caster.Client, "SpellHandler.CasterMove"), eChatType.CT_Say, eChatLoc.CL_SystemWindow);
				caster.DisableSkill(this, 3000);
				return 0;
			}

			if ( !caster.IsWithinRadius( caster.TargetObject, 1875 ) )
			{
				caster.Out.SendMessage(caster.TargetObject.Name + " is too far away.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
				caster.DisableSkill(this, 3 * 1000);
				return 0;
			}

			GameLiving living = caster.TargetObject as GameLiving;
			
			if(living==null)
			{
				timer.Stop();
				timer = null;
				return 0;
			}

			if (living.EffectList.GetOfType<ChargeEffect>() == null && living.EffectList.GetOfType<SpeedOfSoundEffect>() != null)
			{
				living.BuffBonusMultCategory1.Set((int)eProperty.MaxSpeed, this, 1.0 - 99 * 0.01);
				m_rootExpire = new RegionTimer(living, new RegionTimerCallback(RootExpires), duration);
				GameEventMgr.AddHandler(living, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(OnAttacked));
				SendUpdates(living);
			}

			foreach (GamePlayer player in living.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
			{
				player.Out.SendSpellEffectAnimation(caster, (caster.TargetObject as GameLiving), 7029, 0, false, 1);
			}

			foreach (GameNPC mob in living.GetNPCsInRadius(500))
			{
				if (!GameServer.ServerRules.IsAllowedToAttack(caster, mob, true))
					continue;

				if (mob.HasAbility(Abilities.CCImmunity) || mob.HasAbility(Abilities.RootImmunity) || mob.HasAbility(Abilities.DamageImmunity))
					continue;
				
				GameSpellEffect mez = SpellHandler.FindEffectOnTarget(mob, "Mesmerize");
				if (mez != null)
					mez.Cancel(false);
				
				mob.TakeDamage(caster, eDamageType.Spirit, dmgValue, 0);

				if (mob.EffectList.GetOfType<ChargeEffect>() == null && mob.EffectList.GetOfType<SpeedOfSoundEffect>() == null)
				{
					mob.BuffBonusMultCategory1.Set((int)eProperty.MaxSpeed, this, 1.0 - 99 * 0.01);
					m_rootExpire = new RegionTimer(mob, new RegionTimerCallback(RootExpires), duration);
					GameEventMgr.AddHandler(mob, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(OnAttacked));
					SendUpdates(mob);
				}

				caster.Out.SendMessage("You hit the " + mob.Name + " for " + dmgValue + " damage.", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);

				foreach (GamePlayer player2 in living.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
				{
					player2.Out.SendSpellEffectAnimation(caster, mob, 7029, 0, false, 1);
				}
			}

			foreach (GamePlayer aeplayer in living.GetPlayersInRadius(500))
			{
				if (!GameServer.ServerRules.IsAllowedToAttack(caster, aeplayer, true))
					continue;

				GameSpellEffect mez = SpellHandler.FindEffectOnTarget(aeplayer, "Mesmerize");
				if (mez != null)
					mez.Cancel(false);
				aeplayer.TakeDamage(caster, eDamageType.Spirit, dmgValue, 0);
				aeplayer.StartInterruptTimer(3000, AttackData.eAttackType.Spell, caster);

				if (aeplayer.EffectList.GetOfType<ChargeEffect>() == null && aeplayer.EffectList.GetOfType<SpeedOfSoundEffect>() == null)
				{
					(aeplayer as GameLiving).BuffBonusMultCategory1.Set((int)eProperty.MaxSpeed, this, 1.0 - 99 * 0.01);
					m_rootExpire = new RegionTimer(aeplayer, new RegionTimerCallback(RootExpires), duration);
					GameEventMgr.AddHandler(aeplayer, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(OnAttacked));
					SendUpdates(aeplayer);
				}

				caster.Out.SendMessage("You hit " + aeplayer.Name + " for " + dmgValue + " damage.", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);

				foreach (GamePlayer player3 in living.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
				{
					player3.Out.SendSpellEffectAnimation(caster, aeplayer, 7029, 0, false, 1);
				}
			}

			DisableSkill(caster);
			timer.Stop();
			timer = null;
			return 0;
		}
 /// <summary>
 /// Stops the deduction timer
 /// </summary>
 public void StopDeductionTimer()
 {
     m_claimTimer.Stop();
 }
示例#28
0
 private int CauldronCallBack(RegionTimer timer)
 {
     if (Cauldron != null && EffectOwner != null)
     {
         foreach (GamePlayer target in Cauldron.GetPlayersInRadius(spellRadius))
         {
             if (GameServer.ServerRules.IsAllowedToAttack(EffectOwner, target, true))
                 target.TakeDamage(EffectOwner, eDamageType.Heat, spellDamage, 0);
         }
     }
     timer.Stop();
     timer = null;
     return 0;
 }
示例#29
0
        private void DamageTarget(GameLiving target)
        {
            if (!GameServer.ServerRules.IsAllowedToAttack(_owner, target, true))
            {
                return;
            }

            if (!target.IsAlive)
            {
                return;
            }

            if (_ticktimer.IsAlive)
            {
                _ticktimer.Stop();
                removeHandlers();
            }

            int    dist = target.GetDistanceTo(new Point3D(_traparea.X, _traparea.Y, _traparea.Z));
            double mod  = 1;

            if (dist > 0)
            {
                mod = 1 - ((double)dist / 350);
            }

            int basedamage = (int)(_effectiveness * mod);
            int resist     = (int)(basedamage * target.GetModified(eProperty.Resist_Energy) * -0.01);
            int damage     = basedamage + resist;

            if (_owner is GamePlayer player)
            {
                player.Out.SendMessage($"You hit {target.Name} for {damage}({resist}) points of damage!", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
            }

            if (target is GamePlayer targetPlayer)
            {
                if (targetPlayer.IsStealthed)
                {
                    targetPlayer.Stealth(false);
                }
            }

            foreach (GamePlayer p in target.GetPlayersInRadius(false, WorldMgr.VISIBILITY_DISTANCE))
            {
                p.Out.SendSpellEffectAnimation(_owner, target, 7026, 0, false, 1);
                p.Out.SendCombatAnimation(_owner, target, 0, 0, 0, 0, 0x14, target.HealthPercent);
            }

            // target.TakeDamage(owner, eDamageType.Energy, damage, 0);
            AttackData ad = new AttackData
            {
                AttackResult = GameLiving.eAttackResult.HitUnstyled,
                Attacker     = _owner,
                Target       = target,
                DamageType   = eDamageType.Energy,
                Damage       = damage
            };

            target.OnAttackedByEnemy(ad);
            _owner.DealDamage(ad);
        }
示例#30
0
        private void DamageTarget(GameLiving target)
        {
            if (!GameServer.ServerRules.IsAllowedToAttack(owner, target, true))
            {
                return;
            }
            if (!target.IsAlive)
            {
                return;
            }
            if (ticktimer.IsAlive)
            {
                ticktimer.Stop();
                removeHandlers();
            }
            var    dist = Vector3.Distance(target.Position, traparea.Position);
            double mod  = 1;

            if (dist > 0)
            {
                mod = 1 - ((double)dist / 350);
            }

            int basedamage = (int)(effectiveness * mod);
            int resist     = (int)(basedamage * target.GetModified(eProperty.Resist_Energy) * -0.01);
            int damage     = basedamage + resist;


            GamePlayer player = owner as GamePlayer;

            if (player != null)
            {
                player.Out.SendMessage("You hit " + target.Name + " for " + damage + "(" + resist + ") points of damage!", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
            }

            GamePlayer targetPlayer = target as GamePlayer;

            if (targetPlayer != null)
            {
                if (targetPlayer.IsStealthed)
                {
                    targetPlayer.Stealth(false);
                }
            }

            foreach (GamePlayer p in target.GetPlayersInRadius(false, WorldMgr.VISIBILITY_DISTANCE))
            {
                p.Out.SendSpellEffectAnimation(owner, target, 7026, 0, false, 1);
                p.Out.SendCombatAnimation(owner, target, 0, 0, 0, 0, 0x14, target.HealthPercent);
            }

            //target.TakeDamage(owner, eDamageType.Energy, damage, 0);
            AttackData ad = new AttackData();

            ad.AttackResult = GameLiving.eAttackResult.HitUnstyled;
            ad.Attacker     = owner;
            ad.Target       = target;
            ad.DamageType   = eDamageType.Energy;
            ad.Damage       = damage;
            target.OnAttackedByEnemy(ad);
            owner.DealDamage(ad);
        }
        // Check distance between spirit and target
        private int spiritCallBack(RegionTimer timer)
        {
            if (timer.Owner == null || !(timer.Owner is GameNPC))
            {
                timer.Stop();
                timer = null;
                return 0;
            }

            GameNPC spirit = timer.Owner as GameNPC;
            GamePlayer targetPlayer = spirit.TargetObject as GamePlayer;

            if (targetPlayer == null || !targetPlayer.IsAlive)
            {
                spirit.StopFollowing();
                timer.Stop();
                timer = null;
                return 0;
            }

            if (targetPlayer.IsWithinRadius(spirit, 100))
            {
                ApplySpiritEffect(spirit, targetPlayer);
                timer.Stop();
                timer = null;
                return 0;
            }

            return 200;
        }
示例#32
0
        protected virtual int EndCast(RegionTimer timer)
        {
            if (_caster.TargetObject == null)
            {
                _caster.Out.SendMessage("You need a target for this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                _caster.DisableSkill(this, 3 * 1000);
                return(0);
            }

            if (_caster.IsMoving)
            {
                _caster.Out.SendMessage(LanguageMgr.GetTranslation(_caster.Client, "SpellHandler.CasterMove"), eChatType.CT_Say, eChatLoc.CL_SystemWindow);
                _caster.DisableSkill(this, 3000);
                return(0);
            }

            if (!_caster.IsWithinRadius(_caster.TargetObject, 1875))
            {
                _caster.Out.SendMessage(_caster.TargetObject.Name + " is too far away.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                _caster.DisableSkill(this, 3 * 1000);
                return(0);
            }

            if (!(_caster.TargetObject is GameLiving living))
            {
                timer.Stop();
                return(0);
            }

            if (living.EffectList.GetOfType <ChargeEffect>() == null && living.EffectList.GetOfType <SpeedOfSoundEffect>() != null)
            {
                living.BuffBonusMultCategory1.Set((int)eProperty.MaxSpeed, this, 1.0 - 99 * 0.01);
                _rootExpire = new RegionTimer(living, new RegionTimerCallback(RootExpires), _duration);
                GameEventMgr.AddHandler(living, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(OnAttacked));
                SendUpdates(living);
            }

            foreach (GamePlayer player in living.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                player.Out.SendSpellEffectAnimation(_caster, (GameLiving)_caster.TargetObject, 7029, 0, false, 1);
            }

            foreach (GameNPC mob in living.GetNPCsInRadius(500))
            {
                if (!GameServer.ServerRules.IsAllowedToAttack(_caster, mob, true))
                {
                    continue;
                }

                if (mob.HasAbility(Abilities.CCImmunity) || mob.HasAbility(Abilities.RootImmunity) || mob.HasAbility(Abilities.DamageImmunity))
                {
                    continue;
                }

                GameSpellEffect mez = SpellHandler.FindEffectOnTarget(mob, "Mesmerize");
                mez?.Cancel(false);

                mob.TakeDamage(_caster, eDamageType.Spirit, _dmgValue, 0);

                if (mob.EffectList.GetOfType <ChargeEffect>() == null && mob.EffectList.GetOfType <SpeedOfSoundEffect>() == null)
                {
                    mob.BuffBonusMultCategory1.Set((int)eProperty.MaxSpeed, this, 1.0 - 99 * 0.01);
                    _rootExpire = new RegionTimer(mob, new RegionTimerCallback(RootExpires), _duration);
                    GameEventMgr.AddHandler(mob, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(OnAttacked));
                    SendUpdates(mob);
                }

                _caster.Out.SendMessage("You hit the " + mob.Name + " for " + _dmgValue + " damage.", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);

                foreach (GamePlayer player2 in living.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    player2.Out.SendSpellEffectAnimation(_caster, mob, 7029, 0, false, 1);
                }
            }

            foreach (GamePlayer aeplayer in living.GetPlayersInRadius(500))
            {
                if (!GameServer.ServerRules.IsAllowedToAttack(_caster, aeplayer, true))
                {
                    continue;
                }

                GameSpellEffect mez = SpellHandler.FindEffectOnTarget(aeplayer, "Mesmerize");
                mez?.Cancel(false);

                aeplayer.TakeDamage(_caster, eDamageType.Spirit, _dmgValue, 0);
                aeplayer.StartInterruptTimer(3000, AttackData.eAttackType.Spell, _caster);

                if (aeplayer.EffectList.GetOfType <ChargeEffect>() == null && aeplayer.EffectList.GetOfType <SpeedOfSoundEffect>() == null)
                {
                    aeplayer.BuffBonusMultCategory1.Set((int)eProperty.MaxSpeed, this, 1.0 - 99 * 0.01);
                    _rootExpire = new RegionTimer(aeplayer, new RegionTimerCallback(RootExpires), _duration);
                    GameEventMgr.AddHandler(aeplayer, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(OnAttacked));
                    SendUpdates(aeplayer);
                }

                _caster.Out.SendMessage($"You hit {aeplayer.Name} for {_dmgValue} damage.", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);

                foreach (GamePlayer player3 in living.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    player3.Out.SendSpellEffectAnimation(_caster, aeplayer, 7029, 0, false, 1);
                }
            }

            DisableSkill(_caster);
            timer.Stop();
            return(0);
        }
示例#33
0
 protected virtual int PulseTimer(RegionTimer timer)
 {
     if (EffectOwner == null || pet == null || pbaoe == null)
     {
         timer.Stop();
         timer = null;
         return 0;
     }
     if (currentTick % spellFrequency == 0)
     {
         foreach (GamePlayer target in pet.GetPlayersInRadius(spellRadius))
         {
             pbaoe.StartSpell(target);
         }
         foreach (GameNPC npc in pet.GetNPCsInRadius(spellRadius))
         {
             pbaoe.StartSpell(npc);
         }
     }
     currentTick++;
     return 1000;
 }
        protected virtual int EndCast(RegionTimer timer)
        {
            if (caster.TargetObject == null)
            {
                caster.Out.SendMessage("You need a target for this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                caster.DisableSkill(this, 3 * 1000);
                return 0;
            }

            if (!caster.IsWithinRadius(caster.TargetObject, (int)(1500 * caster.GetModified(eProperty.SpellRange) * 0.01)))
            {
                caster.Out.SendMessage(caster.TargetObject + " is too far away.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                return 0;
            }

            foreach (GamePlayer player in caster.TargetObject.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                player.Out.SendSpellEffectAnimation(caster, (caster.TargetObject as GameLiving), 7025, 0, false, 1);
            }

            foreach (GameNPC mob in caster.TargetObject.GetNPCsInRadius(500))
            {
                if (!GameServer.ServerRules.IsAllowedToAttack(caster, mob, true))
                    continue;

                mob.TakeDamage(caster, eDamageType.Heat, dmgValue, 0);
                caster.Out.SendMessage("You hit the " + mob.Name + " for " + dmgValue + " damage.", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
                foreach (GamePlayer player2 in caster.TargetObject.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    player2.Out.SendSpellEffectAnimation(caster, mob, 7025, 0, false, 1);
                }
            }

            foreach (GamePlayer aeplayer in caster.TargetObject.GetPlayersInRadius(500))
            {
                if (!GameServer.ServerRules.IsAllowedToAttack(caster, aeplayer, true))
                    continue;

                aeplayer.TakeDamage(caster, eDamageType.Heat, dmgValue, 0);
                caster.Out.SendMessage("You hit " + aeplayer.Name + " for " + dmgValue + " damage.", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
                aeplayer.Out.SendMessage(caster.Name + " hits you for " + dmgValue + " damage.", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow);
                foreach (GamePlayer player3 in caster.TargetObject.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    player3.Out.SendSpellEffectAnimation(caster, aeplayer, 7025, 0, false, 1);
                }
            }

            DisableSkill(caster);
            timer.Stop();
            timer = null;
            return 0;
        }