예제 #1
0
        public ActorRoot GetNearestEnemyWithoutNotInBattleJungleMonsterWithoutActor(ActorRoot InActor, int srchR, uint withOutActor)
        {
            if (InActor == null)
            {
                return(null);
            }
            ActorRoot root = null;
            ulong     num  = (ulong)(srchR * srchR);

            for (int i = 0; i < 3; i++)
            {
                if (i != InActor.TheActorMeta.ActorCamp)
                {
                    List <PoolObjHandle <ActorRoot> > campActors = Singleton <GameObjMgr> .GetInstance().GetCampActors((COM_PLAYERCAMP)i);

                    int count = campActors.Count;
                    for (int j = 0; j < count; j++)
                    {
                        PoolObjHandle <ActorRoot> handle = campActors[j];
                        ActorRoot target = handle.handle;
                        if (((target != null) && (target.ObjID != withOutActor)) && target.HorizonMarker.IsVisibleFor(InActor.TheActorMeta.ActorCamp))
                        {
                            MonsterWrapper wrapper = target.AsMonster();
                            if (wrapper != null)
                            {
                                ResMonsterCfgInfo cfgInfo = wrapper.cfgInfo;
                                if ((cfgInfo != null) && (cfgInfo.bMonsterType == 2))
                                {
                                    switch (target.ActorAgent.GetCurBehavior())
                                    {
                                    case ObjBehaviMode.State_Idle:
                                    case ObjBehaviMode.State_Dead:
                                    case ObjBehaviMode.State_Null:
                                    {
                                        continue;
                                    }
                                    }
                                }
                            }
                            VInt3 num6 = target.location - InActor.location;
                            ulong num5 = (ulong)num6.sqrMagnitudeLong2D;
                            if ((num5 < num) && InActor.CanAttack(target))
                            {
                                root = target;
                                num  = num5;
                            }
                        }
                    }
                }
            }
            return(root);
        }
예제 #2
0
        private uint GetSelectTargetByTag(AttackTargetType targetType, SelectEnemyType selectType)
        {
            List <ActorRoot> list       = new List <ActorRoot>();
            List <ActorRoot> list2      = new List <ActorRoot>();
            List <ActorRoot> list3      = new List <ActorRoot>();
            List <ActorRoot> list4      = new List <ActorRoot>();
            Player           hostPlayer = Singleton <GamePlayerCenter> .instance.GetHostPlayer();

            if (hostPlayer == null || !hostPlayer.Captain)
            {
                return(0u);
            }
            PoolObjHandle <ActorRoot>         captain    = hostPlayer.Captain;
            List <PoolObjHandle <ActorRoot> > gameActors = Singleton <GameObjMgr> .GetInstance().GameActors;

            int count = gameActors.get_Count();

            for (int i = 0; i < count; i++)
            {
                ActorRoot handle = gameActors.get_Item(i).handle;
                if (handle.HorizonMarker.IsVisibleFor(captain.handle.TheActorMeta.ActorCamp) && captain.handle.CanAttack(handle))
                {
                    if (targetType == AttackTargetType.ATTACK_TARGET_HERO)
                    {
                        if (TypeSearchCondition.Fit(handle, ActorTypeDef.Actor_Type_Hero) && DistanceSearchCondition.Fit(handle, captain, captain.handle.ActorControl.SearchRange))
                        {
                            list.Add(handle);
                        }
                    }
                    else if (TypeSearchCondition.Fit(handle, ActorTypeDef.Actor_Type_Organ))
                    {
                        if (DistanceSearchCondition.Fit(handle, captain, captain.handle.ActorControl.SearchRange))
                        {
                            list4.Add(handle);
                        }
                    }
                    else if (TypeSearchCondition.Fit(handle, ActorTypeDef.Actor_Type_Monster) && DistanceSearchCondition.Fit(handle, captain, captain.handle.ActorControl.SearchRange))
                    {
                        MonsterWrapper monsterWrapper = handle.AsMonster();
                        if (monsterWrapper.cfgInfo.bSoldierType == 7 || monsterWrapper.cfgInfo.bSoldierType == 8 || monsterWrapper.cfgInfo.bSoldierType == 9)
                        {
                            list3.Add(handle);
                        }
                        else
                        {
                            list2.Add(handle);
                        }
                    }
                }
            }
            uint lowerValueTargetIdByTag;

            if (targetType == AttackTargetType.ATTACK_TARGET_HERO)
            {
                this.SortActorListByTag(captain, ref list, selectType);
                lowerValueTargetIdByTag = this.GetLowerValueTargetIdByTag(captain, list, selectType);
            }
            else
            {
                this.SortActorListByTag(captain, ref list3, selectType);
                this.SortActorListByTag(captain, ref list2, selectType);
                this.SortActorListByTag(captain, ref list4, selectType);
                List <ActorRoot> list5 = new List <ActorRoot>();
                for (int j = 0; j < list3.get_Count(); j++)
                {
                    list5.Add(list3.get_Item(j));
                }
                for (int k = 0; k < list2.get_Count(); k++)
                {
                    list5.Add(list2.get_Item(k));
                }
                for (int l = 0; l < list4.get_Count(); l++)
                {
                    list5.Add(list4.get_Item(l));
                }
                lowerValueTargetIdByTag = this.GetLowerValueTargetIdByTag(captain, list5, selectType);
            }
            return(lowerValueTargetIdByTag);
        }
