/// <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);
            }
        }
예제 #2
0
        public override void OnEffectStart(GameSpellEffect effect)
        {

            base.OnEffectStart(effect);
            if (effect.Owner is GamePlayer)
            {
                GamePlayer player = effect.Owner as GamePlayer;

                for (int i = (int)eProperty.Skill_First; i <= (int)eProperty.Skill_Last; i++)
                {
                    if (player.GetModifiedSpecLevel(SkillBase.GetPropertyName((eProperty)(i))) != 0)
                    {
                        player.BaseBuffBonusCategory[i] = -player.GetModifiedSpecLevel(SkillBase.GetPropertyName((eProperty)(i)));
                    }
                    //					DOLConsole.WriteWarning("Spec " + SkillBase.GetPropertyName((eProperty)(i)) + " " + player.GetModifiedSpecLevel(SkillBase.GetPropertyName((eProperty)(i))));
                }
                player.PropertiesChanged();
                player.Out.SendCharStatsUpdate();
                player.UpdatePlayerStatus();
                MessageToLiving(effect.Owner, Spell.Message1, eChatType.CT_Spell);
                Message.SystemToArea(effect.Owner, Util.MakeSentence(Spell.Message2, effect.Owner.GetName(0, true)), eChatType.CT_Spell, effect.Owner);

            }

        }
