Example #1
0
        public void Execute(Ability ab, GamePlayer player)
        {
            RapidFireEffect rapidFire = player.EffectList.GetOfType <RapidFireEffect>();

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

            if (!player.IsAlive)
            {
                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.RapidFire.CannotUseDead"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }

            SureShotEffect sureShot = player.EffectList.GetOfType <SureShotEffect>();

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

            TrueshotEffect trueshot = player.EffectList.GetOfType <TrueshotEffect>();

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

            new RapidFireEffect().Start(player);
        }
        /// <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)
            {
                SureShotEffect sureShot = player.EffectList.GetOfType <SureShotEffect>();
                if (sureShot != null)
                {
                    sureShot.Cancel(false);
                }

                RapidFireEffect rapidFire = player.EffectList.GetOfType <RapidFireEffect>();
                if (rapidFire != null)
                {
                    rapidFire.Cancel(false);
                }

                new TrueshotEffect().Start(player);
            }
            DisableSkill(living);
        }
        public void Execute(Ability ab, GamePlayer player)
        {
            if (player.ActiveWeaponSlot != GameLiving.eActiveWeaponSlot.Distance)
            {
                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUse.CriticalShot.NoRangedWeapons"), eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                return;
            }
            if (player.IsSitting)
            {
                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUse.CriticalShot.MustBeStanding"), eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
                return;
            }

            // cancel rapid fire effect
            RapidFireEffect rapidFire = player.EffectList.GetOfType <RapidFireEffect>();

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

            // cancel sure shot effect
            SureShotEffect sureShot = player.EffectList.GetOfType <SureShotEffect>();

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

            TrueshotEffect trueshot = player.EffectList.GetOfType <TrueshotEffect>();

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

            if (player.AttackState)
            {
                if (player.RangedAttackType == GameLiving.eRangedAttackType.Critical)
                {
                    player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CriticalShot.SwitchToRegular"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    player.RangedAttackType = GameLiving.eRangedAttackType.Normal;
                }
                else
                {
                    player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CriticalShot.AlreadyFiring"), eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                }
                return;
            }
            player.RangedAttackType = GameLiving.eRangedAttackType.Critical;
            player.StartAttack(player.TargetObject);
        }
        /// <summary>
        /// Action
        /// </summary>
        /// <param name="living"></param>
        public override void Execute(GameLiving living)
        {
            if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED))
            {
                return;
            }

            if (living is GamePlayer player)
            {
                SureShotEffect sureShot = player.EffectList.GetOfType <SureShotEffect>();
                sureShot?.Cancel(false);

                RapidFireEffect rapidFire = player.EffectList.GetOfType <RapidFireEffect>();
                rapidFire?.Cancel(false);

                new TrueshotEffect().Start(player);
            }

            DisableSkill(living);
        }