private void FilterNearestCanTeleportActorByPosition(ref PoolObjHandle <ActorRoot> _actorPtr) { if (!this.curActorPtr.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)) { if (DistanceSearchCondition.Fit(this.searchPosition, _actorPtr, this.searchRadius)) { this.eyeFiler.Searcher(this.searchPosition, _actorPtr, new DistanceDelegate(TargetDistance.GetDistance)); } } else if (TypeSearchCondition.FitSoldier(_actorPtr) && DistanceSearchCondition.Fit(this.searchPosition, _actorPtr, this.searchRadius)) { this.soldierFilter.Searcher(this.searchPosition, _actorPtr, new DistanceDelegate(TargetDistance.GetDistance)); } }
private void FilterNearestActorByPosition(ref PoolObjHandle <ActorRoot> _actorPtr) { if (!_actorPtr.handle.HorizonMarker.IsVisibleFor(this.curActorPtr.handle.TheActorMeta.ActorCamp) || !this.curActorPtr.handle.CanAttack(_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_Monster, false)) { if (DistanceSearchCondition.Fit(this.searchPosition, _actorPtr, this.searchRadius)) { this.monsterFiler.Searcher(this.searchPosition, _actorPtr, new DistanceDelegate(TargetDistance.GetDistance)); } } else if (TypeSearchCondition.Fit(_actorPtr, ActorTypeDef.Actor_Type_Monster, true) && DistanceSearchCondition.Fit(this.searchPosition, _actorPtr, this.searchRadius)) { this.bossFiler.Searcher(this.searchPosition, _actorPtr, new DistanceDelegate(TargetDistance.GetDistance)); } }
private void FilterNearestActor(ref PoolObjHandle <ActorRoot> _actorPtr) { if ((_actorPtr.handle.HorizonMarker.IsVisibleFor(this.curActorPtr.handle.TheActorMeta.ActorCamp) && this.curActorPtr.handle.CanAttack((ActorRoot)_actorPtr)) && ((this.curActorPtr != _actorPtr) && ((this.searchTypeMask & (((int)1) << this.curActorPtr.handle.TheActorMeta.ActorType)) <= 0L))) { 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)); } } }
private void FilterLowestHpActor(ref PoolObjHandle <ActorRoot> _actorPtr) { if (!_actorPtr.handle.HorizonMarker.IsVisibleFor(this.curActorPtr.handle.TheActorMeta.ActorCamp) || !this.curActorPtr.handle.CanAttack(_actorPtr) || this.curActorPtr == _actorPtr || ((ulong)this.searchTypeMask & 1uL << (int)(this.curActorPtr.handle.TheActorMeta.ActorType & (ActorTypeDef)31)) > 0uL) { return; } if (TypeSearchCondition.Fit(_actorPtr, ActorTypeDef.Actor_Type_Hero)) { if (DistanceSearchCondition.Fit(this.curActorPtr, _actorPtr, this.searchRadius)) { this.heroFilter.Searcher(_actorPtr, RES_FUNCEFT_TYPE.RES_FUNCEFT_MAXHP, new PropertyDelegate(TargetProperty.GetPropertyHpRate)); } } else if (TypeSearchCondition.Fit(_actorPtr, ActorTypeDef.Actor_Type_Organ)) { if (DistanceSearchCondition.Fit(this.curActorPtr, _actorPtr, this.searchRadius)) { this.organFiler.Searcher(_actorPtr, RES_FUNCEFT_TYPE.RES_FUNCEFT_MAXHP, new PropertyDelegate(TargetProperty.GetPropertyHpRate)); } } else if (TypeSearchCondition.Fit(_actorPtr, ActorTypeDef.Actor_Type_Monster, false)) { if (DistanceSearchCondition.Fit(this.curActorPtr, _actorPtr, this.searchRadius)) { if (this.MonsterNotInBattle(ref _actorPtr)) { this.monsterNotInBattleFiler.Searcher(_actorPtr, RES_FUNCEFT_TYPE.RES_FUNCEFT_MAXHP, new PropertyDelegate(TargetProperty.GetPropertyHpRate)); } else { this.monsterFiler.Searcher(_actorPtr, RES_FUNCEFT_TYPE.RES_FUNCEFT_MAXHP, new PropertyDelegate(TargetProperty.GetPropertyHpRate)); } } } else if (TypeSearchCondition.Fit(_actorPtr, ActorTypeDef.Actor_Type_Monster, true) && DistanceSearchCondition.Fit(this.curActorPtr, _actorPtr, this.searchRadius)) { this.bossFiler.Searcher(_actorPtr, RES_FUNCEFT_TYPE.RES_FUNCEFT_MAXHP, new PropertyDelegate(TargetProperty.GetPropertyHpRate)); } }
private void FilterNearestActor(ref PoolObjHandle <ActorRoot> _actorPtr) { if (!_actorPtr.get_handle().HorizonMarker.IsVisibleFor(this.curActorPtr.get_handle().TheActorMeta.ActorCamp) || !this.curActorPtr.get_handle().CanAttack(_actorPtr) || this.curActorPtr == _actorPtr || ((ulong)this.searchTypeMask & (ulong)(1L << (int)(this.curActorPtr.get_handle().TheActorMeta.ActorType & (ActorTypeDef)31))) > 0uL) { return; } if (TypeSearchCondition.Fit(_actorPtr, ActorTypeDef.Actor_Type_Hero)) { if (DistanceSearchCondition.Fit(this.curActorPtr, _actorPtr, this.searchRadius)) { this.heroFilter.Searcher(this.curActorPtr, _actorPtr, new DistanceDelegate(TargetDistance.GetDistance)); } } else if (TypeSearchCondition.Fit(_actorPtr, ActorTypeDef.Actor_Type_Organ)) { if (DistanceSearchCondition.Fit(this.curActorPtr, _actorPtr, this.searchRadius)) { this.organFiler.Searcher(this.curActorPtr, _actorPtr, new DistanceDelegate(TargetDistance.GetDistance)); } } else if (TypeSearchCondition.Fit(_actorPtr, ActorTypeDef.Actor_Type_Monster, false)) { if (DistanceSearchCondition.Fit(this.curActorPtr, _actorPtr, this.searchRadius)) { if (this.MonsterNotInBattle(ref _actorPtr)) { this.monsterNotInBattleFiler.Searcher(this.curActorPtr, _actorPtr, new DistanceDelegate(TargetDistance.GetDistance)); } else { this.monsterFiler.Searcher(this.curActorPtr, _actorPtr, new DistanceDelegate(TargetDistance.GetDistance)); } } } else if (TypeSearchCondition.Fit(_actorPtr, ActorTypeDef.Actor_Type_Monster, true) && DistanceSearchCondition.Fit(this.curActorPtr, _actorPtr, this.searchRadius)) { this.bossFiler.Searcher(this.curActorPtr, _actorPtr, new DistanceDelegate(TargetDistance.GetDistance)); } }
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); }
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)); }
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)); }