예제 #3
0
        private uint GetSelectTargetByTag(AttackTargetType targetType, SelectEnemyType selectType)
        {
            List <ActorRoot> actorList  = new List <ActorRoot>();
            List <ActorRoot> list2      = new List <ActorRoot>();
            List <ActorRoot> list3      = new List <ActorRoot>();
            List <ActorRoot> list4      = new List <ActorRoot>();
            Player           hostPlayer = Singleton <GamePlayerCenter> .instance.GetHostPlayer();

            if ((hostPlayer == null) || (hostPlayer.Captain == 0))
            {
                return(0);
            }
            PoolObjHandle <ActorRoot>         captain    = hostPlayer.Captain;
            List <PoolObjHandle <ActorRoot> > gameActors = Singleton <GameObjMgr> .GetInstance().GameActors;

            int count = gameActors.Count;

            for (int i = 0; i < count; i++)
            {
                PoolObjHandle <ActorRoot> handle2 = gameActors[i];
                ActorRoot handle = handle2.handle;
                if (handle.HorizonMarker.IsVisibleFor(captain.handle.TheActorMeta.ActorCamp) && captain.handle.CanAttack(handle))
                {
                    if (targetType == AttackTargetType.ATTACK_TARGET_HERO)
                    {
                        if (TypeSearchCondition.Fit(handle, ActorTypeDef.Actor_Type_Hero) && DistanceSearchCondition.Fit(handle, (ActorRoot)captain, captain.handle.ActorControl.SearchRange))
                        {
                            actorList.Add(handle);
                        }
                    }
                    else if (TypeSearchCondition.Fit(handle, ActorTypeDef.Actor_Type_Organ))
                    {
                        if (DistanceSearchCondition.Fit(handle, (ActorRoot)captain, captain.handle.ActorControl.SearchRange))
                        {
                            list4.Add(handle);
                        }
                    }
                    else if (TypeSearchCondition.Fit(handle, ActorTypeDef.Actor_Type_Monster) && DistanceSearchCondition.Fit(handle, (ActorRoot)captain, captain.handle.ActorControl.SearchRange))
                    {
                        MonsterWrapper wrapper = handle.AsMonster();
                        if (((wrapper.cfgInfo.bSoldierType == 7) || (wrapper.cfgInfo.bSoldierType == 8)) || (wrapper.cfgInfo.bSoldierType == 9))
                        {
                            list3.Add(handle);
                        }
                        else
                        {
                            list2.Add(handle);
                        }
                    }
                }
            }
            if (targetType == AttackTargetType.ATTACK_TARGET_HERO)
            {
                this.SortActorListByTag(captain, ref actorList, selectType);
                return(this.GetLowerValueTargetIdByTag(captain, actorList, selectType));
            }
            this.SortActorListByTag(captain, ref list3, selectType);
            this.SortActorListByTag(captain, ref list2, selectType);
            this.SortActorListByTag(captain, ref list4, selectType);
            List <ActorRoot> list6 = new List <ActorRoot>();
            int num4 = 0;

            for (num4 = 0; num4 < list3.Count; num4++)
            {
                list6.Add(list3[num4]);
            }
            for (num4 = 0; num4 < list2.Count; num4++)
            {
                list6.Add(list2[num4]);
            }
            for (num4 = 0; num4 < list4.Count; num4++)
            {
                list6.Add(list4[num4]);
            }
            return(this.GetLowerValueTargetIdByTag(captain, list6, selectType));
        }
