public void SetArmy(KaijuArmy kaijuArmy) { this.KaijuArmy = kaijuArmy; this.KaijuArmy.Kaiju = this; this.kaijuArmyGUID = kaijuArmy.GUID; DepartmentOfDefense agency = this.Empire.GetAgency <DepartmentOfDefense>(); agency.AddArmy(this.KaijuArmy); this.KaijuArmy.StandardUnitCollectionChange += this.KaijuArmy_StandardUnitCollectionChange; }
public IEnumerator OnLoadGame(Amplitude.Unity.Game.Game game) { IGameEntityRepositoryService service = game.Services.GetService <IGameEntityRepositoryService>(); if (this.kaijuArmyGUID != GameEntityGUID.Zero) { Army army = this.Empire.GetAgency <DepartmentOfDefense>().GetArmy(this.kaijuArmyGUID); if (army != null && army is KaijuArmy) { KaijuArmy kaijuArmy = army as KaijuArmy; if (kaijuArmy != null) { this.SetArmy(kaijuArmy); } } } if (this.KaijuGarrison != null) { if (this.OnGarrisonMode()) { Region region = game.Services.GetService <IWorldPositionningService>().GetRegion(this.KaijuGarrison.WorldPosition); this.Region = region; this.Region.KaijuGarrisonGUID = this.KaijuGarrison.GUID; this.Region.KaijuEmpire = this.KaijuGarrison.KaijuEmpire; } } else { Diagnostics.LogError("KaijuGarrison was not loaded properly."); } if (this.OnGarrisonMode()) { service.Register(this.KaijuGarrison); service.Unregister(this.KaijuArmy); this.HideKaijuArmyFromMap(); this.Empire.RemoveChild(this.KaijuArmy); } else if (this.OnArmyMode()) { service.Register(this.KaijuArmy); service.Unregister(this.KaijuGarrison); this.ShowKaijuArmyInMap(); } this.RegisterTroops(); this.ComputeNextTurnToRecoverFromStun(); this.ComputeNextTurnToSpawnUnits(false); this.KaijuArmy.ForceWorldOrientation(this.WorldOrientation); this.KaijuGarrison.ForceWorldOrientation(this.WorldOrientation); yield break; }
public override bool CanExecute(Army army, ref List <StaticString> failureFlags, params object[] parameters) { if (!base.CanExecute(army, ref failureFlags, parameters)) { return(false); } if (army.IsNaval) { failureFlags.Add(ArmyAction.NoCanDoWhileHidden); return(false); } KaijuArmy kaijuArmy = army as KaijuArmy; if (kaijuArmy == null) { return(false); } if (!base.CanAfford(army)) { failureFlags.Add(ArmyAction.NoCanDoWhileCannotAffordCosts); return(false); } if (!base.CheckActionPointsPrerequisites(army)) { failureFlags.Add(ArmyAction.NoCanDoWhileNotEnoughActionPointsLeft); return(false); } if (army.IsInEncounter) { if (failureFlags != null) { failureFlags.Add(ArmyAction.NoCanDoWhileLockedInBattle); } return(false); } Kaiju kaiju = kaijuArmy.Kaiju; if (Services.GetService <IGameService>().Game.Services.GetService <IWorldPositionningService>().IsWaterTile(kaijuArmy.WorldPosition)) { failureFlags.Add(ArmyAction.NoCanDoWhileOnFrozenWaterTile); return(false); } if (kaiju.CanChangeToGarrisonMode()) { return(true); } failureFlags.Add(ArmyAction_SettleKaiju.NoCanDoWhileRegionIsOwned); return(false); }
public void SpawnKaiju(WorldPosition targetPosition, GameEntityGUID kaijuGUID, GameEntityGUID garrisonGUID, GameEntityGUID armyGUID, GameEntityGUID monsterGUID, GameEntityGUID[] licesGUIDs) { Kaiju kaiju = new Kaiju(base.Empire as KaijuEmpire, kaijuGUID); string[] kaijuDescriptors = this.KaijuEmpire.KaijuFaction.KaijuDescriptors; for (int i = 0; i < kaijuDescriptors.Length; i++) { SimulationDescriptor descriptor = null; if (this.descriptorsDatabase.TryGetValue(kaijuDescriptors[i], out descriptor)) { kaiju.AddDescriptor(descriptor, false); } } KaijuGarrison kaijuGarrison = new KaijuGarrison(garrisonGUID, targetPosition); SimulationDescriptor value = this.descriptorsDatabase.GetValue(Kaiju.ClassKaijuGarrison); kaijuGarrison.AddDescriptor(value, false); kaijuGarrison.SetPropertyBaseValue(SimulationProperties.MaximumUnitSlotCount, (float)(licesGUIDs.Length + 1)); kaiju.SetGarrison(kaijuGarrison); KaijuArmy kaijuArmy = this.departmentOfDefense.CreateKaijuArmy(armyGUID, targetPosition, true); SimulationDescriptor value2 = this.descriptorsDatabase.GetValue(Kaiju.ClassKaijuArmy); kaijuArmy.AddDescriptor(value2, false); kaijuArmy.SetPropertyBaseValue(SimulationProperties.MaximumUnitSlotCount, (float)(licesGUIDs.Length + 1)); kaiju.SetArmy(kaijuArmy); this.gameEntityRepositoryService.Register(kaijuArmy); this.gameEntityRepositoryService.Register(kaiju); kaiju.ChangeToWildState(); kaiju.ChangeToGarrisonMode(false); Unit unit = DepartmentOfDefense.CreateUnitByDesign(monsterGUID, this.KaijuEmpire.FindMonsterDesign(true)); kaiju.AddUnit(unit); for (int j = 0; j < licesGUIDs.Length; j++) { Unit unit2 = DepartmentOfDefense.CreateUnitByDesign(licesGUIDs[j], this.KaijuEmpire.FindLiceDesign(true)); kaiju.AddUnit(unit2); } this.lastLiceArmySpawnTurn = (this.gameService.Game as global::Game).Turn; this.Kaiju = kaiju; this.KaijuEmpire.AddKaiju(kaiju); kaiju.Refresh(false); foreach (global::Empire empire in (this.gameService.Game as global::Game).Empires) { if (empire is MajorEmpire) { this.eventService.Notify(new EventKaijuSpawned(empire, this.Kaiju)); } } }
public override void Execute(Army army, global::PlayerController playerController, out Ticket ticket, EventHandler <TicketRaisedEventArgs> ticketRaisedEventHandler, params object[] parameters) { ticket = null; ArmyAction.FailureFlags.Clear(); if (army is KaijuArmy) { KaijuArmy kaijuArmy = army as KaijuArmy; if (kaijuArmy != null) { OrderKaijuChangeMode order = new OrderKaijuChangeMode(kaijuArmy.Kaiju, true, false, true); Diagnostics.Assert(playerController != null); playerController.PostOrder(order, out ticket, ticketRaisedEventHandler); } } }
public void FillTargets(Army army, List <IGameEntity> gameEntities, ref List <StaticString> failureFlags) { if (army == null) { throw new ArgumentNullException("army"); } IGameService service = Services.GetService <IGameService>(); if (service == null) { return; } global::Game x = service.Game as global::Game; if (x == null) { return; } IWorldPositionningService service2 = service.Game.Services.GetService <IWorldPositionningService>(); Diagnostics.Assert(service2 != null); for (int i = 0; i < 6; i++) { WorldPosition neighbourTile = service2.GetNeighbourTile(army.WorldPosition, (WorldOrientation)i, 1); Region region = service2.GetRegion(neighbourTile); if (region != null && region.Kaiju != null) { Kaiju kaiju = region.Kaiju; if (this.IsKaijuValidForTame(army, kaiju, ref failureFlags, true) && !gameEntities.Contains(kaiju)) { gameEntities.Add(kaiju); } } Army armyAtPosition = service2.GetArmyAtPosition(neighbourTile); if (armyAtPosition != null && armyAtPosition is KaijuArmy) { KaijuArmy kaijuArmy = armyAtPosition as KaijuArmy; if (kaijuArmy != null) { Kaiju kaiju2 = kaijuArmy.Kaiju; if (kaiju2 != null && kaiju2.OnArmyMode() && !kaiju2.IsStunned() && !gameEntities.Contains(kaiju2)) { gameEntities.Add(kaijuArmy.Kaiju); } } } } }
public StaticString GetKaijuTypeDefinitionName(Army army) { StaticString result = "Kaiju1"; if (army is KaijuArmy) { KaijuArmy kaijuArmy = army as KaijuArmy; Kaiju kaiju = kaijuArmy.Kaiju; if (kaiju.SimulationObject.Tags.Contains("Kaiju1")) { result = "KaijuType1"; } else if (kaiju.SimulationObject.Tags.Contains("Kaiju2")) { result = "KaijuType2"; } else if (kaiju.SimulationObject.Tags.Contains("Kaiju3")) { result = "KaijuType3"; } } return(result); }
protected override State Execute(AIBehaviorTree aiBehaviorTree, params object[] parameters) { if (this.ticket != null) { if (!this.orderExecuted) { return(State.Running); } if (this.ticket.PostOrderResponse == PostOrderResponse.PreprocessHasFailed) { this.orderExecuted = false; this.ticket = null; aiBehaviorTree.ErrorCode = 1; return(State.Failure); } this.orderExecuted = false; this.ticket = null; return(State.Success); } else { Army army; if (base.GetArmyUnlessLocked(aiBehaviorTree, "$Army", out army) != AIArmyMission.AIArmyMissionErrorCode.None) { return(State.Failure); } float propertyValue = army.GetPropertyValue(SimulationProperties.MaximumNumberOfActionPoints); float propertyValue2 = army.GetPropertyValue(SimulationProperties.ActionPointsSpent); if (propertyValue <= propertyValue2) { aiBehaviorTree.ErrorCode = 33; return(State.Failure); } if (!aiBehaviorTree.Variables.ContainsKey(this.TargetVarName)) { aiBehaviorTree.LogError("${0} not set", new object[] { this.TargetVarName }); return(State.Failure); } IGameEntity target = aiBehaviorTree.Variables[this.TargetVarName] as IGameEntity; if (!(target is IWorldPositionable)) { return(State.Failure); } IGameService service = Services.GetService <IGameService>(); Diagnostics.Assert(service != null); if (!service.Game.Services.GetService <IGameEntityRepositoryService>().Contains(target.GUID)) { return(State.Success); } IWorldPositionningService service2 = service.Game.Services.GetService <IWorldPositionningService>(); IEnumerable <Encounter> service3 = service.Game.Services.GetService <IEncounterRepositoryService>(); if (service3 != null && service3.Any((Encounter encounter) => encounter.IsGarrisonInEncounter(army.GUID, false) || encounter.IsGarrisonInEncounter(target.GUID, false))) { return(State.Running); } IGarrison garrison; if (target is Kaiju) { Kaiju kaiju = target as Kaiju; garrison = kaiju.GetActiveTroops(); if (kaiju.IsStunned()) { return(State.Failure); } } else { if (target is KaijuArmy) { KaijuArmy kaijuArmy = target as KaijuArmy; if (kaijuArmy != null && kaijuArmy.Kaiju.IsStunned()) { return(State.Failure); } } else if (target is KaijuGarrison) { KaijuGarrison kaijuGarrison = target as KaijuGarrison; if (kaijuGarrison != null && kaijuGarrison.Kaiju.IsStunned()) { return(State.Failure); } } garrison = (target as IGarrison); if (garrison == null) { return(State.Failure); } } if ((army.Empire is MinorEmpire || army.Empire is NavalEmpire) && garrison.Hero != null && garrison.Hero.IsSkillUnlocked("HeroSkillLeaderMap07")) { return(State.Failure); } if (garrison.Empire.Index == aiBehaviorTree.AICommander.Empire.Index) { return(State.Failure); } this.orderExecuted = false; GameEntityGUID guid = target.GUID; if (target is City) { Diagnostics.Assert(AIScheduler.Services != null); IEntityInfoAIHelper service4 = AIScheduler.Services.GetService <IEntityInfoAIHelper>(); Diagnostics.Assert(service4 != null); City city = target as City; if (city.BesiegingEmpire != null && city.BesiegingEmpire != aiBehaviorTree.AICommander.Empire) { return(State.Failure); } District districtToAttackFrom = service4.GetDistrictToAttackFrom(army, city); if (districtToAttackFrom == null) { aiBehaviorTree.ErrorCode = 12; return(State.Failure); } guid = districtToAttackFrom.GUID; } else if (target is Camp) { Camp camp = target as Camp; IWorldPositionable worldPositionable = target as IWorldPositionable; if (worldPositionable == null) { return(State.Failure); } if (service2.GetDistance(army.WorldPosition, worldPositionable.WorldPosition) != 1) { aiBehaviorTree.ErrorCode = 12; return(State.Failure); } guid = camp.GUID; } else if (target is Fortress) { guid = target.GUID; } else { Village village = target as Village; if (village != null && (village.HasBeenPacified || (village.HasBeenConverted && village.Converter == aiBehaviorTree.AICommander.Empire) || village.HasBeenInfected)) { return(State.Failure); } Diagnostics.Assert(AIScheduler.Services != null); IWorldPositionable worldPositionable2 = target as IWorldPositionable; if (worldPositionable2 == null) { return(State.Failure); } District district = service2.GetDistrict(worldPositionable2.WorldPosition); if (district != null && District.IsACityTile(district) && district.City.Empire == garrison.Empire) { worldPositionable2 = district; guid = district.GUID; } if (service2.GetDistance(army.WorldPosition, worldPositionable2.WorldPosition) != 1) { aiBehaviorTree.ErrorCode = 12; return(State.Failure); } } OrderAttack order = new OrderAttack(army.Empire.Index, army.GUID, guid); aiBehaviorTree.AICommander.Empire.PlayerControllers.AI.PostOrder(order, out this.ticket, new EventHandler <TicketRaisedEventArgs>(this.Order_TicketRaised)); return(State.Running); } }
public void CleanAfterEncounter(KaijuArmy kaijuArmy, Encounter encounter) { this.CleanAfterEncounter(kaijuArmy.Kaiju, kaijuArmy.GUID, encounter); }
protected override State Execute(AIBehaviorTree aiBehaviorTree, params object[] parameters) { if (this.ticket != null) { if (!this.ticket.Raised) { return(State.Running); } if (this.ticket.PostOrderResponse == PostOrderResponse.PreprocessHasFailed) { this.ticket = null; aiBehaviorTree.ErrorCode = 1; return(State.Failure); } this.ticket = null; return(State.Success); } else { Army army; if (base.GetArmyUnlessLocked(aiBehaviorTree, "$Army", out army) != AIArmyMission.AIArmyMissionErrorCode.None) { return(State.Failure); } float propertyValue = army.GetPropertyValue(SimulationProperties.MaximumNumberOfActionPoints); float propertyValue2 = army.GetPropertyValue(SimulationProperties.ActionPointsSpent); if (propertyValue <= propertyValue2) { aiBehaviorTree.ErrorCode = 33; return(State.Failure); } if (!aiBehaviorTree.Variables.ContainsKey(this.TargetVarName)) { aiBehaviorTree.LogError("${0} not set", new object[] { this.TargetVarName }); return(State.Failure); } IGameEntity gameEntity = aiBehaviorTree.Variables[this.TargetVarName] as IGameEntity; if (!(gameEntity is IWorldPositionable)) { return(State.Failure); } IGameService service = Services.GetService <IGameService>(); Diagnostics.Assert(service != null); if (!service.Game.Services.GetService <IGameEntityRepositoryService>().Contains(gameEntity.GUID)) { return(State.Success); } IEncounterRepositoryService service2 = service.Game.Services.GetService <IEncounterRepositoryService>(); if (service2 != null) { IEnumerable <Encounter> enumerable = service2; if (enumerable != null && enumerable.Any((Encounter encounter) => encounter.IsGarrisonInEncounter(army.GUID, false))) { return(State.Running); } } IGarrison garrison; if (gameEntity is Kaiju) { Kaiju kaiju = gameEntity as Kaiju; garrison = kaiju.GetActiveTroops(); if (kaiju.IsStunned()) { return(State.Failure); } } else { if (gameEntity is KaijuArmy) { KaijuArmy kaijuArmy = gameEntity as KaijuArmy; if (kaijuArmy != null && kaijuArmy.Kaiju.IsStunned()) { return(State.Failure); } } else if (gameEntity is KaijuGarrison) { KaijuGarrison kaijuGarrison = gameEntity as KaijuGarrison; if (kaijuGarrison != null && kaijuGarrison.Kaiju.IsStunned()) { return(State.Failure); } } garrison = (gameEntity as IGarrison); } if (garrison == null) { return(State.Failure); } if ((army.Empire is MinorEmpire || army.Empire is NavalEmpire) && garrison.Hero != null && garrison.Hero.IsSkillUnlocked("HeroSkillLeaderMap07")) { return(State.Failure); } if (garrison.Empire.Index == aiBehaviorTree.AICommander.Empire.Index) { return(State.Failure); } GameEntityGUID guid = gameEntity.GUID; if (!aiBehaviorTree.Variables.ContainsKey(this.PathVarName)) { aiBehaviorTree.LogError("{0} not set", new object[] { this.PathVarName }); return(State.Failure); } WorldPath worldPath = aiBehaviorTree.Variables[this.PathVarName] as WorldPath; if (worldPath == null || worldPath.Length < 2) { aiBehaviorTree.LogError("Path is null.", new object[0]); aiBehaviorTree.ErrorCode = 3; return(State.Failure); } if (!worldPath.IsValid) { aiBehaviorTree.ErrorCode = 3; return(State.Failure); } OrderGoToAndAttack orderGoToAndAttack = new OrderGoToAndAttack(army.Empire.Index, army.GUID, guid, worldPath); orderGoToAndAttack.Flags = PathfindingFlags.IgnoreFogOfWar; aiBehaviorTree.AICommander.Empire.PlayerControllers.AI.PostOrder(orderGoToAndAttack, out this.ticket, null); return(State.Running); } }
private bool CanAttackGameEntity(Army army, IGameEntity gameEntity, ref bool displayButtonAnyway, ref List <StaticString> failureFlags) { Village village = gameEntity as Village; if (village != null) { displayButtonAnyway = true; if (!TutorialManager.IsActivated) { if (village.PointOfInterest.Interaction.IsLocked(army.Empire.Index, this.Name)) { if (!failureFlags.Contains(ArmyAction_Attack.OneVillageOrManyLocked)) { failureFlags.Add(ArmyAction_Attack.OneVillageOrManyLocked); } return(false); } } else { failureFlags.Add(ArmyAction.NoCanDoWhileTutorial); } if (village.HasBeenConverted) { if (village.Converter == army.Empire) { failureFlags.Add(ArmyAction_Attack.OwnVillage); return(false); } return(true); } else { if (village.HasBeenPacified) { failureFlags.Add(ArmyAction_BaseVillage.NoCanDoWhileVillageIsPacified); return(false); } return(true); } } else { Camp camp = gameEntity as Camp; if (camp != null) { if (camp.Empire == army.Empire) { return(false); } DepartmentOfForeignAffairs agency = army.Empire.GetAgency <DepartmentOfForeignAffairs>(); if (!agency.CanAttack(gameEntity) && !army.IsPrivateers && DepartmentOfTheInterior.CanNeverDeclareWar(army.Empire)) { failureFlags.Add(ArmyAction_Attack.CanNeverDeclareWar); return(false); } return(true); } else { District district = gameEntity as District; if (district != null) { if (district.City.Empire == army.Empire) { return(false); } displayButtonAnyway = true; if (district.City.BesiegingEmpire != null && district.City.BesiegingEmpire != army.Empire) { return(false); } if (district.Type == DistrictType.Exploitation) { return(false); } DepartmentOfForeignAffairs agency2 = army.Empire.GetAgency <DepartmentOfForeignAffairs>(); Diagnostics.Assert(agency2 != null); if (!agency2.CanAttack(gameEntity) && !army.IsPrivateers && DepartmentOfTheInterior.CanNeverDeclareWar(army.Empire)) { failureFlags.Add(ArmyAction_Attack.CanNeverDeclareWar); return(false); } return(true); } else { Army army2 = gameEntity as Army; if (army2 == null) { KaijuGarrison kaijuGarrison = gameEntity as KaijuGarrison; return(kaijuGarrison != null && (kaijuGarrison.Owner == null || kaijuGarrison.Owner.Index != army.Empire.Index) && !kaijuGarrison.Kaiju.IsStunned()); } if (army2.Empire == army.Empire) { return(false); } if (army2.Sails) { return(false); } if (army2 is KaijuArmy) { KaijuArmy kaijuArmy = army2 as KaijuArmy; if (kaijuArmy != null && kaijuArmy.Kaiju.IsStunned()) { return(false); } } DepartmentOfForeignAffairs agency3 = army.Empire.GetAgency <DepartmentOfForeignAffairs>(); Diagnostics.Assert(agency3 != null); if (!agency3.CanAttack(gameEntity) && !army.IsPrivateers && DepartmentOfTheInterior.CanNeverDeclareWar(army.Empire)) { failureFlags.Add(ArmyAction_Attack.CanNeverDeclareWar); return(false); } displayButtonAnyway = true; return(true); } } } }
public void FillTargets(Army army, List <IGameEntity> targets, ref List <StaticString> failureFlags) { if (targets == null) { targets = new List <IGameEntity>(); } IGameService service = Services.GetService <IGameService>(); if (service == null) { return; } IWorldPositionningService service2 = service.Game.Services.GetService <IWorldPositionningService>(); Diagnostics.Assert(service2 != null); IPathfindingService service3 = service.Game.Services.GetService <IPathfindingService>(); Diagnostics.Assert(service2 != null); base.ListNearbyVillages(army); if (base.PointsOfInterest.Count != 0) { for (int i = base.PointsOfInterest.Count - 1; i >= 0; i--) { PointOfInterest pointOfInterest = base.PointsOfInterest[i]; if (pointOfInterest.PointOfInterestImprovement != null && (pointOfInterest.Empire == null || pointOfInterest.Empire.Index != army.Empire.Index)) { Region region = service2.GetRegion(pointOfInterest.WorldPosition); if (region != null && region.MinorEmpire != null) { Village village = region.MinorEmpire.GetAgency <BarbarianCouncil>().Villages.FirstOrDefault((Village iterator) => iterator.WorldPosition == pointOfInterest.WorldPosition); if (village != null) { targets.Add(village); } } } } } List <WorldPosition> list = new List <WorldPosition>(); for (int j = 0; j < 6; j++) { WorldPosition neighbourTile = service2.GetNeighbourTile(army.WorldPosition, (WorldOrientation)j, 1); if (neighbourTile.IsValid && service3.IsTransitionPassable(army.WorldPosition, neighbourTile, army, PathfindingFlags.IgnoreArmies | PathfindingFlags.IgnoreOtherEmpireDistrict | PathfindingFlags.IgnoreDiplomacy | PathfindingFlags.IgnoreFogOfWar | PathfindingFlags.IgnoreZoneOfControl | PathfindingFlags.IgnorePOI | PathfindingFlags.IgnoreSieges | PathfindingFlags.IgnoreKaijuGarrisons, null)) { list.Add(neighbourTile); } } List <int> list2 = new List <int>(); for (int k = 0; k < list.Count; k++) { Region region2 = service2.GetRegion(list[k]); if (region2 != null && !list2.Contains(region2.Index)) { list2.Add(region2.Index); KaijuEmpire kaijuEmpire = region2.KaijuEmpire; if (kaijuEmpire != null) { KaijuCouncil agency = kaijuEmpire.GetAgency <KaijuCouncil>(); if (agency != null) { Kaiju kaiju = agency.Kaiju; if (kaiju != null && kaiju.OnGarrisonMode()) { KaijuGarrison kaijuGarrison = kaiju.KaijuGarrison; if (kaijuGarrison != null && list.Contains(kaijuGarrison.WorldPosition)) { targets.Add(kaijuGarrison); } } } } if (region2.City != null && region2.City.Empire != null && region2.City.Empire.Index != army.Empire.Index) { for (int l = 0; l < region2.City.Districts.Count; l++) { District district = region2.City.Districts[l]; if (list.Contains(district.WorldPosition) && district.Type != DistrictType.Exploitation) { targets.Add(district); } } if (region2.City.Camp != null && list.Contains(region2.City.Camp.WorldPosition)) { targets.Add(region2.City.Camp); } } } } global::Game game = service.Game as global::Game; if (game == null) { return; } for (int m = 0; m < game.Empires.Length; m++) { if (m != army.Empire.Index) { DepartmentOfDefense agency2 = game.Empires[m].GetAgency <DepartmentOfDefense>(); if (agency2 != null) { for (int n = 0; n < agency2.Armies.Count; n++) { Army army2 = agency2.Armies[n]; if (list.Contains(army2.WorldPosition)) { if (army2 is KaijuArmy) { KaijuArmy kaijuArmy = army2 as KaijuArmy; if (kaijuArmy != null && !kaijuArmy.Kaiju.OnArmyMode()) { goto IL_389; } } targets.Add(army2); } IL_389 :; } } DepartmentOfTheInterior agency3 = game.Empires[m].GetAgency <DepartmentOfTheInterior>(); if (agency3 != null) { for (int num = 0; num < agency3.TamedKaijuGarrisons.Count; num++) { KaijuGarrison kaijuGarrison2 = agency3.TamedKaijuGarrisons[num]; if (kaijuGarrison2 != null) { Kaiju kaiju2 = kaijuGarrison2.Kaiju; if (kaiju2 != null && kaiju2.OnGarrisonMode() && list.Contains(kaijuGarrison2.WorldPosition)) { targets.Add(kaijuGarrison2); } } } } } } }