예제 #3
0
        /// <summary>
        /// When an applied effect pulses
        /// duration spells only
        /// </summary>
        /// <param name="effect"></param>
        public override void OnEffectPulse(GameSpellEffect effect)
        {
            base.OnEffectPulse(effect);

            MessageToLiving(effect.Owner, Spell.Message1, eChatType.CT_YouWereHit);
            Message.SystemToArea(effect.Owner, Util.MakeSentence(Spell.Message2, effect.Owner.GetName(0, false)), eChatType.CT_YouHit, effect.Owner);

            int bleedValue = effect.Owner.TempProperties.getProperty<int>(BLEED_VALUE_PROPERTY);

            AttackData ad = CalculateDamageToTarget(effect.Owner, 1.0);

            SendDamageMessages(ad);

            // attacker must be null, attack result is 0x0A
            foreach (GamePlayer player in ad.Target.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                player.Out.SendCombatAnimation(null, ad.Target, 0, 0, 0, 0, 0x0A, ad.Target.HealthPercent);
            }
            // send animation before dealing damage else dead livings show no animation
            ad.Target.OnAttackedByEnemy(ad);
            ad.Attacker.DealDamage(ad);

            if (--bleedValue <= 0 || !effect.Owner.IsAlive)
                effect.Cancel(false);
            else effect.Owner.TempProperties.setProperty(BLEED_VALUE_PROPERTY, bleedValue);
        }
		public override void  OnEffectStart(GameSpellEffect effect)
		{
			//Add the handler for when the target is attacked and we should reduce the damage
			GameEventMgr.AddHandler(FSTarget, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(OnAttacked));

			//Add handlers for the target attacking, casting, etc
			//Don't need to add the handlers twice
			if (FSTarget != Caster)
			{
				GameEventMgr.AddHandler(FSTarget, GameLivingEvent.AttackFinished, new DOLEventHandler(CancelSpell));
				GameEventMgr.AddHandler(FSTarget, GameLivingEvent.CastStarting, new DOLEventHandler(CancelSpell));
			}

			//Send the spell messages
			MessageToLiving(FSTarget, Spell.Message1, eChatType.CT_Spell);
			foreach (GamePlayer player in FSTarget.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
			{
				if (player != FSTarget)
					MessageToLiving(player, string.Format(Spell.Message3, FSTarget.Name), eChatType.CT_Spell);
			}

			timer = new FSTimer(Caster, this);
			timer.Start(1);

 			base.OnEffectStart(effect);
		}
예제 #5
0
 /// <summary>
 /// Determines wether this spell is compatible with given spell
 /// and therefore overwritable by better versions
 /// spells that are overwritable cannot stack
 /// </summary>
 /// <param name="compare"></param>
 /// <returns></returns>
 public override bool IsOverwritable(GameSpellEffect compare)
 {
     if (Spell.EffectGroup != 0 || compare.Spell.EffectGroup != 0)
         return Spell.EffectGroup == compare.Spell.EffectGroup;
     if (compare.Spell.SpellType == "Stun") return true;
     return base.IsOverwritable(compare);
 }
예제 #6
0
        public override void OnEffectStart(GameSpellEffect effect)
        {
            base.OnEffectStart(effect);
            GameLiving living = effect.Owner as GameLiving;
            living.AbilityBonus[(int)eProperty.Dexterity] += (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.Strength] += (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.Constitution] += (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.Acuity] += (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.Piety] += (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.Empathy] += (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.Quickness] += (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.Intelligence] += (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.Charisma] += (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.ArmorAbsorption] += (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.MagicAbsorption] += (int)m_spell.Value;

            if (effect.Owner is GamePlayer)
            {
                GamePlayer player = effect.Owner as GamePlayer;
                player.Out.SendCharStatsUpdate();
                player.UpdateEncumberance();
                player.UpdatePlayerStatus();
                player.Out.SendUpdatePlayer();
            }
        }
예제 #7
0
        public override int OnEffectExpires(GameSpellEffect effect, bool noMessages)
        {
            GameLiving living = effect.Owner as GameLiving;
            living.AbilityBonus[(int)eProperty.Dexterity] -= (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.Strength] -= (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.Constitution] -= (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.Acuity] -= (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.Piety] -= (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.Empathy] -= (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.Quickness] -= (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.Intelligence] -= (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.Charisma] -= (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.ArmorAbsorption] -= (int)m_spell.Value;
            living.AbilityBonus[(int)eProperty.MagicAbsorption] -= (int)m_spell.Value;

            if (effect.Owner is GamePlayer)
            {
                GamePlayer player = effect.Owner as GamePlayer;
                player.Out.SendCharStatsUpdate();
                player.UpdateEncumberance();
                player.UpdatePlayerStatus();
                player.Out.SendUpdatePlayer();
            }
            return base.OnEffectExpires(effect, noMessages);
        }
예제 #8
0
 public override int OnEffectExpires(GameSpellEffect effect, bool noMessages)
 {
     GamePlayer player = effect.Owner as GamePlayer;
     if (player == null) return base.OnEffectExpires(effect, noMessages);
     GameEventMgr.RemoveHandler((GamePlayer)effect.Owner, GamePlayerEvent.SwimmingStatus, new DOLEventHandler(SwimmingStatusChange));
     return base.OnEffectExpires(effect, noMessages);
 }
		public override void OnEffectStart(GameSpellEffect effect)
		{

			if (effect.Owner is GamePlayer)
			{
				base.OnEffectStart(effect);
				GamePlayer player = effect.Owner as GamePlayer;
				player.BaseBuffBonusCategory[0] = (int)player.Effectiveness;

				double effectiveness =  player.Effectiveness;
				double valueToAdd = (Spell.Value * effectiveness)/100;
				valueToAdd = effectiveness - valueToAdd;

				if ((valueToAdd) > 0)
				{
					player.Effectiveness = valueToAdd;
				}
				else
				{
					player.Effectiveness = 0;
				}
			

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

			}
			
		}
        public override void OnEffectStart(GameSpellEffect effect)
        {
            base.OnEffectStart(effect);
            //effect.Owner.DebuffCategory[(int)eProperty.Dexterity] += (int)m_spell.Value;
            double percentValue = (m_spell.Value) / 100;
            StrDebuff = (int)((double)effect.Owner.GetModified(eProperty.Strength) * percentValue);
            DexDebuff = (int)((double)effect.Owner.GetModified(eProperty.Dexterity) * percentValue);
            ConDebuff = (int)((double)effect.Owner.GetModified(eProperty.Constitution) * percentValue);
            EmpDebuff = (int)((double)effect.Owner.GetModified(eProperty.Empathy) * percentValue);
            QuiDebuff = (int)((double)effect.Owner.GetModified(eProperty.Quickness) * percentValue);
            IntDebuff = (int)((double)effect.Owner.GetModified(eProperty.Intelligence) * percentValue);
            ChaDebuff = (int)((double)effect.Owner.GetModified(eProperty.Charisma) * percentValue);
            PieDebuff = (int)((double)effect.Owner.GetModified(eProperty.Piety) * percentValue);

            effect.Owner.DebuffCategory[(int)eProperty.Dexterity] += DexDebuff;
            effect.Owner.DebuffCategory[(int)eProperty.Strength] += StrDebuff;
            effect.Owner.DebuffCategory[(int)eProperty.Constitution] += ConDebuff;
            effect.Owner.DebuffCategory[(int)eProperty.Piety] += PieDebuff;
            effect.Owner.DebuffCategory[(int)eProperty.Empathy] += EmpDebuff;
            effect.Owner.DebuffCategory[(int)eProperty.Quickness] += QuiDebuff;
            effect.Owner.DebuffCategory[(int)eProperty.Intelligence] += IntDebuff;
            effect.Owner.DebuffCategory[(int)eProperty.Charisma] += ChaDebuff;

            if (effect.Owner is GamePlayer)
            {
                GamePlayer player = effect.Owner as GamePlayer;
                player.Out.SendCharStatsUpdate();
                player.UpdateEncumberance();
                player.UpdatePlayerStatus();
                player.Out.SendUpdatePlayer();
            }
        }
예제 #11
0
 public BuffCheckAction(GameLiving caster, GameLiving owner, GameSpellEffect effect)
     : base(caster)
 {
     m_caster = caster;
     m_owner = owner;
     m_effect = effect;
 }
예제 #12
0
		public override void OnEffectStart(GameSpellEffect effect)
		{

			effect.Owner.BaseBuffBonusCategory[(int)eProperty.Skill_Stealth]+=(int)m_spell.Value;
			base.OnEffectStart(effect);
	//		effect.Owner.BuffBonusCategory1[(int)eProperty.StealthRange] += (int)m_spell.Value;
		}
예제 #13
0
        /// <summary>
        /// Despawn pet.
        /// </summary>
        /// <param name="effect"></param>
        /// <param name="noMessages"></param>
        /// <returns>Immunity timer (in milliseconds).</returns>
        public override int OnEffectExpires(GameSpellEffect effect, bool noMessages)
        {
            if (Caster.PetCount > 0)
                Caster.PetCount--;

            return base.OnEffectExpires(effect, noMessages);
        }
예제 #14
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;
			}
            effect.Owner.DisarmedTime = effect.Owner.CurrentRegion.Time + CalculateEffectDuration(effect.Owner, Caster.Effectiveness);
			effect.Owner.StopAttack();
			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);
			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);
			}
		}
