Exemple #1
0
        public override uint SelectSkillTarget(SkillSlot _slot)
        {
            uint               num             = this.lockTargetID;
            SelectEnemyType    selectEnemyType = SelectEnemyType.SelectLowHp;
            Player             ownerPlayer     = ActorHelper.GetOwnerPlayer(ref this.actorPtr);
            SkillSelectControl instance        = Singleton <SkillSelectControl> .GetInstance();

            Skill skill = (_slot.NextSkillObj == null) ? _slot.SkillObj : _slot.NextSkillObj;
            uint  dwSkillTargetFilter = skill.cfgData.dwSkillTargetFilter;

            if (skill.cfgData.bSkillTargetRule == 2)
            {
                num = this.actor.ObjID;
            }
            else
            {
                ActorRoot useSkillTargetLockAttackMode = _slot.skillIndicator.GetUseSkillTargetLockAttackMode();
                if (useSkillTargetLockAttackMode != null)
                {
                    if (this.IsValidLockTargetID(useSkillTargetLockAttackMode.ObjID))
                    {
                        num = useSkillTargetLockAttackMode.ObjID;
                        Singleton <NetLockAttackTarget> .GetInstance().SendLockAttackTarget(num);
                    }
                }
                else if (!this.IsValidLockTargetID(this.lockTargetID))
                {
                    if (ownerPlayer != null)
                    {
                        selectEnemyType = ownerPlayer.AttackTargetMode;
                    }
                    int srchR;
                    if (skill.AppointType == 1)
                    {
                        srchR = skill.GetMaxSearchDistance(_slot.GetSkillLevel());
                    }
                    else
                    {
                        srchR = skill.cfgData.iMaxAttackDistance;
                    }
                    if (selectEnemyType == SelectEnemyType.SelectLowHp)
                    {
                        num = Singleton <AttackModeTargetSearcher> .GetInstance().SearchLowestHpTarget(ref this.actorPtr, srchR, dwSkillTargetFilter, true, SearchTargetPriority.CommonAttack);
                    }
                    else
                    {
                        num = Singleton <AttackModeTargetSearcher> .GetInstance().SearchNearestTarget(ref this.actorPtr, srchR, dwSkillTargetFilter, true, SearchTargetPriority.CommonAttack);
                    }
                    if (this.IsValidLockTargetID(num))
                    {
                        Singleton <NetLockAttackTarget> .GetInstance().SendLockAttackTarget(num);
                    }
                }
                else if (!this.IsValidSkillTargetID(num, dwSkillTargetFilter))
                {
                    num = 0u;
                }
            }
            return(num);
        }
        protected bool IsValidTargetID(uint selectID)
        {
            bool flag = false;

            if (selectID <= 0u)
            {
                return(flag);
            }
            PoolObjHandle <ActorRoot> actor = Singleton <GameObjMgr> .GetInstance().GetActor(selectID);

            flag = (actor && !actor.handle.ObjLinker.Invincible && !actor.handle.ActorControl.IsDeadState && !this.actor.IsSelfCamp(actor) && actor.handle.HorizonMarker.IsVisibleFor(this.actor.TheActorMeta.ActorCamp) && actor.handle.AttackOrderReady);
            if (!flag)
            {
                return(flag);
            }
            Skill nextSkill = this.actor.ActorControl.GetNextSkill(SkillSlotType.SLOT_SKILL_0);

            if (nextSkill != null)
            {
                long num = (long)nextSkill.GetMaxSearchDistance(0);
                if (!actor || actor.handle.shape == null || actor.handle.ActorAgent == null || nextSkill.cfgData == null)
                {
                    return(false);
                }
                num += (long)actor.handle.ActorControl.GetDetectedRadius();
                num *= num;
                if ((this.actor.ActorControl.actorLocation - actor.handle.location).sqrMagnitudeLong2D > num)
                {
                    return(false);
                }
            }
            return(flag);
        }
Exemple #3
0
        public void SetUseSkillTarget()
        {
            ActorRoot actorRoot = null;
            Skill     skill     = (this.skillSlot.NextSkillObj != null) ? this.skillSlot.NextSkillObj : this.skillSlot.SkillObj;

            if (skill == null || skill.cfgData == null || skill.cfgData.bWheelType == 1 || skill.cfgData.bWheelType == 6)
            {
                return;
            }
            uint dwSkillTargetFilter = skill.cfgData.dwSkillTargetFilter;

            if (skill.cfgData.bRangeAppointType == 1)
            {
                if (!this.bUseAdvanceSelect && this.guidePrefab != null && this.guideSelectActive)
                {
                    SkillSelectControl instance = Singleton <SkillSelectControl> .GetInstance();

                    actorRoot = instance.SelectTarget((SkillTargetRule)skill.cfgData.bSkillTargetRule, this.skillSlot);
                }
                else if (this.bUseAdvanceSelect && this.effectPrefab != null && this.effectSelectActive)
                {
                    int srchR;
                    if (this.skillSlot.SlotType != SkillSlotType.SLOT_SKILL_0)
                    {
                        srchR = skill.cfgData.iMaxAttackDistance;
                    }
                    else
                    {
                        srchR = skill.GetMaxSearchDistance(this.skillSlot.GetSkillLevel());
                    }
                    uint num = 2u;
                    num      |= dwSkillTargetFilter;
                    actorRoot = Singleton <SectorTargetSearcher> .GetInstance().GetEnemyTarget(this.skillSlot.Actor, srchR, this.useSkillDirection, 50f, num);

                    if (actorRoot == null)
                    {
                        uint num2 = 1u;
                        num2     |= dwSkillTargetFilter;
                        actorRoot = Singleton <SectorTargetSearcher> .GetInstance().GetEnemyTarget(this.skillSlot.Actor, srchR, this.useSkillDirection, 50f, num2);
                    }
                }
                if (actorRoot != this.targetActor)
                {
                    this.StopCommonAttackTargetEffect(this.targetActor);
                    if (this.skillSlot.Actor && actorRoot != null && actorRoot.ObjID != this.skillSlot.Actor.handle.ObjID)
                    {
                        this.PlayCommonAttackTargetEffect(actorRoot);
                    }
                    this.targetActor = actorRoot;
                }
            }
        }