private GameEntityTypeData InnerPickNextBuy(ArcenSimContext Context, List <BuildMenu> Menus) { bag.Clear(); for (int i = 0; i < Menus.Count; i++) { BuildMenu menu = Menus[i]; for (int j = 0; j < menu.List.Count; j++) { int timesToAdd = 0; GameEntityTypeData buyableType = menu.List[j]; if (buyableType.Balance_MarkLevel.RequiredAIPLevel > World_AIW2.Instance.AIProgress_Effective) { continue; } if (World_AIW2.Instance.CorruptedAIDesigns.Contains(buyableType)) { continue; } if (!buyableType.AICanUseThisWithoutUnlockingIt && !World_AIW2.Instance.UnlockedAIDesigns.Contains(buyableType)) { continue; } timesToAdd = 1; if (timesToAdd <= 0) { continue; } bag.AddItem(buyableType, timesToAdd); } } GameEntityTypeData result = bag.PickRandomItemAndReplace(Context.QualityRandom); bag.Clear(); return(result); }
public override bool GetShouldDrawThisFrame_Subclass() { if (!base.GetShouldDrawThisFrame_Subclass()) { return(false); } GameEntity possibleEntity = ArcenExternalUIUtilities.GetEntityToUseForBuildMenu(); if (possibleEntity == null) { return(false); } if (possibleEntity.PrimaryKeyID != this.EntityID || possibleEntity.TypeData != this.EntityData) { this.EntityID = possibleEntity.PrimaryKeyID; this.EntityData = possibleEntity.TypeData; this.EntityChangedSinceLastButtonSetUpdate_Queue = true; this.EntityChangedSinceLastButtonSetUpdate_QueueControls = true; this.EntityChangedSinceLastButtonSetUpdate_Menu = true; } if (LastEntityBuildQueueUpdateTimestamp < possibleEntity.TimeBuildQueueLastUpdated) { this.EntityChangedSinceLastButtonSetUpdate_Queue = true; this.EntityChangedSinceLastButtonSetUpdate_QueueControls = true; LastEntityBuildQueueUpdateTimestamp = possibleEntity.TimeBuildQueueLastUpdated; } return(true); }
public bQueueItem(GameEntityTypeData TypeDoingTheBuilding, BuildQueueItem Item, int ItemIndex) : base(Mode.Queue) { this.TypeDoingTheBuilding = TypeDoingTheBuilding; this.Item = Item; this.ItemIndex = ItemIndex; }
public bItem(GameEntityTypeData TypeDoingTheBuilding, int MenuIndex, bool IsPatternMenu) : base(string.Empty, "^") { this.TypeDoingTheBuilding = TypeDoingTheBuilding; this.MenuIndex = MenuIndex; this.IsPatternMenu = IsPatternMenu; }
public override void OnUpdate() { WorldSide localSide = World_AIW2.Instance.GetLocalSide(); if (localSide == null) { return; } GameEntity launcher = localSide.Entities.GetFirstMatching(EntityRollupType.KingUnits); if (launcher == null) { return; } ArcenUI_ButtonSet elementAsType = (ArcenUI_ButtonSet)Element; Window_InGameWarheadMenu windowController = (Window_InGameWarheadMenu)Element.Window.Controller; if (windowController.PlanetChangedSinceLastButtonSetUpdate) { elementAsType.ClearButtons(); int x = 0; for (int i = 0; i < GameEntityTypeDataTable.Instance.Rows.Count; i++) { GameEntityTypeData type = GameEntityTypeDataTable.Instance.Rows[i]; if (type.SpecialType != SpecialEntityType.Warhead) { continue; } bool foundIt = false; for (int j = 0; j < launcher.WarheadContents.Count; j++) { if (launcher.WarheadContents[j].ContainedType != type) { continue; } foundIt = true; break; } if (!foundIt) { continue; } bItem newButtonController = new bItem(type); Vector2 offset; offset.x = x * elementAsType.ButtonWidth; offset.y = 0; Vector2 size; size.x = elementAsType.ButtonWidth; size.y = elementAsType.ButtonHeight; elementAsType.AddButton(newButtonController, size, offset); x++; } elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared(); windowController.PlanetChangedSinceLastButtonSetUpdate = false; } }
/// <summary> /// returns amount spent on guardians /// </summary> private FInt Helper_SeedGuardians(ArcenSimContext Context, Planet ThisPlanet, ArcenPoint centerPoint, GameEntity entityToGuard, List <GameEntityTypeData> guardianTypes, FInt budget, FInt minDistanceFactor, FInt maxDistanceFactor, EntityBehaviorType behavior, Boolean isMobilePatrol, int MaxCountToSeed) { int minDistance = (ExternalConstants.Instance.Balance_AverageGravWellRadius * minDistanceFactor).IntValue; int maxDistance = (ExternalConstants.Instance.Balance_AverageGravWellRadius * maxDistanceFactor).IntValue; FInt result = FInt.Zero; while (budget > FInt.Zero) { GameEntityTypeData guardianData = guardianTypes[Context.QualityRandom.Next(0, guardianTypes.Count)]; budget -= guardianData.BalanceStats.StrengthPerSquad; ArcenPoint point = ThisPlanet.Combat.GetSafePlacementPoint(Context, guardianData, centerPoint, minDistance, maxDistance); if (point == ArcenPoint.ZeroZeroPoint) { continue; } result += guardianData.BalanceStats.StrengthPerSquad; GameEntity newEntity = GameEntity.CreateNew(entityToGuard.Side, guardianData, point, Context); newEntity.EntitySpecificOrders.Behavior = behavior; newEntity.GuardedObject = entityToGuard; switch (behavior) { case EntityBehaviorType.Guard_Guardian_Anchored: break; case EntityBehaviorType.Guard_Guardian_Patrolling: newEntity.GuardingOffsets.Add(newEntity.WorldLocation - newEntity.GuardedObject.WorldLocation); if (isMobilePatrol) { AngleDegrees initialAngle = centerPoint.GetAngleToDegrees(newEntity.WorldLocation); int initialDistance = centerPoint.GetDistanceTo(newEntity.WorldLocation, false); int step = (AngleDegrees.MaxValue / 6).IntValue; for (int i = step; i < AngleDegrees.MaxValue; i += step) { AngleDegrees angleToThisPoint = initialAngle.Add(AngleDegrees.Create((FInt)i)); ArcenPoint thisPoint = centerPoint.GetPointAtAngleAndDistance(angleToThisPoint, initialDistance); newEntity.GuardingOffsets.Add(thisPoint - newEntity.GuardedObject.WorldLocation); } } break; } if (MaxCountToSeed > 0) { MaxCountToSeed--; if (MaxCountToSeed == 0) { break; } } } return(result); }
public void AddToDescriptionBuffer(GameEntity_Squad RelatedEntityOrNull, GameEntityTypeData RelatedEntityTypeData, ArcenDoubleCharacterBuffer Buffer) { // Make sure we are getting an entity. if (RelatedEntityOrNull == null) { return; } // Load our cargo data. CivilianCargo cargoData = RelatedEntityOrNull.GetCivilianCargoExt(); SpecialFaction_SKCivilianIndustry civFaction; if (RelatedEntityOrNull.PlanetFaction.Faction.Implementation is SpecialFaction_SKCivilianIndustry) { civFaction = (SpecialFaction_SKCivilianIndustry)RelatedEntityOrNull.PlanetFaction.Faction.Implementation; } else { civFaction = (SpecialFaction_SKCivilianIndustry)SpecialFaction_SKCivilianIndustry.GetFriendlyIndustry(RelatedEntityOrNull.PlanetFaction.Faction).Implementation; } // Inform them about what the station has on it. for (int x = 0; x < cargoData.Amount.Length; x++) { if (civFaction.IgnoreResource[x]) { if (cargoData.PerSecond[x] != 0) { Buffer.StartColor(CivilianResourceHexColors.Color[x]); Buffer.Add("\n" + ((CivilianResource)x).ToString()); Buffer.EndColor(); Buffer.StartColor(UnityEngine.Color.red); Buffer.Add(" is produced here but currently ignored due to tech level."); Buffer.EndColor(); } } else { Buffer.StartColor(CivilianResourceHexColors.Color[x]); if (cargoData.Amount[x] > 0 || cargoData.PerSecond[x] != 0) { Buffer.Add($"\n{cargoData.Amount[x]}/{cargoData.Capacity[x]} {(CivilianResource)x}"); } Buffer.EndColor(); // If resource has generation or drain, notify them. if (cargoData.PerSecond[x] > 0) { int income = cargoData.PerSecond[x] + RelatedEntityOrNull.CurrentMarkLevel; Buffer.Add($" +{income} per second"); } } } // Add in an empty line to stop any other gunk (such as the fleet display) from messing up our given information. Buffer.Add("\n"); return; }
public void Execute(ArcenSimContext Context, GameEntity BuildingEntity) { List <GameEntityTypeData> turretTypes = new List <GameEntityTypeData>(); List <GameEntityTypeData> shieldTypes = new List <GameEntityTypeData>(); for (int menuIndex = 0; menuIndex < BuildingEntity.TypeData.BuildMenus.Count; menuIndex++) { BuildMenu menu = BuildingEntity.TypeData.BuildMenus[menuIndex]; for (int i = 0; i < menu.List.Count; i++) { GameEntityTypeData entityData = menu.List[i]; if (entityData.Balance_FuelCost.FuelMultiplier > 0) { continue; } if (entityData.Balance_PowerCost.PowerMultiplier <= 0) { continue; } if (!entityData.CapIsPerPlanet) { continue; } List <GameEntityTypeData> listToAddTo = null; if (entityData.RollupLookup[EntityRollupType.Combatants]) { listToAddTo = turretTypes; } else if (entityData.RollupLookup[EntityRollupType.ProjectsShield]) { listToAddTo = shieldTypes; } if (listToAddTo == null) { continue; } ArcenRejectionReason rejectionReason = BuildingEntity.Side.GetCanBuildAnother(entityData); if (rejectionReason != ArcenRejectionReason.Unknown) { continue; } listToAddTo.Add(entityData); } } int remainingBudget = BuildingEntity.Side.NetPower; remainingBudget -= SpendBudgetOnItemsInList(Context, BuildingEntity.Side, BuildingEntity.WorldLocation, BuildingEntity.TypeData.Radius * 2, shieldTypes, (remainingBudget * 25) / 100); remainingBudget -= SpendBudgetOnItemsInList(Context, BuildingEntity.Side, BuildingEntity.WorldLocation, BuildingEntity.TypeData.Radius * 2, turretTypes, remainingBudget); }
public override void HandleSubTextMouseover(SubText SubText) { int index = this.SubTexts.IndexOf(SubText); if (index < 0) { return; } TextId id = (TextId)index; string idAsString = id.ToString(); string tooltip = SubText.Tooltip; switch (id) { case TextId.FuelOrPower: GameEntityTypeData typeData = this.TypeToBuild; if (typeData == null) { return; } else if (typeData.BalanceStats.SquadFuelConsumption > 0) { idAsString = "Fuel"; } else if (typeData.BalanceStats.SquadPowerConsumption > 0) { idAsString = "Power"; } else { return; } break; case TextId.Attack: case TextId.Defense: tooltip = tooltip.Replace("{0}", ExternalConstants.Instance.Balance_DamageMultiplierWhenCounteringDefense.ReadableString); break; } string key = "EntityTooltipPanel_" + idAsString; if (!Language.Current.Contains(key)) { return; } Window_AtMouseTooltipPanel.bPanel.Instance.SetText(Language.Current.GetValue(key) + tooltip); }
public override bool DoSuccessfulCompletionLogic(GameEntity Target, GameEntity Hacker, ArcenSimContext Context) { GameEntityTypeData hackedHiveData = GameEntityTypeDataTable.Instance.GetRowByName("NanobotCenter_Hacked_Hive", true, null); //Planet hackingPlanet = SpecialFaction_Nanocaust.Instance.mgr.hivePlanet; CombatSide cside = Target.Side; //I don't see a great way to figure out the ArcenPoint of the soon-to-die target; maybe a GameEntity has an ArcenPoint? check this ArcenPoint placementPoint = Target.neverWriteDirectly_worldLocation; Target.Die(Context); GameEntity.CreateNew(cside, hackedHiveData, placementPoint, Context); return(true); }
public void CheckForSpendingUnlockPoints(ArcenSimContext Context) { while (true) { int availablePoints = World_AIW2.Instance.AIProgress_Effective.IntValue - World_AIW2.Instance.SpentAIUnlockPoints; if (availablePoints < World_AIW2.Instance.Setup.Difficulty.AIPNeededPerUnlock) { break; } List <GameEntityTypeData> eligibleUnlocks = new List <GameEntityTypeData>(); List <BuildMenu> menus = World_AIW2.Instance.Setup.MasterAIType.BudgetItems[AIBudgetType.Reinforcement].NormalMenusToBuyFrom; for (int i = 0; i < menus.Count; i++) { BuildMenu menu = menus[i]; for (int j = 0; j < menu.List.Count; j++) { GameEntityTypeData buyableType = menu.List[j]; if (buyableType.AICanUseThisWithoutUnlockingIt) { continue; } if (buyableType.CopiedFrom != null && buyableType.CopiedFrom != buyableType) { continue; } if (World_AIW2.Instance.CorruptedAIDesigns.Contains(buyableType)) { continue; } if (World_AIW2.Instance.UnlockedAIDesigns.Contains(buyableType)) { continue; } eligibleUnlocks.Add(buyableType); } } if (eligibleUnlocks.Count <= 0) { break; } GameEntityTypeData typeToUnlock = eligibleUnlocks[Context.QualityRandom.Next(0, eligibleUnlocks.Count)]; World_AIW2.Instance.UnlockEntityTypeForAI(typeToUnlock, Context); } }
private void Helper_SeedDireGuardians(ArcenSimContext Context, Planet ThisPlanet, ArcenPoint centerPoint, GameEntity controller, List <GameEntityTypeData> guardianTypes, int Count, FInt minDistanceFactor, FInt maxDistanceFactor, EntityBehaviorType behavior, Boolean isMobilePatrol) { int minDistance = (ExternalConstants.Instance.Balance_AverageGravWellRadius * minDistanceFactor).IntValue; int maxDistance = (ExternalConstants.Instance.Balance_AverageGravWellRadius * maxDistanceFactor).IntValue; while (Count > 0) { Count--; GameEntityTypeData guardianData = guardianTypes[Context.QualityRandom.Next(0, guardianTypes.Count)]; ArcenPoint point = ThisPlanet.Combat.GetSafePlacementPoint(Context, guardianData, centerPoint, minDistance, maxDistance); if (point == ArcenPoint.ZeroZeroPoint) { continue; } GameEntity newEntity = GameEntity.CreateNew(controller.Side, guardianData, point, Context); newEntity.EntitySpecificOrders.Behavior = behavior; newEntity.GuardedObject = controller; switch (behavior) { case EntityBehaviorType.Guard_Guardian_Anchored: break; case EntityBehaviorType.Guard_Guardian_Patrolling: newEntity.GuardingOffsets.Add(newEntity.WorldLocation - newEntity.GuardedObject.WorldLocation); if (isMobilePatrol) { AngleDegrees initialAngle = newEntity.GuardedObject.WorldLocation.GetAngleToDegrees(newEntity.WorldLocation); int initialDistance = newEntity.GuardedObject.WorldLocation.GetDistanceTo(newEntity.WorldLocation, false); int step = (AngleDegrees.MaxValue / 6).IntValue; for (int i = step; i < AngleDegrees.MaxValue; i += step) { AngleDegrees angleToThisPoint = initialAngle.Add(AngleDegrees.Create((FInt)i)); ArcenPoint thisPoint = newEntity.GuardedObject.WorldLocation.GetPointAtAngleAndDistance(angleToThisPoint, initialDistance); newEntity.GuardingOffsets.Add(thisPoint - newEntity.GuardedObject.WorldLocation); } } break; } } }
public override void DoOneSecondOfHackingLogic(GameEntity Target, GameEntity Hacker, ArcenSimContext Context) { GameEntityTypeData aberrationData = GameEntityTypeDataTable.Instance.GetRowByName("Aberration", true, null); GameEntityTypeData abominationData = GameEntityTypeDataTable.Instance.GetRowByName("Abomination", true, null); CombatSide cside = Target.Side; // ArcenPoint center = Engine_AIW2.Instance.CombatCenter; ArcenPoint placementPoint = Target.neverWriteDirectly_worldLocation; int numToCreate = 1; /* How many ships to create? */ if (Hacker.ActiveHack_DurationThusFar >= this.GetTotalSecondsToHack(Target, Hacker)) { if (DoSuccessfulCompletionLogic(Target, Hacker, Context)) { //Set the toggle in NanocaustMgr //it should probably cost hacking points. It does hurt the AI. //Lore can claim that the AI is monitoring the Nanobot network and //notices the trick you just used to get access to the Nanobots SpecialFaction_Nanocaust.Instance.mgr.hasBeenHacked = true; Hacker.Side.WorldSide.StoredHacking -= this.GetCostToHack(Target, Hacker); } } else { if (Hacker.ActiveHack_DurationThusFar % 10 == 0) { numToCreate = 3; } } /* Create ships to fight hackers */ for (int i = 0; i < numToCreate; i += 2) { GameEntity.CreateNew(cside, aberrationData, placementPoint, Context); GameEntity.CreateNew(cside, abominationData, placementPoint, Context); } }
public bItem(GameEntityTypeData Type) { this.Type = Type; }
public void UpdateImages(ArcenUIWrapperedUnityImage Image, ArcenUI_Image.SubImage[] SubImages) { if (this.EntityGroup == null) { return; } int debugStage = -1; try { debugStage = 0; int cnt = this.EntityGroup.EntityCount; if (cnt > 0 && cnt < Window_InGameOutlineSidebar.Sprite_Backgrounds.Length) { Image.UpdateWith(Window_InGameOutlineSidebar.Sprite_Backgrounds[cnt]); } debugStage = 1; GameEntityTypeData typeData = this.EntityGroup.TypeData; debugStage = 2; switch (this.EntityGroup.Side) { case EntityGroupSideType.Mine: SubImages[INDEX_ICON].WrapperedImage.UpdateWith(typeData.GUISprite_Icon_Mine); break; case EntityGroupSideType.Allied: SubImages[INDEX_ICON].WrapperedImage.UpdateWith(typeData.GUISprite_Icon_Allied); break; default: SubImages[INDEX_ICON].WrapperedImage.UpdateWith(typeData.GUISprite_Icon_Enemy); break; } debugStage = 3; SubImages[INDEX_ICON_BORDER].WrapperedImage.UpdateWith(typeData.GUISprite_IconBorder); debugStage = 4; SubImages[INDEX_FLAIR].WrapperedImage.UpdateWith(typeData.GUISprite_Flair); debugStage = 5; bool reloading = false; bool underFire = false; bool shielded = false; bool cloaked = false; List <GameEntity> entities = this.EntityGroup.ActualEntities; GameEntity entity; for (int i = 0; i < entities.Count; i++) { debugStage = 6; entity = entities[i]; if (entity.HasBeenRemovedFromSim) { continue; } debugStage = 7; if (!reloading) { for (int j = 0; j < entity.Systems.Count; j++) { debugStage = 5; EntitySystem system = entity.Systems[j]; debugStage = 6; if (system.TimeUntilNextShot <= 0) { continue; } reloading = true; break; } } debugStage = 8; if (!underFire) { underFire = entity.RepairDelaySeconds > 0; } debugStage = 9; if (!shielded) { shielded = entity.ProtectingShieldIDs.Count > 0 || entity.GetCurrentShieldPoints() > 0; } debugStage = 10; if (!cloaked) { cloaked = entity.GetCurrentCloakingPoints() > 0; } } debugStage = 11; SubImages[INDEX_CLOAKED].WrapperedImage.UpdateToShowOrHide(cloaked ? ArcenUIWrapperedUnityImage.ShowOrHideStatus.Show : ArcenUIWrapperedUnityImage.ShowOrHideStatus.Hide); debugStage = 12; SubImages[INDEX_RELOADING].WrapperedImage.UpdateToShowOrHide(reloading ? ArcenUIWrapperedUnityImage.ShowOrHideStatus.Show : ArcenUIWrapperedUnityImage.ShowOrHideStatus.Hide); debugStage = 13; SubImages[INDEX_SHIELDED].WrapperedImage.UpdateToShowOrHide(shielded ? ArcenUIWrapperedUnityImage.ShowOrHideStatus.Show : ArcenUIWrapperedUnityImage.ShowOrHideStatus.Hide); debugStage = 14; SubImages[INDEX_UNDER_FIRE].WrapperedImage.UpdateToShowOrHide(underFire ? ArcenUIWrapperedUnityImage.ShowOrHideStatus.Show : ArcenUIWrapperedUnityImage.ShowOrHideStatus.Hide); debugStage = 15; int markLevel = typeData.Balance_MarkLevel.Ordinal; if (markLevel < 0 || markLevel > 5) { markLevel = 0; } switch (typeData.SpecialType) { case SpecialEntityType.AIKingUnit: case SpecialEntityType.HumanKingUnit: markLevel = 0; break; } SubImages[INDEX_MARK_LEVEL].WrapperedImage.UpdateWith(markLevel <= 0 ? null : Window_InGameOutlineSidebar.Sprite_MarkLevels[markLevel]); } catch (Exception e) { ArcenDebugging.ArcenDebugLog("Exception in WriteRawDrawInstructions at stage " + debugStage + ":" + e.ToString(), Verbosity.ShowAsError); } }
public void AddToDescriptionBuffer(GameEntity_Squad RelatedEntityOrNull, GameEntityTypeData RelatedEntityTypeData, ArcenDoubleCharacterBuffer Buffer) { // Make sure we are getting an entity. if (RelatedEntityOrNull == null) { return; } // Load our cargo data. CivilianCargo cargoData = RelatedEntityOrNull.GetCivilianCargoExt(); // Load our status data. CivilianStatus shipStatus = RelatedEntityOrNull.GetCivilianStatusExt(); // Load our faction data. CivilianFaction factionData = RelatedEntityOrNull.PlanetFaction.Faction.GetCivilianFactionExt(); // Inform them what the ship is currently doing. Buffer.Add("\nThis ship is currently "); // Idle if (factionData.CargoShipsIdle.Contains(RelatedEntityOrNull.PrimaryKeyID)) { Buffer.Add("Idle."); } // Pathing if (factionData.CargoShipsPathing.Contains(RelatedEntityOrNull.PrimaryKeyID)) { Buffer.Add("Pathing"); GameEntity_Squad target = World_AIW2.Instance.GetEntityByID_Squad(shipStatus.Origin); if (target != null) { Buffer.Add(" towards " + target.TypeData.DisplayName + " on " + target.Planet.Name); } Buffer.Add("."); } // Loading if (factionData.CargoShipsLoading.Contains(RelatedEntityOrNull.PrimaryKeyID)) { Buffer.Add("Loading resources"); GameEntity_Squad target = World_AIW2.Instance.GetEntityByID_Squad(shipStatus.Origin); if (target != null) { Buffer.Add(" from " + target.TypeData.DisplayName + " on " + target.Planet.Name); } Buffer.Add("."); if (shipStatus.LoadTimer > 0) { Buffer.Add(" It will automatically depart after " + shipStatus.LoadTimer + " seconds"); } GameEntity_Squad target2 = World_AIW2.Instance.GetEntityByID_Squad(shipStatus.Destination); if (target2 != null) { Buffer.Add(" and head towards " + target2.TypeData.DisplayName + " on " + target2.Planet.Name); } Buffer.Add("."); } // Enroute if (factionData.CargoShipsEnroute.Contains(RelatedEntityOrNull.PrimaryKeyID)) { Buffer.Add("Enroute"); GameEntity_Squad target = World_AIW2.Instance.GetEntityByID_Squad(shipStatus.Destination); if (target != null) { Buffer.Add(" towards " + target.TypeData.DisplayName + " on " + target.Planet.Name); } Buffer.Add("."); } // Unloading if (factionData.CargoShipsUnloading.Contains(RelatedEntityOrNull.PrimaryKeyID)) { Buffer.Add("Unloading resources"); GameEntity_Squad target = World_AIW2.Instance.GetEntityByID_Squad(shipStatus.Destination); if (target != null) { Buffer.Add(" onto " + target.TypeData.DisplayName + " on " + target.Planet.Name); } Buffer.Add("."); } // Building if (factionData.CargoShipsBuilding.Contains(RelatedEntityOrNull.PrimaryKeyID)) { Buffer.Add("Building forces"); GameEntity_Squad target = World_AIW2.Instance.GetEntityByID_Squad(shipStatus.Destination); if (target != null) { Buffer.Add(" at " + target.TypeData.DisplayName + " on " + target.Planet.Name); } Buffer.Add("."); } // Inform them about what the ship has on it. for (int x = 0; x < cargoData.Amount.Length; x++) { if (cargoData.Amount[x] > 0) { Buffer.StartColor(CivilianResourceHexColors.Color[x]); Buffer.Add($"\n{cargoData.Amount[x]}/{cargoData.Capacity[x]} {((CivilianResource)x).ToString()}"); Buffer.EndColor(); } } // Add in an empty line to stop any other gunk (such as the fleet display) from messing up our given information. Buffer.Add("\n"); return; }
public override void UpdateContent(ArcenUIWrapperedUnityImage Image, ArcenUI_Image.SubImageGroup SubImages, SubTextGroup SubTexts) { GameEntityTypeData typeData = this.TypeToBuild; if (typeData == null) { return; } WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide(); Planet planet = Engine_AIW2.Instance.NonSim_GetPlanetBeingCurrentlyViewed(); CombatSide localCombatSide = planet.Combat.GetSideForWorldSide(localSide); int debugStage = -1; try { debugStage = 1; debugStage = 2; SubImages[INDEX_ICON_NO_FLAIR].WrapperedImage.UpdateWith(null, true); SubImages[INDEX_ICON_FLAIR_ONLY].WrapperedImage.UpdateWith(typeData.GUISprite_Icon_White, true); // uncomment if you want a crazy experiment with icons varying in size over time //float size = ( World_AIW2.Instance.GameSecond * 10 ) % 100; //if ( size < 1 ) // size = 1; //SubImages[INDEX_ICON_FLAIR_ONLY].WrapperedImage.SetSize( size, size / 2 ); // uncomment if you want to try vertically centering non-flair icons instead of leaving the gap at the bottom //if ( typeData.GUISprite_Flair == null ) // SubImages[INDEX_ICON_FLAIR_ONLY].WrapperedImage.SetOffset( 0, 5 ); debugStage = 4; SubImages[INDEX_FLAIR].WrapperedImage.UpdateWith(typeData.GUISprite_Flair, true); debugStage = 5; bool showFuel = typeData.BalanceStats.SquadFuelConsumption > 0 && localSide.NetFuel < typeData.BalanceStats.SquadFuelConsumption; SubImages[INDEX_FUEL].WrapperedImage.UpdateToShowOrHide(showFuel); debugStage = 6; bool showPower = typeData.BalanceStats.SquadPowerConsumption > 0 && localCombatSide.NetPower < typeData.BalanceStats.SquadPowerConsumption; SubImages[INDEX_POWER].WrapperedImage.UpdateToShowOrHide(showPower); debugStage = 7; bool showScience = false; bool showLocked = false; bool showUnlocked = false; if (this.ButtonMode == Mode.Tech) { if (typeData.TechPrereq == null) { // shouldn't really be on the tech menu anyway } else { if (localSide.GetHasResearched(typeData.TechPrereq)) { showUnlocked = true; } else if (localSide.GetCanResearch(typeData.TechPrereq, true, false) != ArcenRejectionReason.Unknown) { showLocked = true; } else if (localSide.GetCanResearch(typeData.TechPrereq, false, false) != ArcenRejectionReason.Unknown) { showScience = true; } } } SubImages[INDEX_SCIENCE].WrapperedImage.UpdateToShowOrHide(showScience); //uncomment if you want a crazy experiemnt replacing this icon with a fuel icon //SubImages[INDEX_SCIENCE].WrapperedImage.SetBundleAndPathInBundle( "arcenui", "assets/icons/officialgui/resources/fuel.png" ); SubImages[INDEX_LOCKED].WrapperedImage.UpdateToShowOrHide(showLocked); Image.SetColor(showLocked ? ColorMath.LightGray : ColorMath.White); SubImages[INDEX_UNLOCKED].WrapperedImage.UpdateToShowOrHide(showUnlocked); debugStage = 8; bool showActiveKeyboardColumnIndicator = false; if (this.ButtonMode == Mode.Build) { showActiveKeyboardColumnIndicator = this.ColumnIndex == Window_InGameBuildTypeIconMenu.Instance.CurrentTypeIndex; } else if (this.ButtonMode == Mode.Tech) { showActiveKeyboardColumnIndicator = this.ColumnIndex == Window_InGameTechTypeIconMenu.Instance.CurrentTypeIndex; } SubImages[INDEX_ACTIVE_KEYBOARD_COLUMN].WrapperedImage.UpdateToShowOrHide(showActiveKeyboardColumnIndicator); debugStage = 15; int markLevel = typeData.Balance_MarkLevel.Ordinal; if (markLevel < 0 || markLevel > 5) { markLevel = 0; } SubImages[INDEX_MARK_LEVEL].WrapperedImage.UpdateWith(markLevel <= 0 ? null : Window_InGameOutlineSidebar.Sprite_MarkLevels[markLevel], true); } catch (Exception e) { ArcenDebugging.ArcenDebugLog("Exception in UpdateContent (image) at stage " + debugStage + ":" + e.ToString(), Verbosity.ShowAsError); } debugStage = -1; try { debugStage = 1; ArcenUIWrapperedTMProText text = SubTexts[TEXT_INDEX_UPPER_LEFT].Text; debugStage = 2; ArcenDoubleCharacterBuffer buffer = text.StartWritingToBuffer(); if (typeData != null) { switch (this.ButtonMode) { case Mode.Build: case Mode.Queue: if (planet != null) { int remainingCap = localCombatSide.GetRemainingCap(typeData); text.SetFontSize(12); buffer.Add(remainingCap); if (remainingCap <= 0) { text.SetColor(ColorMath.LightRed); } else { text.SetColor(ColorMath.White); } } break; case Mode.Tech: if (typeData.TechPrereq == null) { break; } if (localSide.GetHasResearched(typeData.TechPrereq)) { break; } int cost = typeData.TechPrereq.ScienceCost; buffer.Add(cost); if (cost > localSide.StoredScience) { text.SetColor(ColorMath.LightRed); } else { text.SetColor(ColorMath.White); } break; } } text.FinishWritingToBuffer(); debugStage = 3; text = SubTexts[TEXT_INDEX_ABOVE_BUTTON].Text; debugStage = 4; buffer = text.StartWritingToBuffer(); if (this.ButtonMode == Mode.Queue) { GameEntity builder = null; Engine_AIW2.Instance.DoForSelected(SelectionCommandScope.CurrentPlanet_UnlessViewingGalaxy, delegate(GameEntity selected) { if (selected.TypeData != this.TypeDoingTheBuilding) { return(DelReturn.Continue); } if (builder != null) { // only show time display when there's only one builder, otherwise it's not clear what should be shown builder = null; return(DelReturn.Break); } builder = selected; return(DelReturn.Continue); }); debugStage = 5; if (builder != null && builder.BuildQueue != null) { BuildQueueItem item = builder.BuildQueue.GetQueueItemFor(typeData); if (item != null) { bool showTimer = item.MetalSpentOnCurrentIteration > 0 && item.NumberBuiltThisLoop < item.NumberToBuildEachLoop; if (showTimer) { FInt metalLeft = typeData.BalanceStats.SquadMetalCost - item.MetalSpentOnCurrentIteration; FInt metalRate = builder.TypeData.MetalFlows[MetalFlowPurpose.BuildingShipsInternally].EffectiveThroughput; if (metalLeft > 0 && metalRate > 0) { FInt secondsLeft = metalLeft / metalRate; buffer.Add(Engine_Universal.ToHoursAndMinutesString(secondsLeft.IntValue)); } } } } } debugStage = 6; text.FinishWritingToBuffer(); } catch (Exception e) { ArcenDebugging.ArcenDebugLog("Exception in UpdateContent (text) at stage " + debugStage + ":" + e.ToString(), Verbosity.ShowAsError); } }
public void SetTypeToBuild(GameEntityTypeData Value) { _TypeToBuild = Value; }
public override void GetTextToShow(ArcenDoubleCharacterBuffer buffer) { if (Engine_AIW2.Instance.CurrentGameViewMode == GameViewMode.GalaxyMapView) { if (Planet.CurrentlyHoveredOver == null) { return; } Planet relatedPlanet = Planet.CurrentlyHoveredOver; if (relatedPlanet != null) { buffer.Add("Hovered over planet: "); buffer.Add(relatedPlanet.Name); buffer.Add(" ("); buffer.Add(relatedPlanet.GalaxyLocation.ToString()); buffer.Add(")"); for (ResourceType resource = ResourceType.None + 1; resource < ResourceType.Length; resource++) { buffer.Add("\n").Add(resource.ToString()).Add(": ").Add(relatedPlanet.ResourceOutputs[resource]); } } GameEntity relatedEntity = GameEntity.CurrentlyHoveredOver; if (relatedEntity != null) { if (!buffer.GetIsEmpty()) { buffer.Add("\n"); } buffer.Add("Hovered over entity icon: "); relatedEntity.WriteQualifiedNameTo(buffer); buffer.Add(" ("); buffer.Add(relatedEntity.Side.WorldSide.Type.ToString()); buffer.Add("-"); buffer.Add(relatedEntity.Side.WorldSide.TeamColor.InternalName); buffer.Add(")"); buffer.Add("\nID:").Add((int)relatedEntity.PrimaryKeyID); } } if (Engine_AIW2.Instance.CurrentGameViewMode == GameViewMode.MainGameView) { GameEntity relatedEntity = GameEntity.CurrentlyHoveredOver; GameEntityTypeData relatedEntityData = GameEntityTypeData.CurrentlyHoveredOver; if (relatedEntity != null) { buffer.Add("Hovered over entity: "); relatedEntity.WriteQualifiedNameTo(buffer); buffer.Add(" ("); buffer.Add(relatedEntity.Side.WorldSide.Type.ToString()); buffer.Add("-"); buffer.Add(relatedEntity.Side.WorldSide.TeamColor.InternalName); buffer.Add(")"); buffer.Add("\n").Add(relatedEntity.WorldLocation.ToString()); if (relatedEntity.TypeData.Category == GameEntityCategory.Ship) { buffer.Add("\n").Add("Hull: ").Add(relatedEntity.GetCurrentHullPoints()).Add("/").Add(relatedEntity.TypeData.BalanceStats.HullPoints); if (relatedEntity.TypeData.BalanceStats.ShieldPoints > 0) { int shieldHealth = relatedEntity.GetCurrentShieldPoints(); if (shieldHealth <= 0) { buffer.Add("<color=#ff6151>"); } buffer.Add(" ").Add("Shields: ").Add(shieldHealth).Add("/").Add(relatedEntity.TypeData.BalanceStats.ShieldPoints); if (shieldHealth <= 0) { buffer.Add("</color>"); } } if (relatedEntity.EngineHealthLost > 0) { int maxEngineHealth = relatedEntity.TypeData.BalanceStats.SquadEngineHealth; if (maxEngineHealth > 0) { int engineHealth = relatedEntity.GetCurrentEngineHealth(); if (engineHealth <= 0) { buffer.Add("<color=#ff6151>"); } buffer.Add(" ").Add("Engines: ").Add(engineHealth).Add("/").Add(maxEngineHealth); if (engineHealth <= 0) { buffer.Add("</color>"); } } } if (relatedEntity.TypeData.Balance_ShipsPerSquad > 1) { buffer.Add(" (Squad: ").Add(relatedEntity.GetCurrentExtraShipsInSquad() + 1).Add("/").Add(relatedEntity.TypeData.Balance_ShipsPerSquad).Add(")"); } if (relatedEntity.SelfBuildingMetalRemaining > FInt.Zero) { buffer.Add("\n").Add("Self-building:").Add(relatedEntity.SelfBuildingMetalRemaining.IntValue).Add("/").Add(relatedEntity.TypeData.BalanceStats.SquadMetalCost); } DoEntityTypeDataPartOfTooltip(buffer, relatedEntity.TypeData); } } else if (relatedEntityData != null) { buffer.Add(relatedEntityData.Name); if (relatedEntityData.Category == GameEntityCategory.Ship) { buffer.Add("\n").Add("Hull: ").Add(relatedEntityData.BalanceStats.HullPoints); if (relatedEntityData.BalanceStats.ShieldPoints > 0) { buffer.Add("\n").Add("Shields: ").Add(relatedEntityData.BalanceStats.ShieldPoints); } DoEntityTypeDataPartOfTooltip(buffer, relatedEntityData); if (relatedEntityData.Balance_ShipsPerSquad > 1) { buffer.Add("\n").Add("Squad Size: ").Add(relatedEntityData.Balance_ShipsPerSquad); buffer.Add("\n").Add("Squad Cap: "); } else { buffer.Add("\n").Add("Ship Cap: "); } buffer.Add(relatedEntityData.BalanceStats.SquadsPerCap); } } } }
public void DoInitialOrReconquestDefenseSeeding(ArcenSimContext Context, Planet ThisPlanet) { GameEntity controller = ThisPlanet.GetController(); AIBudgetItem budgetItem = controller.Side.WorldSide.AITypeData.BudgetItems[AIBudgetType.Reinforcement]; int direGuardianCount = ThisPlanet.MarkLevel.PlanetDireGuardianCount; List <GameEntityTypeData> guardianTypes = new List <GameEntityTypeData>(); if (direGuardianCount > 0) { for (int j = 0; j < budgetItem.DireGuardianMenusToBuyFrom.Count; j++) { for (int i = 0; i < budgetItem.DireGuardianMenusToBuyFrom[j].List.Count; i++) { GameEntityTypeData entityType = budgetItem.DireGuardianMenusToBuyFrom[j].List[i]; guardianTypes.Add(entityType); } } Helper_SeedDireGuardians(Context, ThisPlanet, controller.WorldLocation, controller, guardianTypes, direGuardianCount, FInt.FromParts(0, 250), FInt.FromParts(0, 400), EntityBehaviorType.Guard_Guardian_Patrolling, true); } guardianTypes.Clear(); for (int j = 0; j < budgetItem.GuardianMenusToBuyFrom.Count; j++) { for (int i = 0; i < budgetItem.GuardianMenusToBuyFrom[j].List.Count; i++) { GameEntityTypeData entityType = budgetItem.GuardianMenusToBuyFrom[j].List[i]; if (entityType.Balance_MarkLevel.Ordinal > 0 && entityType.Balance_MarkLevel != ThisPlanet.MarkLevel) { continue; } if (World_AIW2.Instance.CorruptedAIDesigns.Contains(entityType)) { continue; } if (!entityType.AICanUseThisWithoutUnlockingIt && !World_AIW2.Instance.UnlockedAIDesigns.Contains(entityType)) { continue; } guardianTypes.Add(entityType); } } FInt turretStrengthBudget = ThisPlanet.GetGuardingAITurretStrengthCap() / 2; FInt shieldStrengthBudget = ThisPlanet.GetGuardingAIShieldStrengthCap() / 2; FInt guardianStrengthBudget = ThisPlanet.GetGuardingAIGuardianStrengthCap() / 2; FInt fleetShipStrengthBudget = ThisPlanet.GetGuardingAIFleetShipStrengthCap() / 2; int extraStrongPoints = this.GetNumberOfNonControllerStrongAreas(Context, ThisPlanet); // if seeding more than one strong point, seed half as many mobile patrollers, so we have enough for the static stuff FInt mobilePatrollingPortion = extraStrongPoints <= 0 ? FInt.FromParts(0, 400) : FInt.FromParts(0, 200); guardianStrengthBudget -= Helper_SeedGuardians(Context, ThisPlanet, Engine_AIW2.Instance.CombatCenter, controller, guardianTypes, guardianStrengthBudget * mobilePatrollingPortion, FInt.FromParts(0, 500), FInt.FromParts(0, 750), EntityBehaviorType.Guard_Guardian_Patrolling, true, 0); // if seeding more than one strong point, don't seed the stationary patrollers, so we have enough for the static stuff if (extraStrongPoints <= 0) { guardianStrengthBudget -= Helper_SeedGuardians(Context, ThisPlanet, controller.WorldLocation, controller, guardianTypes, guardianStrengthBudget * FInt.FromParts(0, 500), FInt.FromParts(0, 250), FInt.FromParts(0, 400), EntityBehaviorType.Guard_Guardian_Patrolling, false, 0); } FInt portionPerStrongPoint = FInt.One / (extraStrongPoints + 1); for (int i = -1; i < extraStrongPoints; i++) { ArcenPoint strongPointLocation; FInt maxDistance; int seedingsLeft = extraStrongPoints - i; FInt budgetPortion = FInt.One / seedingsLeft; if (i == -1) { strongPointLocation = controller.WorldLocation; maxDistance = FInt.FromParts(0, 150); //FInt portionNotSpending = FInt.One - budgetPortion; //budgetPortion = FInt.One - ( portionNotSpending / 2 ); // leave half as much as we normally would //budgetPortion = Mat.Max( budgetPortion * 2, FInt.One ); } else { strongPointLocation = this.GetPointForNonControllerStrongArea(Context, ThisPlanet, i); maxDistance = FInt.FromParts(0, 100); } guardianStrengthBudget -= Helper_SeedGuardians(Context, ThisPlanet, strongPointLocation, controller, guardianTypes, guardianStrengthBudget * budgetPortion, FInt.FromParts(0, 050), maxDistance, EntityBehaviorType.Guard_Guardian_Anchored, false, 0); } Reinforce(Context, ThisPlanet, controller.Side.WorldSide, shieldStrengthBudget, ReinforcementType.Shield); Reinforce(Context, ThisPlanet, controller.Side.WorldSide, turretStrengthBudget, ReinforcementType.Turret); Reinforce(Context, ThisPlanet, controller.Side.WorldSide, fleetShipStrengthBudget, ReinforcementType.FleetShip); }
public void AddToDescriptionBuffer(GameEntity_Squad RelatedEntityOrNull, GameEntityTypeData RelatedEntityTypeData, ArcenDoubleCharacterBuffer Buffer) { // Make sure we are getting an entity. if (RelatedEntityOrNull == null) { return; } // Load our militia data CivilianMilitia militiaData = RelatedEntityOrNull.GetCivilianMilitiaExt(); CivilianCargo cargoData = RelatedEntityOrNull.GetCivilianCargoExt(); CivilianFaction factionData = RelatedEntityOrNull.PlanetFaction.Faction.GetCivilianFactionExt(); if (factionData == null) { return; } // Inform them about any focus the ship may have. GameEntity_Squad centerpiece = World_AIW2.Instance.GetEntityByID_Squad(militiaData.Centerpiece); if (centerpiece != null && centerpiece.PrimaryKeyID != RelatedEntityOrNull.PrimaryKeyID) { Buffer.Add(" This structure is producing ships for " + centerpiece.FleetMembership.Fleet.GetName() + " on the planet " + centerpiece.Planet.Name + "."); } else { Planet targetPlanet = World_AIW2.Instance.GetPlanetByIndex(militiaData.PlanetFocus); if (targetPlanet != null) { Buffer.Add($" This ship's planetary focus is {targetPlanet.Name}"); } else { Buffer.Add(" This ship is currently waiting for a protection request."); } } if (militiaData.Ships.Count > 0) { for (int x = 0; x < (int)CivilianResource.Length; x++) { GameEntityTypeData entityData = GameEntityTypeDataTable.Instance.GetRowByName(militiaData.ShipTypeData[x], false, null); if (entityData == null) { continue; } int count = militiaData.GetShipCount(entityData.InternalName); Buffer.Add($"\n{entityData.DisplayName}:"); Buffer.StartColor(UnityEngine.Color.green); Buffer.Add($" {count}/{militiaData.ShipCapacity[x]}"); Buffer.EndColor(); Buffer.StartColor(CivilianResourceHexColors.Color[x]); Buffer.Add($" ({(CivilianResource)x})"); Buffer.EndColor(); int cost; if (RelatedEntityOrNull.TypeData.GetHasTag("BuildsProtectors")) { cost = (int)(12000 * SpecialFaction_SKCivilianIndustry.CostIntensityModifier(RelatedEntityOrNull.PlanetFaction.Faction)); } else { double countCostModifier = 1.0 + (1.0 - ((militiaData.ShipCapacity[x] - count + 1.0) / militiaData.ShipCapacity[x])); int baseCost = entityData.CostForAIToPurchase; cost = (int)(SpecialFaction_SKCivilianIndustry.CostIntensityModifier(RelatedEntityOrNull.PlanetFaction.Faction) * (baseCost * countCostModifier * (militiaData.CostMultiplier / 100.0))); } if (count < militiaData.ShipCapacity[x]) { double perc = Math.Min(100, 100.0 * (1.0 * cargoData.Amount[x] / cost)); Buffer.Add($" {perc.ToString("0.##")}% (Building)"); } else { double perc = Math.Min(100, 100.0 * (1.0 * cargoData.Amount[x] / cargoData.Capacity[x])); Buffer.Add($" {perc.ToString("0.##")}% (Stockpiling)"); } Buffer.EndColor(); } } // Add in an empty line to stop any other gunk (such as the fleet display) from messing up our given information. Buffer.Add("\n"); return; }
public override void UpdateContent(ArcenUIWrapperedUnityImage Image, ArcenUI_Image.SubImageGroup _SubImages, SubTextGroup _SubTexts) { this.SubImages = _SubImages; this.SubTexts = _SubTexts; GameEntityTypeData typeData = this.TypeToBuild; if (typeData == null) { return; } WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide(); //Planet planet = Engine_AIW2.Instance.NonSim_GetPlanetBeingCurrentlyViewed(); //CombatSide localCombatSide = planet.Combat.GetSideForWorldSide( localSide ); if (GameEntity.CurrentlyHoveredOver != null) { this.PanelMode = Mode.ActualUnit; } else if (Window_InGameTechTabMenu.Instance.IsOpen) { this.PanelMode = Mode.Tech; } else if (Window_InGameBuildTabMenu.Instance.IsOpen) { this.PanelMode = Mode.Build; } TextId.SubjectSummary.Set(typeData.Name, string.Empty); try { int markLevel = typeData.Balance_MarkLevel == null ? 0 : typeData.Balance_MarkLevel.Ordinal; if (markLevel <= 0) { ImageId.MarkLevel.Hide(); } else { ImageId.MarkLevel.Set(Window_InGameOutlineSidebar.Sprite_MarkLevels[markLevel], string.Empty); } if (this.PanelMode == Mode.Tech && typeData.TechPrereq != null) { bool unlocked = localSide.GetHasResearched(typeData.TechPrereq); ImageId.Locked.ChangeVisibility(!unlocked); ImageId.Unlocked.ChangeVisibility(unlocked); ImageId.Science.Show(); TextId.Science.Set(typeData.TechPrereq.ScienceCost, string.Empty); } else { ImageId.Locked.Hide(); ImageId.Unlocked.Hide(); ImageId.Science.Hide(); TextId.Science.Hide(); } if (typeData.BalanceStats.SquadFuelConsumption > 0) { ImageId.Fuel.Show(); ImageId.Power.Hide(); TextId.FuelOrPower.Set(typeData.BalanceStats.SquadFuelConsumption, string.Empty); } else if (typeData.BalanceStats.SquadPowerConsumption > 0) { ImageId.Fuel.Hide(); ImageId.Power.Show(); TextId.FuelOrPower.Set(typeData.BalanceStats.SquadPowerConsumption, string.Empty); } else { ImageId.Fuel.Hide(); ImageId.Power.Hide(); TextId.FuelOrPower.Hide(); } if (typeData.BalanceStats.SquadMetalCost > 0) { ImageId.Metal.Show(); TextId.Metal.Set(typeData.BalanceStats.SquadMetalCost, string.Empty); } else { ImageId.Metal.Hide(); TextId.Metal.Hide(); } int cap = typeData.BalanceStats.SquadsPerCap; if (cap <= 0) { ImageId.Cap.Hide(); TextId.Cap.Hide(); } else { ImageId.Cap.Show(); TextId.Cap.Set(cap, string.Empty); } ImageId.Strength.Show(); TextId.Strength.Set(typeData.BalanceStats.StrengthPerSquad.IntValue, string.Empty); SystemEntry.SubEntry mainOffensiveWeaponSystemSubEntry = null; EntitySystemTypeData cloakSystem = null; EntitySystemTypeData tachyonSystem = null; EntitySystemTypeData tractorSystem = null; EntitySystemTypeData gravitySystem = null; for (int i = 0; i < typeData.SystemEntries.Count; i++) { SystemEntry entry = typeData.SystemEntries[i]; if (entry.SubEntries.Count <= 0) { continue; } SystemEntry.SubEntry subEntry = entry.SubEntries[0]; if (mainOffensiveWeaponSystemSubEntry == null && subEntry.GetDPS() > 0) { mainOffensiveWeaponSystemSubEntry = subEntry; } EntitySystemTypeData systemData = subEntry.SystemData; if (cloakSystem == null && subEntry.BalanceStats.SquadCloakingPoints > 0) { cloakSystem = systemData; } if (tachyonSystem == null && subEntry.BalanceStats.TachyonPoints > 0) { tachyonSystem = systemData; } if (tractorSystem == null && subEntry.BalanceStats.TractorPoints > 0) { tractorSystem = systemData; } if (gravitySystem == null && subEntry.BalanceStats.GravityPoints > 0) { gravitySystem = systemData; } } if (mainOffensiveWeaponSystemSubEntry != null) { SystemEntry.SubEntry systemSubEntry = mainOffensiveWeaponSystemSubEntry; EntitySystemTypeData systemData = systemSubEntry.SystemData; Balance_WeaponType weaponData = systemData.Balance_WeaponType; ImageId.Attack.Set(systemData.Balance_WeaponType.CounterType); TextId.Attack.Set(systemSubEntry.GetDPS().IntValue, systemData.Balance_WeaponType.CounterType.StatTooltip); ImageId.Range.Set(weaponData.Range); ImageId.EngineDamage.Set(weaponData.Balance_EngineDamageType); ImageId.Paralysis.Set(weaponData.Balance_ParalysisClass); ImageId.Ion.Set(weaponData.Balance_IonClass); ImageId.Implosion.Set(weaponData.Balance_ImplosionClass); ImageId.Nuclear.Set(systemData.Balance_NuclearClass); } else { ImageId.Attack.Hide(); TextId.Attack.Hide(); ImageId.Range.Hide(); ImageId.EngineDamage.Hide(); ImageId.Paralysis.Hide(); ImageId.Ion.Hide(); ImageId.Implosion.Hide(); ImageId.Nuclear.Hide(); } ImageId.Defense.Set(typeData.Balance_Defense); int totalMaxHP = (typeData.BalanceStats.HullPoints + typeData.BalanceStats.ShieldPoints) * typeData.Balance_ShipsPerSquad; GameEntity entity = GameEntity.CurrentlyHoveredOver; if (this.PanelMode == Mode.ActualUnit && entity != null && (entity.HullPointsLost > 0 || entity.ShieldPointsLost > 0 || entity.SquadShipsLost > 0 || entity.SelfBuildingMetalRemaining > 0)) { float percent; if (entity.SelfBuildingMetalRemaining <= 0) { int totalCurrentHP = (typeData.BalanceStats.HullPoints + typeData.BalanceStats.ShieldPoints) * (typeData.Balance_ShipsPerSquad - 1); totalCurrentHP += (entity.GetCurrentHullPoints() + entity.GetCurrentShieldPoints()); percent = ((float)totalCurrentHP / (float)totalMaxHP) * 100; } else { percent = (1f - ((float)entity.SelfBuildingMetalRemaining / (float)typeData.BalanceStats.SquadMetalCost)) * 100; } string percentMask; if (entity.SelfBuildingMetalRemaining > 0 || entity.HasNotYetBeenFullyClaimed) { percentMask = "#,##0.0"; } else { percentMask = "#,##0"; } int totalHPForDisplay = totalMaxHP; string suffix = ArcenExternalUIUtilities.GetRoundedNumberWithSuffix(ref totalHPForDisplay, true); ArcenCharacterBuffer textBuffer = new ArcenCharacterBuffer(); textBuffer.Add(totalHPForDisplay.ToString("#,##0")); textBuffer.Add(suffix); textBuffer.Add(" ("); textBuffer.Add(percent.ToString(percentMask)); textBuffer.Add("%)"); string text = textBuffer.ToString(); TextId.Defense.Set(text, typeData.Balance_Defense.StatTooltip); } else { TextId.Defense.Set(totalMaxHP, typeData.Balance_Defense.StatTooltip); } ImageId.Speed.Set(typeData.Balance_Speed); ImageId.EngineDamageResistance.Set(typeData.Balance_EngineHealthType); ImageId.ParalysisResistance.Set(typeData.Balance_ParalysisResistance); ImageId.IonResistance.Set(typeData.Balance_IonResistance); ImageId.ImplosionResistance.Set(typeData.Balance_ImplosionResistance); ImageId.NuclearResistance.Set(typeData.Balance_NuclearResistance); ImageId.Cloak.Set(cloakSystem == null ? null : cloakSystem.Balance_CloakingType); ImageId.Tachyon.Set(tachyonSystem == null ? null : tachyonSystem.Balance_TachyonType); ImageId.Tractor.Set(tractorSystem == null ? null : tractorSystem.Balance_TractorType); ImageId.TractorResistance.Set(typeData.Balance_TractorResistanceType); ImageId.Gravity.Set(gravitySystem == null ? null : gravitySystem.Balance_GravityType); ImageId.GravityResistance.Set(typeData.Balance_GravityResistanceType); TextId.Description.Set(typeData.Description, string.Empty); } catch (Exception e) { ArcenDebugging.ArcenDebugLog("Exception in UpdateContent after " + (LastWrittenWasImageInsteadOfText ? "image " + LastImageIDWritten : "text " + LastTextIDWritten) + ":" + e.ToString(), Verbosity.ShowAsError); } }
public void SetTypeToTech(GameEntityTypeData Value) { _TypeToTech = Value; }
public void Execute(ArcenSimContext Context, GameEntity BuildingEntity) { List <GameEntityTypeData> turretTypes = new List <GameEntityTypeData>(); for (int menuIndex = 0; menuIndex < BuildingEntity.TypeData.BuildMenus.Count; menuIndex++) { BuildMenu menu = BuildingEntity.TypeData.BuildMenus[menuIndex]; for (int i = 0; i < menu.List.Count; i++) { GameEntityTypeData entityData = menu.List[i]; if (entityData.Balance_FuelCost.FuelMultiplier > 0) { continue; } if (entityData.Balance_PowerCost.PowerMultiplier <= 0) { continue; } if (!entityData.CapIsPerPlanet) { continue; } if (!EntityRollupType.Combatants.Matches(entityData)) //&& !EntityRollupType.ProjectsShield.Matches( entityData ) { continue; } if (BuildingEntity.Side.GetCanBuildAnother(entityData) != ArcenRejectionReason.Unknown) { continue; } turretTypes.Add(entityData); } } if (turretTypes.Count <= 0) { return; } int powerBudget = BuildingEntity.Side.NetPower; int budgetPerType = powerBudget / turretTypes.Count; ArcenPoint formationCenterPoint = BuildingEntity.WorldLocation; turretTypes.Sort(delegate(GameEntityTypeData Left, GameEntityTypeData Right) { int leftValue = 0; if (Left.SystemEntries.Count > 0) { SystemEntry systemEntry = Left.SystemEntries[0]; if (systemEntry.SubEntries.Count > 0) { leftValue = systemEntry.SubEntries[0].BalanceStats.Range; } } int rightValue = 0; if (Right.SystemEntries.Count > 0) { SystemEntry systemEntry = Right.SystemEntries[0]; if (systemEntry.SubEntries.Count > 0) { rightValue = systemEntry.SubEntries[0].BalanceStats.Range; } } return(rightValue.CompareTo(leftValue)); }); int innerRingDistance = BuildingEntity.TypeData.Radius * 2; int outerRingDistance = (ExternalConstants.Instance.Balance_AverageGravWellRadius * FInt.FromParts(0, 100)).IntValue; int distanceBetweenRings = (outerRingDistance - innerRingDistance) / turretTypes.Count; for (int i = 0; i < turretTypes.Count; i++) { GameEntityTypeData turretType = turretTypes[i]; int numberToPlace = budgetPerType / turretType.BalanceStats.SquadPowerConsumption; numberToPlace = Math.Min(BuildingEntity.Side.GetRemainingCap(turretType), numberToPlace); if (numberToPlace <= 0) { continue; } int ringDistance = innerRingDistance + (distanceBetweenRings * i); AngleDegrees startingAngle = AngleDegrees.Create((FInt)Context.QualityRandom.Next(0, AngleDegrees.MaxValue.IntValue)); AngleDegrees angleChangePerItem = AngleDegrees.MaxAngle / numberToPlace; for (int j = 0; j < numberToPlace; j++) { if (BuildingEntity.Side.GetCanBuildAnother(turretType) != ArcenRejectionReason.Unknown) { break; } AngleDegrees angle = startingAngle + (angleChangePerItem * j); ArcenPoint point = formationCenterPoint.GetPointAtAngleAndDistance(angle, ringDistance); point = BuildingEntity.Combat.GetSafePlacementPoint(Context, turretType, point, 0, distanceBetweenRings / 2); if (point == ArcenPoint.ZeroZeroPoint) { continue; } GameEntity newEntity = GameEntity.CreateNew(BuildingEntity.Side, turretType, point, Context); newEntity.SelfBuildingMetalRemaining = (FInt)turretType.BalanceStats.SquadMetalCost; powerBudget -= turretType.BalanceStats.SquadPowerConsumption; } } // fill in the corners of the budget turretTypes.Sort(delegate(GameEntityTypeData Left, GameEntityTypeData Right) { return(Right.BalanceStats.SquadPowerConsumption.CompareTo(Left.BalanceStats.SquadPowerConsumption)); }); bool checkAgain = true; while (powerBudget > 0 && checkAgain) { checkAgain = false; for (int i = 0; i < turretTypes.Count; i++) { GameEntityTypeData turretType = turretTypes[i]; if (powerBudget < turretType.BalanceStats.SquadPowerConsumption) { continue; } if (BuildingEntity.Side.GetCanBuildAnother(turretType) != ArcenRejectionReason.Unknown) { continue; } ArcenPoint point = BuildingEntity.Combat.GetSafePlacementPoint(Context, turretType, formationCenterPoint, innerRingDistance, outerRingDistance); if (point == ArcenPoint.ZeroZeroPoint) { continue; } GameEntity newEntity = GameEntity.CreateNew(BuildingEntity.Side, turretType, point, Context); newEntity.SelfBuildingMetalRemaining = (FInt)turretType.BalanceStats.SquadMetalCost; powerBudget -= turretType.BalanceStats.SquadPowerConsumption; checkAgain = true; } } }
private FInt Inner_ReinforceWithFleetShipsOrTurrets(ArcenSimContext Context, Planet planet, WorldSide side, ref FInt budget, ReinforcementType reinforcementType, FInt strengthCap, ref FInt strengthPresent, List <BuildMenu> buildMenus, List <GameEntity> entitiesWeCanReinforce, bool atMostOnePerReinforceable) { if (entitiesWeCanReinforce.Count <= 0) { return(FInt.Zero); } ArcenRandomDrawBag <GameEntityTypeData> bag = new ArcenRandomDrawBag <GameEntityTypeData>(); for (int i = 0; i < buildMenus.Count; i++) { BuildMenu menu = buildMenus[i]; for (int j = 0; j < menu.List.Count; j++) { int timesToAdd = 0; GameEntityTypeData buyableType = menu.List[j]; if (buyableType.Balance_MarkLevel.Ordinal > 0 && buyableType.Balance_MarkLevel != planet.MarkLevel) { continue; } if (World_AIW2.Instance.CorruptedAIDesigns.Contains(buyableType)) { continue; } if (!buyableType.AICanUseThisWithoutUnlockingIt && !World_AIW2.Instance.UnlockedAIDesigns.Contains(buyableType)) { continue; } timesToAdd = 1; if (timesToAdd <= 0) { continue; } bag.AddItem(buyableType, timesToAdd); } } if (!bag.GetHasItems()) { return(FInt.Zero); } entitiesWeCanReinforce.Sort(delegate(GameEntity Left, GameEntity Right) { return(Left.Working_ReinforcementsOnly_ContentsStrength.CompareTo(Right.Working_ReinforcementsOnly_ContentsStrength)); }); FInt result = FInt.Zero; while (budget > FInt.Zero && strengthPresent < strengthCap && entitiesWeCanReinforce.Count > 0) { int index = 0; switch (reinforcementType) { case ReinforcementType.Turret: case ReinforcementType.Shield: index = Context.QualityRandom.Next(0, entitiesWeCanReinforce.Count); break; } GameEntity entityToReinforce = entitiesWeCanReinforce[index]; GameEntityTypeData typeToBuy = bag.PickRandomItemAndReplace(Context.QualityRandom); budget -= typeToBuy.BalanceStats.StrengthPerSquad; result += typeToBuy.BalanceStats.StrengthPerSquad; strengthPresent += typeToBuy.BalanceStats.StrengthPerSquad; switch (reinforcementType) { case ReinforcementType.Turret: case ReinforcementType.Shield: { int minDistance = (ExternalConstants.Instance.Balance_AverageGravWellRadius * FInt.FromParts(0, 050)).IntValue; int maxDistance = (ExternalConstants.Instance.Balance_AverageGravWellRadius * FInt.FromParts(0, 150)).IntValue; ArcenPoint point = planet.Combat.GetSafePlacementPoint(Context, typeToBuy, entityToReinforce.WorldLocation, minDistance, maxDistance); if (point == ArcenPoint.ZeroZeroPoint) { continue; } result += typeToBuy.BalanceStats.StrengthPerSquad; GameEntity newEntity = GameEntity.CreateNew(planet.Combat.GetSideForWorldSide(side), typeToBuy, point, Context); newEntity.EntitySpecificOrders.Behavior = EntityBehaviorType.Stationary; } break; case ReinforcementType.FleetShip: { entityToReinforce.ChangeContents(typeToBuy, 1); entityToReinforce.Working_ReinforcementsOnly_ContentsStrength += typeToBuy.BalanceStats.StrengthPerSquad; for (int i = 1; i < entitiesWeCanReinforce.Count; i++) { GameEntity otherReinforceable = entitiesWeCanReinforce[i]; if (entityToReinforce.Working_ReinforcementsOnly_ContentsStrength <= otherReinforceable.Working_ReinforcementsOnly_ContentsStrength) { break; } entitiesWeCanReinforce[i - 1] = otherReinforceable; entitiesWeCanReinforce[i] = entityToReinforce; } } break; } if (atMostOnePerReinforceable) { entitiesWeCanReinforce.Remove(entityToReinforce); } } return(result); }
private static int SpendBudgetOnItemsInList(ArcenSimContext Context, CombatSide Side, ArcenPoint CenterLocation, int MinimumDistanceFromCenter, List <GameEntityTypeData> listToBuyFrom, int budget) { if (listToBuyFrom.Count <= 0) { return(0); } if (budget <= 0) { return(0); } int remainingBudget = budget; int budgetPerType = remainingBudget / listToBuyFrom.Count; ArcenPoint formationCenterPoint = CenterLocation; listToBuyFrom.Sort(delegate(GameEntityTypeData Left, GameEntityTypeData Right) { int leftValue = 0; if (Left.SystemEntries.Count > 0) { SystemEntry systemEntry = Left.SystemEntries[0]; if (systemEntry.SubEntries.Count > 0) { leftValue = systemEntry.SubEntries[0].BalanceStats.Range; } } int rightValue = 0; if (Right.SystemEntries.Count > 0) { SystemEntry systemEntry = Right.SystemEntries[0]; if (systemEntry.SubEntries.Count > 0) { rightValue = systemEntry.SubEntries[0].BalanceStats.Range; } } return(rightValue.CompareTo(leftValue)); }); int innerRingDistance = MinimumDistanceFromCenter; int outerRingDistance = (ExternalConstants.Instance.Balance_AverageGravWellRadius * FInt.FromParts(0, 100)).IntValue; int distanceBetweenRings = (outerRingDistance - innerRingDistance) / listToBuyFrom.Count; for (int i = 0; i < listToBuyFrom.Count; i++) { GameEntityTypeData entityType = listToBuyFrom[i]; int numberToPlace = budgetPerType / entityType.BalanceStats.SquadPowerConsumption; numberToPlace = Math.Min(Side.GetRemainingCap(entityType), numberToPlace); if (numberToPlace <= 0) { continue; } int ringDistance = innerRingDistance + (distanceBetweenRings * i); AngleDegrees startingAngle = AngleDegrees.Create((FInt)Context.QualityRandom.Next(0, AngleDegrees.MaxValue.IntValue)); AngleDegrees angleChangePerItem = AngleDegrees.MaxAngle / numberToPlace; for (int j = 0; j < numberToPlace; j++) { if (Side.GetCanBuildAnother(entityType) != ArcenRejectionReason.Unknown) { break; } AngleDegrees angle = startingAngle + (angleChangePerItem * j); ArcenPoint point = formationCenterPoint.GetPointAtAngleAndDistance(angle, ringDistance); point = Side.Combat.GetSafePlacementPoint(Context, entityType, point, 0, distanceBetweenRings / 2); if (point == ArcenPoint.ZeroZeroPoint) { continue; } GameEntity newEntity = GameEntity.CreateNew(Side, entityType, point, Context); newEntity.SelfBuildingMetalRemaining = (FInt)entityType.BalanceStats.SquadMetalCost; remainingBudget -= entityType.BalanceStats.SquadPowerConsumption; } } // fill in the corners of the budget listToBuyFrom.Sort(delegate(GameEntityTypeData Left, GameEntityTypeData Right) { return(Right.BalanceStats.SquadPowerConsumption.CompareTo(Left.BalanceStats.SquadPowerConsumption)); }); bool checkAgain = true; while (remainingBudget > 0 && checkAgain) { checkAgain = false; for (int i = 0; i < listToBuyFrom.Count; i++) { GameEntityTypeData entityType = listToBuyFrom[i]; if (remainingBudget < entityType.BalanceStats.SquadPowerConsumption) { continue; } if (Side.GetCanBuildAnother(entityType) != ArcenRejectionReason.Unknown) { continue; } ArcenPoint point = Side.Combat.GetSafePlacementPoint(Context, entityType, formationCenterPoint, innerRingDistance, outerRingDistance); if (point == ArcenPoint.ZeroZeroPoint) { continue; } GameEntity newEntity = GameEntity.CreateNew(Side, entityType, point, Context); newEntity.SelfBuildingMetalRemaining = (FInt)entityType.BalanceStats.SquadMetalCost; remainingBudget -= entityType.BalanceStats.SquadPowerConsumption; checkAgain = true; } } return(budget - remainingBudget); }
public void ComputeCurrentState() { switch (this.Type) { #region Victory case ObjectiveType.Victory: { GameEntity masterController = World_AIW2.Instance.GetFirstEntityMatching(SpecialEntityType.AIKingUnit, EntityRollupType.KingUnits); if (masterController == null) { this.State = ObjectiveState.Met; break; } if (masterController.Combat.Planet.HumansHaveBasicIntel) { this.State = ObjectiveState.NeedToAchieve; this.RelatedPlanets.Add(masterController.Combat.Planet); break; } this.State = ObjectiveState.NeedToFind; } break; #endregion #region GainFleetStrength case ObjectiveType.GainFleetStrength: { WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide(); GameEntity ark = localSide.Entities.GetFirstMatching(SpecialEntityType.HumanKingUnit); if (ark == null) { this.State = ObjectiveState.NotApplicable; break; } List <BuildMenu> menus = ark.TypeData.BuildMenus; List <GameEntityTypeData> produceableTypes = new List <GameEntityTypeData>(); List <GameEntityTypeData> researchableTypes = new List <GameEntityTypeData>(); bool foundAnyCurrentlyProduceable = false; bool foundAnyTechsCurrentlyResearchable = false; for (int i = 0; i < menus.Count; i++) { BuildMenu menu = menus[i]; for (int j = 0; j < menu.List.Count; j++) { GameEntityTypeData item = menu.List[j]; if (item.BalanceStats.SquadFuelConsumption <= 0) { continue; } ArcenRejectionReason reason = localSide.GetCanBuildAnother(item); switch (reason) { case ArcenRejectionReason.SideDoesNotHaveEnoughCap: continue; case ArcenRejectionReason.SideDoesNotHavePrerequisiteTech: if (item.TechPrereq.NotOnMainTechMenu) { continue; } ArcenRejectionReason techRejectionReason = localSide.GetCanResearch(item.TechPrereq, false, false); switch (techRejectionReason) { case ArcenRejectionReason.SideDoesNotHavePrerequisiteTech: continue; case ArcenRejectionReason.Unknown: foundAnyTechsCurrentlyResearchable = true; break; } researchableTypes.Add(item); continue; case ArcenRejectionReason.Unknown: foundAnyCurrentlyProduceable = true; break; } produceableTypes.Add(item); } } this.State = ObjectiveState.NeedToAchieve; if (foundAnyCurrentlyProduceable) { this.SubType = ObjectiveSubType.GainFleetStrength_ThroughProduction; for (int i = 0; i < produceableTypes.Count; i++) { GameEntityTypeData entityType = produceableTypes[i]; if (localSide.GetCanBuildAnother(entityType) != ArcenRejectionReason.Unknown) { continue; } this.RelatedEntityTypes.Add(entityType); } this.RelatedEntityTypes.Sort(delegate(GameEntityTypeData Left, GameEntityTypeData Right) { FInt leftValue = Left.BalanceStats.StrengthPerSquad * localSide.GetRemainingCap(Left); FInt rightValue = Right.BalanceStats.StrengthPerSquad * localSide.GetRemainingCap(Right); return(rightValue.CompareTo(leftValue)); }); } else if (produceableTypes.Count > 0) { this.SubType = ObjectiveSubType.GainFleetStrength_ThroughFuel; GetPotentialCapturePlanets(localSide); this.RelatedPlanets.Sort(delegate(Planet Left, Planet Right) { return(Right.ResourceOutputs[ResourceType.Fuel].CompareTo(Left.ResourceOutputs[ResourceType.Fuel])); }); } else if (foundAnyTechsCurrentlyResearchable) { this.SubType = ObjectiveSubType.GainFleetStrength_ThroughSpendingScience; for (int i = 0; i < researchableTypes.Count; i++) { GameEntityTypeData entityType = researchableTypes[i]; if (localSide.GetCanResearch(entityType.TechPrereq, false, false) != ArcenRejectionReason.Unknown) { continue; } this.RelatedEntityTypes.Add(entityType); } this.RelatedEntityTypes.Sort(delegate(GameEntityTypeData Left, GameEntityTypeData Right) { return(Right.BalanceStats.StrengthPerCap.CompareTo(Left.BalanceStats.StrengthPerCap)); }); } else if (researchableTypes.Count > 0) { this.SubType = ObjectiveSubType.GainFleetStrength_ThroughScience; GetPotentialCapturePlanets(localSide); this.RelatedPlanets.Sort(delegate(Planet Left, Planet Right) { FInt LeftValue = Left.ResourceOutputs[ResourceType.Science] - Left.ScienceGatheredBySideIndex[localSide.SideIndex]; FInt RightValue = Right.ResourceOutputs[ResourceType.Science] - Right.ScienceGatheredBySideIndex[localSide.SideIndex]; return(RightValue.CompareTo(LeftValue)); }); } else { this.State = ObjectiveState.NotApplicable; } } break; #endregion #region ExploreGalaxy case ObjectiveType.ExploreGalaxy: { GetKnownPlanetsWithAtLeastOneUnitOf(WorldSideType.AI, EntityRollupType.ScramblesSensors); this.RelatedPlanets.Sort(delegate(Planet Left, Planet Right) { return(Left.OriginalHopsToHumanHomeworld.CompareTo(Right.OriginalHopsToHumanHomeworld)); }); if (this.RelatedPlanets.Count > 0) { this.State = ObjectiveState.NeedToAchieve; } } break; #endregion #region ClaimFlagship case ObjectiveType.ClaimFlagship: { GetKnownPlanetsWithAtLeastOneUnitOf(WorldSideType.NaturalObject, "Flagship"); this.RelatedPlanets.Sort(delegate(Planet Left, Planet Right) { return(Left.OriginalHopsToHumanHomeworld.CompareTo(Right.OriginalHopsToHumanHomeworld)); }); if (this.RelatedPlanets.Count > 0) { this.State = ObjectiveState.NeedToAchieve; } } break; #endregion #region GetBonusShipType case ObjectiveType.GetBonusShipType: { GetKnownPlanetsWithAtLeastOneUnitOf(WorldSideType.AI, "AdvancedResearchStation"); this.RelatedPlanets.Sort(delegate(Planet Left, Planet Right) { return(Left.OriginalHopsToHumanHomeworld.CompareTo(Right.OriginalHopsToHumanHomeworld)); }); if (this.RelatedPlanets.Count > 0) { this.State = ObjectiveState.NeedToAchieve; } } break; #endregion #region DestroyAIPReducer case ObjectiveType.DestroyAIPReducer: { GetKnownPlanetsWithAtLeastOneUnitOf(WorldSideType.AI, "DataCenter"); this.RelatedPlanets.Sort(delegate(Planet Left, Planet Right) { return(Left.OriginalHopsToHumanHomeworld.CompareTo(Right.OriginalHopsToHumanHomeworld)); }); if (this.RelatedPlanets.Count > 0) { this.State = ObjectiveState.NeedToAchieve; } } break; #endregion } }
public bBuildItem(GameEntityTypeData TypeDoingTheBuilding, BuildMenuItem Item) { this.TypeDoingTheBuilding = TypeDoingTheBuilding; this.Item = Item; }
private static void DoEntityTypeDataPartOfTooltip(ArcenDoubleCharacterBuffer buffer, GameEntityTypeData relatedEntityData) { for (int i = 0; i < relatedEntityData.SystemEntries.Count; i++) { SystemEntry entry = relatedEntityData.SystemEntries[i]; if (entry.SubEntries.Count <= 0) { continue; } SystemEntry.SubEntry subEntry = entry.SubEntries[0]; if (subEntry.SystemData.Category == EntitySystemCategory.Weapon) { Balance_WeaponType weaponType = subEntry.SystemData.Balance_WeaponType; buffer.Add("\n").Add("<color=#ffee8e>Weapon:</color> ").Add(weaponType.InternalName).Add(" Range: ").Add(subEntry.BalanceStats.Range); buffer.Add("\n"); if (relatedEntityData.Balance_ShipsPerSquad > 1) { buffer.Add("Squad "); } buffer.Add("DPS: ").Add(subEntry.GetDPS().IntValue); if (weaponType.CounterType.Counters.Count > 0) { buffer.Add(" Strong Against"); for (int j = 0; j < weaponType.CounterType.Counters.Count; j++) { buffer.Add(" ").Add(weaponType.CounterType.Counters[j].InternalName); } } } } buffer.Add("\n").Add("Defense: ").Add(relatedEntityData.Balance_Defense.InternalName); if (relatedEntityData.BalanceStats.Speed > 0) { buffer.Add(" ").Add("Speed: ").Add(relatedEntityData.BalanceStats.Speed); } }
public bMenuSelectionItem(GameEntityTypeData TypeDoingTheBuilding, int MenuIndex) { this.TypeDoingTheBuilding = TypeDoingTheBuilding; this.MenuIndex = MenuIndex; }