예제 #15
0
 /// <summary>
 /// When an applied effect expires.
 /// Duration spells only.
 /// </summary>
 /// <param name="effect">The expired effect</param>
 /// <param name="noMessages">true, when no messages should be sent to player and surrounding</param>
 /// <returns>immunity duration in milliseconds</returns>
 public override int OnEffectExpires(GameSpellEffect effect, bool noMessages)
 {
     // http://www.camelotherald.com/more/1749.shtml
     // immunity timer will now be exactly five times the length of the stun
     base.OnEffectExpires(effect, noMessages);
     return Spell.Duration * 5;
 }
예제 #16
0
 public override int OnEffectExpires(GameSpellEffect effect, bool noMessages)
 {
     GamePlayer player = effect.Owner as GamePlayer;
     if(player == null) return base.OnEffectExpires(effect, noMessages);
     //GameEventMgr.RemoveHandler(player, GamePlayerEvent.TakeDamage, new DOLEventHandler(LivingTakeDamage));
     GameEventMgr.RemoveHandler(player, GamePlayerEvent.AttackedByEnemy, new DOLEventHandler(LivingTakeDamage));
     return base.OnEffectExpires(effect, noMessages);
 }
예제 #17
0
 public override void OnEffectStart(GameSpellEffect effect)
 {
     m_effect = effect;
     base.OnEffectStart(effect);
     GamePlayer player = effect.Owner as GamePlayer;
     if (player == null) return;
     GameEventMgr.AddHandler((GamePlayer)effect.Owner, GamePlayerEvent.SwimmingStatus, new DOLEventHandler(SwimmingStatusChange));
 }
