private void FilterNearestActor(ref PoolObjHandle <ActorRoot> _actorPtr)
 {
     if ((this.curActorPtr.handle.HorizonMarker.IsVisibleFor(_actorPtr.handle.TheActorMeta.ActorCamp) && this.curActorPtr.handle.CanAttack((ActorRoot)_actorPtr)) && ((this.curActorPtr != _actorPtr) && ((this.searchTypeMask & (((int)1) << this.curActorPtr.handle.TheActorMeta.ActorType)) <= 0)))
     {
         if (TypeSearchCondition.Fit((ActorRoot)_actorPtr, ActorTypeDef.Actor_Type_Hero))
         {
             if (DistanceSearchCondition.Fit((ActorRoot)this.curActorPtr, (ActorRoot)_actorPtr, this.searchRadius))
             {
                 this.heroFilter.Searcher((ActorRoot)this.curActorPtr, (ActorRoot)_actorPtr, new DistanceDelegate(TargetDistance.GetDistance));
             }
         }
         else if (TypeSearchCondition.Fit((ActorRoot)_actorPtr, ActorTypeDef.Actor_Type_Organ))
         {
             if (DistanceSearchCondition.Fit((ActorRoot)this.curActorPtr, (ActorRoot)_actorPtr, this.searchRadius))
             {
                 this.organFiler.Searcher((ActorRoot)this.curActorPtr, (ActorRoot)_actorPtr, new DistanceDelegate(TargetDistance.GetDistance));
             }
         }
         else if (TypeSearchCondition.Fit((ActorRoot)_actorPtr, ActorTypeDef.Actor_Type_Monster, false))
         {
             if (DistanceSearchCondition.Fit((ActorRoot)this.curActorPtr, (ActorRoot)_actorPtr, this.searchRadius))
             {
                 this.monsterFiler.Searcher((ActorRoot)this.curActorPtr, (ActorRoot)_actorPtr, new DistanceDelegate(TargetDistance.GetDistance));
             }
         }
         else if (TypeSearchCondition.Fit((ActorRoot)_actorPtr, ActorTypeDef.Actor_Type_Monster, true) && DistanceSearchCondition.Fit((ActorRoot)this.curActorPtr, (ActorRoot)_actorPtr, this.searchRadius))
         {
             this.bossFiler.Searcher((ActorRoot)this.curActorPtr, (ActorRoot)_actorPtr, new DistanceDelegate(TargetDistance.GetDistance));
         }
     }
 }
