public ActorRoot GetNearRandomEnemy(ActorRoot InActor, int srchR) { 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.HorizonMarker.IsVisibleFor(InActor.TheActorMeta.ActorCamp)) { VInt3 num6 = target.location - InActor.location; if ((num6.sqrMagnitudeLong2D < num) && InActor.CanAttack(target)) { return(target); } } } } } return(null); }
public ActorRoot GetAnyEnemyInCircle(ActorRoot InActor, VInt3 Pos, int srchR) { long num = 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 (InActor.CanAttack(target)) { VInt3 num6 = target.location - Pos; if (num6.sqrMagnitudeLong2D < num) { return(target); } } } } } return(null); }
public ActorRoot GetNearestEnemyIgnoreVisible(ActorRoot InActor, int srchR, uint filter) { 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 ((filter & (((int)1) << target.TheActorMeta.ActorType)) <= 0L) { VInt3 num6 = target.location - InActor.location; ulong num5 = (ulong)num6.sqrMagnitudeLong2D; if ((num5 < num) && InActor.CanAttack(target)) { root = target; num = num5; } } } } } return(root); }
public ActorRoot GetNearestEnemyDogfaceFirst(ActorRoot InActor, int srchR) { ActorRoot root = null; ActorRoot root2 = null; ulong num = (ulong)(srchR * srchR); ulong num2 = (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.HorizonMarker.IsVisibleFor(InActor.TheActorMeta.ActorCamp)) { if (target.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) { VInt3 num8 = target.location - InActor.location; ulong num6 = (ulong)num8.sqrMagnitudeLong2D; if ((num6 < num) && InActor.CanAttack(target)) { root = target; num = num6; } } else { VInt3 num9 = target.location - InActor.location; ulong num7 = (ulong)num9.sqrMagnitudeLong2D; if ((num7 < num2) && InActor.CanAttack(target)) { root2 = target; num2 = num7; } } } } } } return((root2 == null) ? root : root2); }
public ActorRoot GetNearestEnemy(ActorRoot InActor, int srchR, TargetPriority priotity, uint filter) { ActorRoot root = null; ActorRoot root2 = null; ulong num = (ulong) (srchR * srchR); ulong num2 = 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 (((filter & (((int) 1) << target.TheActorMeta.ActorType)) <= 0L) && target.HorizonMarker.IsVisibleFor(InActor.TheActorMeta.ActorCamp)) { 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 num8 = target.location - InActor.location; ulong num6 = (ulong) num8.sqrMagnitudeLong2D; if ((num6 < num) && InActor.CanAttack(target)) { root = target; num = num6; } } else { VInt3 num9 = target.location - InActor.location; ulong num7 = (ulong) num9.sqrMagnitudeLong2D; if ((num7 < num2) && InActor.CanAttack(target)) { root2 = target; num2 = num7; } } } } } } return ((root == null) ? root2 : root); }
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); }
public ActorRoot GetNearestEnemy(ActorRoot InActor, int srchR, uint filter, bool bWithMonsterNotInBattle = true) { 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 (((filter & (((int)1) << target.TheActorMeta.ActorType)) <= 0L) && target.HorizonMarker.IsVisibleFor(InActor.TheActorMeta.ActorCamp)) { if (!bWithMonsterNotInBattle) { MonsterWrapper actorControl = target.ActorControl as MonsterWrapper; if (actorControl != null) { ResMonsterCfgInfo cfgInfo = actorControl.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); }
public ActorRoot GetEnemyTarget(ActorRoot InActor, int srchR, Vector3 useDirection, float srchAngle, uint filter) { ActorRoot result = null; ulong num = (ulong)((long)srchR * (long)srchR); float num2 = srchAngle; for (int i = 0; i < 3; i++) { if (i != InActor.TheActorMeta.ActorCamp) { List <PoolObjHandle <ActorRoot> > campActors = Singleton <GameObjMgr> .GetInstance().GetCampActors(i); int count = campActors.get_Count(); for (int j = 0; j < count; j++) { ActorRoot handle = campActors.get_Item(j).get_handle(); if (((ulong)filter & (ulong)(1L << (int)(handle.TheActorMeta.ActorType & (ActorTypeDef)31))) <= 0uL && !handle.ActorControl.IsDeadState && handle.HorizonMarker.IsVisibleFor(InActor.TheActorMeta.ActorCamp) && InActor.CanAttack(handle)) { ulong sqrMagnitudeLong2D = (ulong)(handle.location - InActor.location).get_sqrMagnitudeLong2D(); if (sqrMagnitudeLong2D < num) { float num3 = Mathf.Abs(Vector3.Angle(useDirection, ((Vector3)(handle.location - InActor.location)).normalized)); if (num3 < num2) { num2 = num3; result = handle; } } } } } } return(result); }
public ActorRoot GetEnemyTarget(ActorRoot InActor, int srchR, Vector3 useDirection, float srchAngle, uint filter) { ActorRoot root = null; ulong num = (ulong)(srchR * srchR); float num2 = srchAngle; 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 (((((filter & (((int)1) << target.TheActorMeta.ActorType)) <= 0L) && !target.ActorControl.IsDeadState) && target.HorizonMarker.IsVisibleFor(InActor.TheActorMeta.ActorCamp)) && InActor.CanAttack(target)) { VInt3 num8 = target.location - InActor.location; if (num8.sqrMagnitudeLong2D < num) { Vector3 vector = (Vector3)(target.location - InActor.location); float num7 = Mathf.Abs(Vector3.Angle(useDirection, vector.normalized)); if (num7 < num2) { num2 = num7; root = target; } } } } } } return(root); }
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); }
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); }
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)); }