예제 #18
0
 public override bool IsOverwritable(GameSpellEffect compare)
 {
     if (Spell.Group != 0)
         return Spell.Group == compare.Spell.Group;
     if (base.IsOverwritable(compare) == false) return false;
     if (compare.Spell.Duration != Spell.Duration) return false;
     return true;
 }
예제 #19
0
 public override void OnEffectStart(GameSpellEffect effect)
 {
     base.OnEffectStart(effect);
     eChatType toLiving = (Spell.Pulse == 0) ? eChatType.CT_Spell : eChatType.CT_SpellPulse;
     eChatType toOther = (Spell.Pulse == 0) ? eChatType.CT_System : eChatType.CT_SpellPulse;
     MessageToLiving(effect.Owner, Spell.Message1, toLiving);
     Message.SystemToArea(effect.Owner, Util.MakeSentence(Spell.Message2, effect.Owner.GetName(0, false)), toOther, effect.Owner);
 }
예제 #20
0
        public override void OnEffectStart(GameSpellEffect effect)
        {
            base.OnEffectStart(effect);
            if (effect.Owner == null || !effect.Owner.IsAlive)
                return;

            merchant.AddToWorld();
        }
예제 #21
0
 public override void OnEffectStart(GameSpellEffect effect)
 {
     base.OnEffectStart(effect);
     m_effect = effect;
     if (effect.Owner == null || !effect.Owner.IsAlive)
         return;
     GameEventMgr.AddHandler(decoy, GameLivingEvent.Dying, new DOLEventHandler(DecoyDied));
 }
예제 #22
0
 public override int OnEffectExpires(GameSpellEffect effect, bool noMessages)
 {
     if(effect != null && effect.Owner != null && effect.Owner is GameNPC)
     {
         GameNPC npc = effect.Owner as GameNPC;
         npc.IsConfused = false;
     }
     return base.OnEffectExpires(effect, noMessages);
 }
예제 #23
0
 public override void OnEffectStart(GameSpellEffect effect)
 {
     base.OnEffectStart(effect);
     if (effect.Owner is GamePlayer)
     {
         GamePlayer player = effect.Owner as GamePlayer;
         GameEventMgr.AddHandler(player, GamePlayerEvent.AttackedByEnemy, new DOLEventHandler(OnAttack));
     }
 }
예제 #24
0
 public override int OnEffectExpires(GameSpellEffect effect, bool noMessages)
 {
     if (effect.Owner is GamePlayer)
     {
         GamePlayer player = effect.Owner as GamePlayer;
         GameEventMgr.RemoveHandler(player, GamePlayerEvent.AttackedByEnemy, new DOLEventHandler(OnAttack));
     }
     return base.OnEffectExpires(effect, noMessages);
 }
예제 #25
0
 public override void OnEffectStart(GameSpellEffect effect)
 {
     gp = effect.Owner as GamePlayer;
     if (gp != null)
     {
         gp.AddAbility(SkillBase.GetAbility(Abilities.Climbing));
         gp.Out.SendUpdatePlayerSkills();
     }
 }