예제 #4
0
        public ActorRoot GetNearestEnemyWithPriorityWithoutNotInBattleJungleMonsterWithoutActor(ActorRoot InActor, int srchR, TargetPriority priotity, uint withOutActor)
        {
            ActorRoot root  = null;
            ActorRoot root2 = null;
            ulong     num   = (ulong)(srchR * srchR);

            for (int i = 0; i < 3; i++)
            {
                if (i != InActor.TheActorMeta.ActorCamp)
                {
                    List <PoolObjHandle <ActorRoot> > campActors = Singleton <GameObjMgr> .GetInstance().GetCampActors((COM_PLAYERCAMP)i);

                    int count = campActors.Count;
                    for (int j = 0; j < count; j++)
                    {
                        PoolObjHandle <ActorRoot> handle = campActors[j];
                        ActorRoot target = handle.handle;
                        if (((target != null) && (target.ObjID != withOutActor)) && target.HorizonMarker.IsVisibleFor(InActor.TheActorMeta.ActorCamp))
                        {
                            MonsterWrapper wrapper = target.AsMonster();
                            if (wrapper != null)
                            {
                                ResMonsterCfgInfo cfgInfo = wrapper.cfgInfo;
                                if ((cfgInfo != null) && (cfgInfo.bMonsterType == 2))
                                {
                                    switch (target.ActorAgent.GetCurBehavior())
                                    {
                                    case ObjBehaviMode.State_Idle:
                                    case ObjBehaviMode.State_Dead:
                                    case ObjBehaviMode.State_Null:
                                    {
                                        continue;
                                    }
                                    }
                                }
                            }
                            if ((((priotity == TargetPriority.TargetPriority_Hero) && (target.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)) || ((priotity == TargetPriority.TargetPriority_Monster) && (target.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster))) || ((priotity == TargetPriority.TargetPriority_Organ) && (target.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Organ)))
                            {
                                VInt3 num7 = target.location - InActor.location;
                                ulong num5 = (ulong)num7.sqrMagnitudeLong2D;
                                if ((num5 >= num) || !InActor.CanAttack(target))
                                {
                                    continue;
                                }
                                root = target;
                                num  = num5;
                                if (priotity != TargetPriority.TargetPriority_Organ)
                                {
                                    continue;
                                }
                                break;
                            }
                            VInt3 num8 = target.location - InActor.location;
                            if ((num8.sqrMagnitudeLong2D < num) && InActor.CanAttack(target))
                            {
                                root2 = target;
                            }
                        }
                    }
                }
            }
            return((root == null) ? root2 : root);
        }
예제 #5
0
        public ActorRoot GetNearestEnemyDogfaceFirstAndDogfaceHasPriority(ActorRoot InActor, int srchR)
        {
            ActorRoot root  = null;
            ActorRoot root2 = null;
            ActorRoot root3 = null;
            ActorRoot root4 = null;
            ActorRoot root5 = null;
            ulong     num   = (ulong)(srchR * srchR);
            ulong     num2  = num;
            ulong     num3  = num;
            ulong     num4  = num;
            ulong     num5  = num;

            for (int i = 0; i < 3; i++)
            {
                if (i != InActor.TheActorMeta.ActorCamp)
                {
                    List <PoolObjHandle <ActorRoot> > campActors = Singleton <GameObjMgr> .GetInstance().GetCampActors((COM_PLAYERCAMP)i);

                    int count = campActors.Count;
                    for (int j = 0; j < count; j++)
                    {
                        PoolObjHandle <ActorRoot> handle = campActors[j];
                        ActorRoot target = handle.handle;
                        if (target.HorizonMarker.IsVisibleFor(InActor.TheActorMeta.ActorCamp))
                        {
                            if (target.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)
                            {
                                VInt3 num14 = target.location - InActor.location;
                                ulong num9  = (ulong)num14.sqrMagnitudeLong2D;
                                if ((num9 < num5) && InActor.CanAttack(target))
                                {
                                    root5 = target;
                                    num5  = num9;
                                }
                            }
                            else
                            {
                                MonsterWrapper wrapper = target.AsMonster();
                                if (wrapper != null)
                                {
                                    if (wrapper.cfgInfo.bSoldierType == 3)
                                    {
                                        VInt3 num15 = target.location - InActor.location;
                                        ulong num10 = (ulong)num15.sqrMagnitudeLong2D;
                                        if ((num10 < num) && InActor.CanAttack(target))
                                        {
                                            root = target;
                                            num  = num10;
                                        }
                                    }
                                    else if (wrapper.cfgInfo.bSoldierType == 1)
                                    {
                                        VInt3 num16 = target.location - InActor.location;
                                        ulong num11 = (ulong)num16.sqrMagnitudeLong2D;
                                        if ((num11 < num2) && InActor.CanAttack(target))
                                        {
                                            root2 = target;
                                            num2  = num11;
                                        }
                                    }
                                    else if (wrapper.cfgInfo.bSoldierType == 2)
                                    {
                                        VInt3 num17 = target.location - InActor.location;
                                        ulong num12 = (ulong)num17.sqrMagnitudeLong2D;
                                        if ((num12 < num3) && InActor.CanAttack(target))
                                        {
                                            root3 = target;
                                            num3  = num12;
                                        }
                                    }
                                    else
                                    {
                                        VInt3 num18 = target.location - InActor.location;
                                        ulong num13 = (ulong)num18.sqrMagnitudeLong2D;
                                        if ((num13 < num4) && InActor.CanAttack(target))
                                        {
                                            root4 = target;
                                            num4  = num13;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            ActorRoot root7 = null;

            if (root != null)
            {
                return(root);
            }
            if (root2 != null)
            {
                return(root2);
            }
            if (root3 != null)
            {
                return(root3);
            }
            if (root4 != null)
            {
                return(root4);
            }
            if (root5 != null)
            {
                root7 = root5;
            }
            return(root7);
        }