Ejemplo n.º 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> .get_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).get_handle();
                if (handle.HorizonMarker.IsVisibleFor(captain.get_handle().TheActorMeta.ActorCamp))
                {
                    if (captain.get_handle().CanAttack(handle))
                    {
                        if (targetType == AttackTargetType.ATTACK_TARGET_HERO)
                        {
                            if (TypeSearchCondition.Fit(handle, ActorTypeDef.Actor_Type_Hero) && DistanceSearchCondition.Fit(handle, captain, captain.get_handle().ActorControl.SearchRange))
                            {
                                list.Add(handle);
                            }
                        }
                        else if (TypeSearchCondition.Fit(handle, ActorTypeDef.Actor_Type_Organ))
                        {
                            if (DistanceSearchCondition.Fit(handle, captain, captain.get_handle().ActorControl.SearchRange))
                            {
                                list4.Add(handle);
                            }
                        }
                        else if (TypeSearchCondition.Fit(handle, ActorTypeDef.Actor_Type_Monster) && DistanceSearchCondition.Fit(handle, captain, captain.get_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 j = 0; j < list2.get_Count(); j++)
                {
                    list5.Add(list2.get_Item(j));
                }
                for (int j = 0; j < list4.get_Count(); j++)
                {
                    list5.Add(list4.get_Item(j));
                }
                lowerValueTargetIdByTag = this.GetLowerValueTargetIdByTag(captain, list5, selectType);
            }
            return(lowerValueTargetIdByTag);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 4
0
        public ActorRoot GetLowestHpTarget(ActorRoot InActor, int srchR, TargetPriority priotity, uint filter, bool bEnemy = true, bool bWithMonsterNotInBattle = true)
        {
            List <ActorRoot> list  = new List <ActorRoot>();
            List <ActorRoot> list2 = new List <ActorRoot>();
            List <ActorRoot> list3 = new List <ActorRoot>();
            TargetPropertyLessEqualFilter filter2 = new TargetPropertyLessEqualFilter(list, ulong.MaxValue);
            TargetPropertyLessEqualFilter filter3 = new TargetPropertyLessEqualFilter(list2, ulong.MaxValue);
            TargetDistanceNearFilter      filter4 = new TargetDistanceNearFilter(ulong.MaxValue);

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

                        int num2 = campActors.Count;
                        for (int j = 0; j < num2; j++)
                        {
                            PoolObjHandle <ActorRoot> handle2 = campActors[j];
                            ActorRoot target = handle2.handle;
                            if ((((filter & (((int)1) << target.TheActorMeta.ActorType)) <= 0L) && target.HorizonMarker.IsVisibleFor(InActor.TheActorMeta.ActorCamp)) && InActor.CanAttack(target))
                            {
                                if (TypeSearchCondition.Fit(target, ActorTypeDef.Actor_Type_Hero))
                                {
                                    if (DistanceSearchCondition.Fit(target, InActor, srchR))
                                    {
                                        filter2.Searcher(target, RES_FUNCEFT_TYPE.RES_FUNCEFT_MAXHP, new PropertyDelegate(TargetProperty.GetPropertyHpRate));
                                    }
                                }
                                else if (TypeSearchCondition.Fit(target, ActorTypeDef.Actor_Type_Organ))
                                {
                                    if (DistanceSearchCondition.Fit(target, InActor, srchR))
                                    {
                                        list3.Add(target);
                                    }
                                }
                                else if ((TypeSearchCondition.Fit(target, ActorTypeDef.Actor_Type_Monster) && TypeSearchCondition.FitWithJungleMonsterNotInBattle(target, bWithMonsterNotInBattle)) && DistanceSearchCondition.Fit(target, InActor, srchR))
                                {
                                    filter3.Searcher(target, RES_FUNCEFT_TYPE.RES_FUNCEFT_MAXHP, new PropertyDelegate(TargetProperty.GetPropertyHpRate));
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                List <PoolObjHandle <ActorRoot> > list5 = Singleton <GameObjMgr> .GetInstance().GetCampActors(InActor.TheActorMeta.ActorCamp);

                int num4 = list5.Count;
                for (int k = 0; k < num4; k++)
                {
                    PoolObjHandle <ActorRoot> handle3 = list5[k];
                    ActorRoot root2 = handle3.handle;
                    if ((((filter & (((int)1) << root2.TheActorMeta.ActorType)) <= 0L) && !root2.ActorControl.IsDeadState) && root2.HorizonMarker.IsVisibleFor(InActor.TheActorMeta.ActorCamp))
                    {
                        if (TypeSearchCondition.Fit(root2, ActorTypeDef.Actor_Type_Hero))
                        {
                            if (DistanceSearchCondition.Fit(root2, InActor, srchR))
                            {
                                filter2.Searcher(root2, RES_FUNCEFT_TYPE.RES_FUNCEFT_MAXHP, new PropertyDelegate(TargetProperty.GetPropertyHpRate));
                            }
                        }
                        else if (TypeSearchCondition.Fit(root2, ActorTypeDef.Actor_Type_Organ))
                        {
                            if (DistanceSearchCondition.Fit(root2, InActor, srchR))
                            {
                                list3.Add(root2);
                            }
                        }
                        else if (TypeSearchCondition.Fit(root2, ActorTypeDef.Actor_Type_Monster) && DistanceSearchCondition.Fit(root2, InActor, srchR))
                        {
                            filter3.Searcher(root2, RES_FUNCEFT_TYPE.RES_FUNCEFT_MAXHP, new PropertyDelegate(TargetProperty.GetPropertyHpRate));
                        }
                    }
                }
            }
            int num6  = (list.Count + list3.Count) + list2.Count;
            int count = list.Count;

            if (count > 0)
            {
                ActorRoot root3 = null;
                if (count == 1)
                {
                    root3 = list[0];
                }
                else
                {
                    root3 = filter4.Searcher(list.GetEnumerator(), InActor);
                }
                PoolObjHandle <ActorRoot> selfPtr = new PoolObjHandle <ActorRoot>();
                if (root3 != null)
                {
                    selfPtr = root3.SelfPtr;
                }
                SkillChooseTargetEventParam prm = new SkillChooseTargetEventParam(selfPtr, InActor.SelfPtr, num6);
                Singleton <GameEventSys> .instance.SendEvent <SkillChooseTargetEventParam>(GameEventDef.Event_ActorBeChosenAsTarget, ref prm);

                return(root3);
            }
            count = list3.Count;
            if (count > 0)
            {
                if (count == 1)
                {
                    return(list3[0]);
                }
                return(filter4.Searcher(list3.GetEnumerator(), InActor));
            }
            count = list2.Count;
            if (count <= 0)
            {
                return(null);
            }
            if (count == 1)
            {
                return(list2[0]);
            }
            return(filter4.Searcher(list2.GetEnumerator(), InActor));
        }
Ejemplo n.º 5
0
        private ActorRoot GetNextSkillTarget(SkillSlot UseSlot)
        {
            for (int i = 0; i < UseSlot.NextSkillTargetIDs.Count; i++)
            {
                ActorRoot actorRoot = Singleton <GameObjMgr> .GetInstance().GetActor(UseSlot.NextSkillTargetIDs[i]);

                if (actorRoot != null && ((ulong)UseSlot.SkillObj.cfgData.dwSkillTargetFilter & 1uL << (int)(actorRoot.TheActorMeta.ActorType & (ActorTypeDef)31)) <= 0uL && actorRoot.HorizonMarker.IsVisibleFor(UseSlot.Actor.handle.TheActorMeta.ActorCamp) && UseSlot.Actor.handle.CanAttack(actorRoot) && DistanceSearchCondition.Fit(actorRoot, UseSlot.Actor.handle, UseSlot.SkillObj.GetMaxSearchDistance(UseSlot.GetSkillLevel())))
                {
                    return(actorRoot);
                }
            }
            return(null);
        }
 private void FilterNearestCanTeleportActorByPosition(ref PoolObjHandle <ActorRoot> _actorPtr)
 {
     if (!this.curActorPtr.get_handle().CanTeleport(_actorPtr) || this.curActorPtr == _actorPtr)
     {
         return;
     }
     if (TypeSearchCondition.Fit(_actorPtr, ActorTypeDef.Actor_Type_Hero))
     {
         if (DistanceSearchCondition.Fit(this.searchPosition, _actorPtr, this.searchRadius))
         {
             this.heroFilter.Searcher(this.searchPosition, _actorPtr, new DistanceDelegate(TargetDistance.GetDistance));
         }
     }
     else if (TypeSearchCondition.Fit(_actorPtr, ActorTypeDef.Actor_Type_Organ))
     {
         if (DistanceSearchCondition.Fit(this.searchPosition, _actorPtr, this.searchRadius))
         {
             this.organFiler.Searcher(this.searchPosition, _actorPtr, new DistanceDelegate(TargetDistance.GetDistance));
         }
     }
     else if (TypeSearchCondition.Fit(_actorPtr, ActorTypeDef.Actor_Type_EYE, false) && DistanceSearchCondition.Fit(this.searchPosition, _actorPtr, this.searchRadius))
     {
         this.eyeFiler.Searcher(this.searchPosition, _actorPtr, new DistanceDelegate(TargetDistance.GetDistance));
     }
 }