예제 #26
0
        /// <summary>
        /// Effect expiring (duration spells only).
        /// </summary>
        /// <param name="effect"></param>
        /// <param name="noMessages"></param>
        /// <returns>Immunity duration in milliseconds.</returns>
        public override int OnEffectExpires(GameSpellEffect effect, bool noMessages)
        {
            GamePlayer player = effect.Owner as GamePlayer;

            if (player != null)
                player.Model = player.CreationModel;      
      
            return base.OnEffectExpires(effect, noMessages);
        }
예제 #27
0
        public override int OnEffectExpires(GameSpellEffect effect, bool noMessages)
        {
            if(effect.Owner is GamePlayer && !noMessages)
                ((GamePlayer)effect.Owner).Out.SendMessage("You modification spell effect has expired.", eChatType.CT_SpellExpires, eChatLoc.CL_SystemWindow);

            GameEventMgr.RemoveHandler(effect.Owner, GamePlayerEvent.Moving, new DOLEventHandler(OnMove));

            return base.OnEffectExpires (effect, false);
        }
예제 #28
0
 public override void OnEffectStart(GameSpellEffect effect)
 {
     if(effect.Owner is GamePlayer)
     {
         GamePlayer player = effect.Owner as GamePlayer;
         player.Model = (ushort)Spell.LifeDrainReturn; // 1200 is official id
     }
     base.OnEffectStart(effect);
 }
예제 #29
0
 /// <summary>
 /// When an applied effect expires.
 /// Duration spells only.
 /// </summary>
 /// <param name="effect">The expired effect</param>
 /// <param name="noMessages">true, when no messages should be sent to player and surrounding</param>
 /// <returns>immunity duration in milliseconds</returns>
 public override int OnEffectExpires(GameSpellEffect effect, bool noMessages)
 {
     if (!noMessages && Spell.Pulse == 0)
     {
         MessageToLiving(effect.Owner, Spell.Message3, eChatType.CT_SpellExpires);
         Message.SystemToArea(effect.Owner, Util.MakeSentence(Spell.Message4, effect.Owner.GetName(0, false)), eChatType.CT_SpellExpires, effect.Owner);
     }
     return 0;
 }
예제 #30
0
		/// <summary>
		/// When an applied effect expires.
		/// Duration spells only.
		/// </summary>
		/// <param name="effect">The expired effect</param>
		/// <param name="noMessages">true, when no messages should be sent to player and surrounding</param>
		/// <returns>immunity duration in milliseconds</returns>
		public override int OnEffectExpires(GameSpellEffect effect, bool noMessages)
		{
			//effect.Owner.IsDisarmed = false;
			if (!noMessages) {
				MessageToLiving(effect.Owner, Spell.Message3, eChatType.CT_SpellExpires);
				Message.SystemToArea(effect.Owner, Util.MakeSentence(Spell.Message4, effect.Owner.GetName(0, false)), eChatType.CT_SpellExpires, effect.Owner);
			}
			return base.OnEffectExpires(effect,noMessages);
		}
예제 #31
0
        protected override void OnNpcReleaseCommand(DOLEvent e, object sender, EventArgs arguments)
        {
            if (!(sender is GameNPC) || !((sender as GameNPC).Brain is IControlledBrain))
            {
                return;
            }
            GameNPC          pet   = sender as GameNPC;
            IControlledBrain brain = pet.Brain as IControlledBrain;

            GameEventMgr.RemoveHandler(pet, GameLivingEvent.PetReleased, new DOLEventHandler(OnNpcReleaseCommand));

            DOL.GS.Effects.GameSpellEffect effect = FindEffectOnTarget(pet, this);
            if (effect != null)
            {
                effect.Cancel(false);
            }
        }
예제 #32
0
 /// <summary>
 /// Overwrite existing Effect and Enable new One.
 /// </summary>
 /// <param name="effect"></param>
 public virtual void Overwrite(GameSpellEffect effect)
 {
     ReplaceEffect(effect, true);
 }
