예제 #1
0
        public void RemoveEffect()
        {
            if (player == null)
            {
                return;
            }

            GameSpellEffect effect = FindEffectOnTarget(player, this);

            effect?.Cancel(false);

            if (item == null)
            {
                return;
            }

            item.DPS_AF  = old_item_af;
            item.SPD_ABS = old_item_abs;

            player.Client.Out.SendInventoryItemsUpdate(new InventoryItem[] { item });
            player.Out.SendCharStatsUpdate();
            player.UpdatePlayerStatus();
            player.Out.SendUpdatePlayer();
            player.Out.SendUpdateWeaponAndArmorStats();
            player.Out.SendCharResistsUpdate();

            GameEventMgr.RemoveHandler(player, GamePlayerEvent.Linkdeath, new DOLEventHandler(EventAction));
            GameEventMgr.RemoveHandler(player, GamePlayerEvent.Quit, new DOLEventHandler(EventAction));
            GameEventMgr.RemoveHandler(player, GamePlayerEvent.RegionChanged, new DOLEventHandler(EventAction));
            GameEventMgr.RemoveHandler(player, GameLivingEvent.Dying, new DOLEventHandler(EventAction));
        }
예제 #2
0
        private void OnAttack(DOLEvent e, object sender, EventArgs arguments)
        {
            if (!(sender is GameLiving living))
            {
                return;
            }

            AttackedByEnemyEventArgs attackedByEnemy = arguments as AttackedByEnemyEventArgs;
            AttackData ad = null;

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

            if ((int)ad.DamageType >= 10 && (int)ad.DamageType <= 15)
            {
                (ad.Attacker as GamePlayer)?.Out.SendMessage($"Your target\' Ereine Proc absorb {ad.Damage + ad.CriticalDamage} damages", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);

                (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 = FindEffectOnTarget(living, this);
                effect?.Cancel(false);
            }
        }
        /// <summary>
        /// Action
        /// </summary>
        /// <param name="living"></param>
        public override void Execute(GameLiving living)
        {
            if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED))
            {
                return;
            }
            GamePlayer player = living as GamePlayer;

            if (player != null)
            {
                if (player.TempProperties.getProperty("Charging", false) ||
                    player.EffectList.CountOfType(typeof(SpeedOfSoundEffect), typeof(ArmsLengthEffect), typeof(ChargeEffect)) > 0)
                {
                    player.Out.SendMessage("You already an effect of that type!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
                    return;
                }

                GameSpellEffect speed = Spells.SpellHandler.FindEffectOnTarget(player, "SpeedEnhancement");
                if (speed != null)
                {
                    speed.Cancel(false);
                }
                new ArmsLengthEffect().Start(player);
                SendCasterSpellEffectAndCastMessage(player, 7068, true);
            }
            DisableSkill(living);
        }
예제 #4
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);
            }
        }
예제 #5
0
        public override void OnEffectPulse(GameSpellEffect effect)
        {
            if (mine == null || mine.ObjectState == GameObject.eObjectState.Deleted)
            {
                effect.Cancel(false);
                return;
            }

            if (trap == null)
            {
                return;
            }
            bool wasstealthed = ((GamePlayer)Caster).IsStealthed;

            foreach (GameNPC npc in mine.GetNPCsInRadius((ushort)s.Range))
            {
                if (npc is GameSiegeWeapon && npc.IsAlive && GameServer.ServerRules.IsAllowedToAttack(Caster, npc, true))
                {
                    trap.StartSpell((GameLiving)npc);
                    if (!Unstealth)
                    {
                        ((GamePlayer)Caster).Stealth(wasstealthed);
                    }
                    return;
                }
            }
        }
예제 #6
0
        private void ReleaseEventHandler(DOLEvent e, object sender, EventArgs arguments)
        {
            IControlledBrain npc = null;

            if (e == GameLivingEvent.PetReleased)
            {
                npc = ((GameNPC)sender).Brain as IControlledBrain;
            }
            else if (e == GameLivingEvent.Dying)
            {
                npc = ((GameNPC)sender).Brain as IControlledBrain;
            }

            if (npc == null)
            {
                return;
            }

            PulsingSpellEffect concEffect = FindPulsingSpellOnTarget(npc.Owner, this);

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

            GameSpellEffect charm = FindEffectOnTarget(npc.Body, this);

            if (charm == null)
            {
                log.Warn("charm effect is already canceled");
                return;
            }

            charm.Cancel(false);
        }
