示例#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);
        }
        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);
        }