예제 #33
0
 /// <summary>
 /// Overwrite existing Effect without Starting.
 /// </summary>
 /// <param name="effect"></param>
 public virtual void OverwriteDisabled(GameSpellEffect effect)
 {
     ReplaceEffect(effect, false);
 }
예제 #34
0
        /// <summary>
        /// Restore All Effect From PlayerXEffect Data Table
        /// </summary>
        public virtual void RestoreAllEffects()
        {
            GamePlayer player = m_owner as GamePlayer;

            if (player == null || player.DBCharacter == null || GameServer.Database == null)
            {
                return;
            }

            var effs = DOLDB <PlayerXEffect> .SelectObjects(DB.Column("ChardID").IsEqualTo(player.ObjectId));

            if (effs == null)
            {
                return;
            }

            foreach (PlayerXEffect eff in effs)
            {
                GameServer.Database.DeleteObject(eff);
            }

            foreach (PlayerXEffect eff in effs.GroupBy(e => e.Var1).Select(e => e.First()))
            {
                if (eff.SpellLine == GlobalSpellsLines.Reserved_Spells)
                {
                    continue;
                }

                bool  good  = true;
                Spell spell = SkillBase.GetSpellByID(eff.Var1);

                if (spell == null)
                {
                    good = false;
                }

                SpellLine line = null;

                if (!Util.IsEmpty(eff.SpellLine))
                {
                    line = SkillBase.GetSpellLine(eff.SpellLine, false);
                    if (line == null)
                    {
                        good = false;
                    }
                }
                else
                {
                    good = false;
                }

                if (good)
                {
                    ISpellHandler   handler = ScriptMgr.CreateSpellHandler(player, spell, line);
                    GameSpellEffect e;
                    e = new GameSpellEffect(handler, eff.Duration, spell.Frequency);
                    e.RestoredEffect = true;
                    int[] vars = { eff.Var1, eff.Var2, eff.Var3, eff.Var4, eff.Var5, eff.Var6 };
                    e.RestoreVars = vars;
                    e.Start(player);
                }
            }
        }
예제 #35
0
        /// <summary>
        /// Overwrites the effect
        /// concentration based effects should never be overwritten
        /// </summary>
        /// <param name="effect">the new effect</param>
        /// <param name="enable">Start new Effect or not</param>
        protected virtual void ReplaceEffect(GameSpellEffect effect, bool enable)
        {
            if (Concentration > 0)
            {
                if (log.IsWarnEnabled)
                {
                    log.WarnFormat("{0} is trying to overwrite {1},  which has concentration {2}", effect.Name, Name, Concentration);
                }
                return;
            }

            // Prevent further change to this effect.
            lock (m_LockObject)
            {
                StopTimers();
                IsExpired = true;
            }

            DisableEffect(true);
            SpellHandler.OnEffectRemove(this, true);

            lock (m_LockObject)
            {
                if (!IsDisabled)
                {
                    if (log.IsWarnEnabled)
                    {
                        log.WarnFormat("{0} is trying to overwrite an enabled effect {1}", effect.Name, Name);
                    }
                    return;
                }

                SpellHandler  = effect.SpellHandler;
                Duration      = effect.Duration;
                PulseFreq     = effect.PulseFreq;
                Effectiveness = effect.Effectiveness;

                // Add concentration Effect To Caster List.
                if (Concentration > 0 && SpellHandler != null && SpellHandler.Caster != null && SpellHandler.Caster.ConcentrationEffects != null)
                {
                    SpellHandler.Caster.ConcentrationEffects.Add(this);
                }

                // Restart Effect
                IsExpired = false;
                StartTimers();
            }

            // Try Enabling Effect
            if (enable)
            {
                EnableEffect();
            }
            else
            {
                UpdateEffect();
            }

            SpellHandler.OnEffectAdd(this);

            PulseCallback();
        }