예제 #7
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 = FindEffectOnTarget(effect.Owner, "Mesmerize");

            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 npc && npc.Brain is IOldAggressiveBrain aggroBrain)
            {
                aggroBrain.AddToAggroList(Caster, 1);
            }
        }
예제 #8
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);
 }
예제 #9
0
        /// <summary>
        /// Handles attack on buff owner
        /// </summary>
        /// <param name="e"></param>
        /// <param name="sender"></param>
        /// <param name="arguments"></param>
        protected virtual void OnAttacked(DOLEvent e, object sender, EventArgs arguments)
        {
            AttackedByEnemyEventArgs attackArgs = arguments as AttackedByEnemyEventArgs;
            GameLiving living = sender as GameLiving;

            if (attackArgs == null)
            {
                return;
            }

            if (living == null)
            {
                return;
            }

            switch (attackArgs.AttackData.AttackResult)
            {
            case GameLiving.eAttackResult.HitStyle:
            case GameLiving.eAttackResult.HitUnstyled:
                GameSpellEffect effect = FindEffectOnTarget(living, this);
                effect?.Cancel(false);

                break;
            }
        }
예제 #10
0
        protected virtual void OnAttacked(DOLEvent e, object sender, EventArgs arguments)
        {
            AttackedByEnemyEventArgs attackArgs = arguments as AttackedByEnemyEventArgs;
            GameLiving living = sender as GameLiving;

            if (attackArgs == null)
            {
                return;
            }

            if (living == null)
            {
                return;
            }

            GameSpellEffect effect = FindEffectOnTarget(living, this);

            if (attackArgs.AttackData.Damage > 0)
            {
                effect?.Cancel(false);
            }

            if (attackArgs.AttackData.SpellHandler is StyleBleeding || attackArgs.AttackData.SpellHandler is DoTSpellHandler || attackArgs.AttackData.SpellHandler is HereticDoTSpellHandler)
            {
                GameSpellEffect affect = FindEffectOnTarget(living, this);
                affect?.Cancel(false);
            }
        }
예제 #11
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);
        }
예제 #12
0
        public override void OnEffectStart(GameSpellEffect effect)
        {
            base.OnEffectStart(effect);
            m_effect = effect;
            if (effect.Owner == null || !effect.Owner.IsAlive)
            {
                return;
            }

            if ((effect.Owner is GamePlayer))
            {
                GamePlayer casterPlayer = effect.Owner as GamePlayer;
                if (casterPlayer.GroundTarget != null && casterPlayer.GroundTargetInView)
                {
                    GameEventMgr.AddHandler(casterPlayer, GamePlayerEvent.Moving, new DOLEventHandler(PlayerMoves));
                    GameEventMgr.AddHandler(warder, GameLivingEvent.Dying, new DOLEventHandler(BattleWarderDie));
                    GameEventMgr.AddHandler(casterPlayer, GamePlayerEvent.CastStarting, new DOLEventHandler(PlayerMoves));
                    GameEventMgr.AddHandler(casterPlayer, GamePlayerEvent.AttackFinished, new DOLEventHandler(PlayerMoves));
                    warder.X = casterPlayer.GroundTarget.X;
                    warder.Y = casterPlayer.GroundTarget.Y;
                    warder.Z = casterPlayer.GroundTarget.Z;
                    warder.AddBrain(new MLBrain());
                    warder.AddToWorld();
                }
                else
                {
                    MessageToCaster("Your area target is out of range.  Set a closer ground position.", eChatType.CT_SpellResisted);
                    effect.Cancel(false);
                }
            }
        }
예제 #13
0
        /// <summary>
        /// [Ganrod] Nidel: Can remove TurretFNF
        /// </summary>
        /// <param name="e"></param>
        /// <param name="sender"></param>
        /// <param name="arguments"></param>
        protected override void OnNpcReleaseCommand(DOLEvent e, object sender, EventArgs arguments)
        {
            m_pet = sender as GamePet;
            if (m_pet == null)
            {
                return;
            }

            if ((m_pet.Brain as TurretFNFBrain) == null)
            {
                return;
            }

            if (Caster.ControlledBrain == null)
            {
                ((GamePlayer)Caster).Out.SendPetWindow(null, ePetWindowAction.Close, 0, 0);
            }

            GameEventMgr.RemoveHandler(m_pet, GameLivingEvent.PetReleased, OnNpcReleaseCommand);

            GameSpellEffect effect = FindEffectOnTarget(m_pet, this);

            if (effect != null)
            {
                effect.Cancel(false);
            }
        }
예제 #14
0
        protected virtual void RemoveEffect()
        {
            if (m_focusTargets != null)
            {
                lock (m_focusTargets.SyncRoot)
                {
                    foreach (GameLiving living in m_focusTargets)
                    {
                        GameSpellEffect effect = FindEffectOnTarget(living, this);
                        if (effect != null)
                        {
                            effect.Cancel(false);
                        }
                    }
                }
            }
            MessageToCaster("You lose your concentration!", eChatType.CT_Spell);
            if (Spell.Pulse != 0 && Spell.Frequency > 0)
            {
                CancelPulsingSpell(Caster, Spell.SpellType);
            }

            GameEventMgr.RemoveHandler(m_caster, GamePlayerEvent.AttackFinished, new DOLEventHandler(EventAction));
            GameEventMgr.RemoveHandler(m_caster, GamePlayerEvent.CastStarting, new DOLEventHandler(EventAction));
            GameEventMgr.RemoveHandler(m_caster, GamePlayerEvent.Moving, new DOLEventHandler(EventAction));
            GameEventMgr.RemoveHandler(m_caster, GamePlayerEvent.Dying, new DOLEventHandler(EventAction));
            GameEventMgr.RemoveHandler(m_caster, GamePlayerEvent.AttackedByEnemy, new DOLEventHandler(EventAction));
            foreach (GamePlayer player in m_caster.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                player.Out.SendInterruptAnimation(m_caster);
            }
        }
예제 #15
0
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            if (!target.IsAlive || target.ObjectState != GameObject.eObjectState.Active)
            {
                return;
            }

            GamePlayer player = target as GamePlayer;

            if (target is GamePlayer)
            {
                int value  = (int)Spell.Value;
                var mana   = player.Mana * value / 100;
                var end    = player.Endurance * value / 100;
                var 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 = FindEffectOnTarget(target, "Mesmerize");
                if (effect2 != null)
                {
                    effect2.Cancel(true);
                    return;
                }

                foreach (GamePlayer _ in player.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    SendEffectAnimation(player, 0, false, 1);
                }

                player.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            }
        }
예제 #16
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;
            }

//         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);
            }
        }
예제 #17
0
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            GameSpellEffect mezz = FindEffectOnTarget(target, "Mesmerize");

            mezz?.Cancel(false);

            base.ApplyEffectOnTarget(target, effectiveness);
        }
예제 #18
0
        /// <summary>
        /// execute non duration spell effect on target
        /// </summary>
        /// <param name="target"></param>
        /// <param name="effectiveness"></param>
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            base.OnDirectEffect(target, effectiveness);
            if (target == null)
            {
                return;
            }

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

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

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

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

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

                    return;
                }
            }

            SendEffectAnimation(target, 0, false, 0);
            MessageToCaster("No enhancement of that type found on the target.", eChatType.CT_SpellResisted);
        }
예제 #19
0
        private void GuardDie(DOLEvent e, object sender, EventArgs args)
        {
            GameNPC bguard = sender as GameNPC;

            if (bguard == summoned)
            {
                GameEventMgr.RemoveHandler(summoned, GameLivingEvent.Dying, new DOLEventHandler(GuardDie));
                beffect.Cancel(false);
            }
        }
예제 #20
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);
        }
예제 #21
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);
        }
예제 #22
0
        protected override void FocusSpellAction(DOLEvent e, object sender, EventArgs args)
        {
            GameLiving living = sender as GameLiving;

            if (living == null)
            {
                return;
            }

            GameSpellEffect currentEffect = (GameSpellEffect)living.TempProperties.getProperty <object>(FOCUS_SPELL, null);

            if (currentEffect == null)
            {
                return;
            }

            if (args is AttackedByEnemyEventArgs attackedByEnemy)
            {
                var attacker = attackedByEnemy.AttackData.Attacker;
                if (e == GameLivingEvent.AttackedByEnemy && Spell.Uninterruptible && Caster.GetDistanceTo(attacker) > 200)
                {
                    return;
                }
            }

            GameEventMgr.RemoveHandler(Caster, GameLivingEvent.AttackFinished, new DOLEventHandler(FocusSpellAction));
            GameEventMgr.RemoveHandler(Caster, GameLivingEvent.CastStarting, new DOLEventHandler(FocusSpellAction));
            GameEventMgr.RemoveHandler(Caster, GameLivingEvent.Moving, new DOLEventHandler(FocusSpellAction));
            GameEventMgr.RemoveHandler(Caster, GameLivingEvent.Dying, new DOLEventHandler(FocusSpellAction));
            GameEventMgr.RemoveHandler(Caster, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(FocusSpellAction));
            GameEventMgr.RemoveHandler(currentEffect.Owner, GameLivingEvent.Dying, new DOLEventHandler(FocusSpellAction));
            Caster.TempProperties.removeProperty(FOCUS_SPELL);
            foreach (GamePlayer player in Caster.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                player.Out.SendInterruptAnimation(Caster);
            }
            GameSpellEffect effect = FindEffectOnTarget(currentEffect.Owner, this);

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

            CancelPulsingSpell(Caster, Spell.SpellType);
            currentEffect.Cancel(false);

            if (e == GameLivingEvent.Moving)
            {
                MessageToCaster("You move and interrupt your focus!", eChatType.CT_Important);
            }

            MessageToCaster(String.Format("You lose your focus on your {0} spell.", currentEffect.Spell.Name), eChatType.CT_SpellExpires);
        }
예제 #23
0
        public void EventRaised(DOLEvent e, object sender, EventArgs arguments)
        {
            if (!(sender is GamePlayer player))
            {
                return;
            }

            player.Model = m_model;
            GameSpellEffect effect = FindEffectOnTarget(player, "SummonMonster");

            effect?.Cancel(false);
        }
예제 #24
0
        /// Effect expiring (duration spells only).
        /// <returns>Immunity duration in milliseconds.</returns>
        public override int OnEffectExpires(GameSpellEffect effect, bool noMessages)
        {
            GamePlayer player = effect.Owner as GamePlayer;

            if (player != null)
            {
                effect.Cancel(false);
                player.Model = player.CreationModel;

                GameEventMgr.RemoveHandler((GamePlayer)effect.Owner, GamePlayerEvent.RegionChanged, new DOLEventHandler(OnZone));
            }
            return(0);
        }
        /// <summary>
        /// When an applied effect starts
        /// duration spells only
        /// </summary>
        /// <param name="effect"></param>
        public override void OnEffectStart(GameSpellEffect effect)
        {
            GameSpellEffect mezz = FindEffectOnTarget(effect.Owner, "Mesmerize");

            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);
        }
예제 #26
0
        /// <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);
            }
        }
 public override void OnEffectPulse(GameSpellEffect effect)
 {
     if (!m_caster.IsAlive || !effect.Owner.IsAlive || m_caster.Mana < Spell.PulsePower || !m_caster.IsWithinRadius(effect.Owner, (int)(Spell.Range * m_caster.GetModified(eProperty.SpellRange) * 0.01)) || m_caster.IsMezzed || m_caster.IsStunned || (m_caster.TargetObject is GameLiving ? effect.Owner != m_caster.TargetObject as GameLiving : true))
     {
         effect.Cancel(false);
         return;
     }
     base.OnEffectPulse(effect);
     SendEffectAnimation(effect.Owner, 0, false, 1);
     // An acidic cloud surrounds you!
     MessageToLiving(effect.Owner, Spell.Message1, eChatType.CT_Spell);
     // {0} is surrounded by an acidic cloud!
     Message.SystemToArea(effect.Owner, Util.MakeSentence(Spell.Message2, effect.Owner.GetName(0, false)), eChatType.CT_YouHit, effect.Owner);
     OnDirectEffect(effect.Owner, effect.Effectiveness);
 }
예제 #28
0
        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);
            }
        }
예제 #29
0
        /// <summary>
        /// execute non duration spell effect on target
        /// </summary>
        /// <param name="target"></param>
        /// <param name="effectiveness"></param>
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            base.OnDirectEffect(target, effectiveness);
            if (target == null || !target.IsAlive)
            {
                return;
            }

            // RR4: we remove all the effects
            foreach (string toRemove in SpellTypesToRemove)
            {
                GameSpellEffect effect = target.FindEffectOnTarget(toRemove);
                effect?.Cancel(false);
            }

            SendEffectAnimation(target, 0, false, 1);
        }
예제 #30
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 = FindEffectOnTarget(effect.Owner, "Mesmerize");

            mezz?.Cancel(false);
        }