diff --git a/data/campaign/abilities.csv b/data/campaign/abilities.csv index 2bd6e94..ec77a18 100644 --- a/data/campaign/abilities.csv +++ b/data/campaign/abilities.csv @@ -1,2 +1,2 @@ name,id,type,tags,activationDays,activationCooldown,durationDays,deactivationDays,deactivationCooldown,unlockedAtStart,defaultForAIFleet,musicSuppression,uiOn,uiOff,uiLoop,worldOn,worldOff,worldLoop,icon,plugin,ai,desc,sortOrder -"Forge Production",forge_production,TOGGLE,"burn-, stealth-",0.2,,,0.05,,TRUE,,,ui_neutrino_detector_on,ui_neutrino_detector_off,,system_temporalshell_off,,system_temporalshell_loop,graphics/icons/abilities/forge_production.png,data.forge.abilities.ForgeProduction,,"Control production of your Forge Modules.",868 +"Forge Production",forge_production,TOGGLE,"burn-, stealth-,sensors+",0.5,,,0.25,1,TRUE,,,ui_neutrino_detector_on,ui_neutrino_detector_off,,system_temporalshell_off,,system_temporalshell_loop,graphics/icons/abilities/forge_production.png,data.forge.abilities.ForgeProduction,,"Control forge production of your fleet.",868 diff --git a/data/forge/abilities/ForgeProduction.java b/data/forge/abilities/ForgeProduction.java index f3d953d..8b90207 100644 --- a/data/forge/abilities/ForgeProduction.java +++ b/data/forge/abilities/ForgeProduction.java @@ -3,6 +3,7 @@ import java.awt.Color; import data.forge.abilities.conversion.*; +import data.forge.plugins.ForgeSettings; import org.lwjgl.util.vector.Vector2f; import com.fs.starfarer.api.Global; import com.fs.starfarer.api.util.Misc; @@ -20,18 +21,19 @@ public class ForgeProduction extends BaseToggleAbility { - // Here: Declared constants - private static final Vector2f ZERO = new Vector2f(); private int notificationCounter = 0; private final IntervalUtil productionInterval = new IntervalUtil(1f,1f); - // Here: Inherited methods - protected void activateImpl() { } + @Override + protected String getActivationText() { + return "Commencing forge production"; + } + protected void applyEffect(float amount, float level) { CampaignFleetAPI fleet = getFleet(); @@ -39,6 +41,11 @@ protected void applyEffect(float amount, float level) { if (fleet == null) return; if (!isActive()) return; + if (ENABLE_PENALTIES) { + fleet.getStats().getDetectedRangeMod().modifyPercent(getModId(), ForgeSettings.SENSOR_PROFILE_INCREASE, "Forge production"); + fleet.goSlowOneFrame(); + } + float days = Global.getSector().getClock().convertToDays(amount); productionInterval.advance(days); @@ -53,7 +60,7 @@ protected void applyEffect(float amount, float level) { ForgeAssemblingLogic.startAssembling(fleet); - if (goodsWereForged ()) { + if (goodsWereForged()) { fleet.addFloatingText("Forged goods", Misc.setAlpha(Misc.getTextColor(), 255), 0.5f); @@ -61,10 +68,10 @@ protected void applyEffect(float amount, float level) { Global.getSoundPlayer().playSound("ui_cargo_raremetals", 1f, 1f, fleet.getLocation(), ZERO); } - clearGoodsStatus (); + clearGoodsStatus(); } - if (SHOW_NOTIFICATION && goodsProducedReport ()) { + if (SHOW_NOTIFICATION && goodsProducedReport()) { notificationCounter += 1; } @@ -82,7 +89,15 @@ protected void applyEffect(float amount, float level) { protected void deactivateImpl() { cleanupImpl(); } - protected void cleanupImpl() { } + @Override + protected void cleanupImpl() { + CampaignFleetAPI fleet = getFleet(); + if (fleet == null) return; + + if (ENABLE_PENALTIES) { + fleet.getStats().getDetectedRangeMod().unmodify(getModId()); + } + } @Override public boolean isUsable() { @@ -110,8 +125,8 @@ public float getTooltipWidth() { @Override public void createTooltip(TooltipMakerAPI tooltip, boolean expanded) { + Color gray = Misc.getGrayColor(); Color highlight = Misc.getHighlightColor(); - Color negativeHighlight = Misc.getNegativeHighlightColor(); String status = " (off)"; if (turnedOn) { @@ -122,13 +137,17 @@ public void createTooltip(TooltipMakerAPI tooltip, boolean expanded) { title.highlightLast(status); title.setHighlightColor(highlight); - tooltip.setLowGridRowHeight(); - float pad = 6f; - tooltip.addPara("Control forge production of your fleet.", pad); - tooltip.addPara("Your fleet must have ships with active forge modules to produce goods. " + - "Ships that are mothballed or do not receive repairs are unable to use their forge modules. " + - "Production also uses heavy machinery, which must be present but is not consumed, and can break accidentally.", pad); + tooltip.addPara("Control forge production of your fleet and monitor fleet forging capacity.", pad); + if (!expanded) { + tooltip.addPara("Your fleet must have ships with active forge modules to produce goods. " + + "Ships that are mothballed or do not receive repairs are unable to use their forge modules. " + + "Production also uses heavy machinery, which must be present but is not consumed, and can break accidentally.", pad); + } + + if (!hasActiveForgeShips() && expanded) { + ForgeProductionTooltip.addCannotForgeNote(tooltip); + } if (hasActiveForgeShips() && expanded) { ForgeProductionTooltip.addOperationalShipsBreakdown(tooltip); @@ -138,14 +157,21 @@ public void createTooltip(TooltipMakerAPI tooltip, boolean expanded) { ForgeProductionTooltip.addInactiveShipsBreakdown(tooltip); } - if (!hasActiveForgeShips()) { - tooltip.addPara("Your fleet currently cannot conduct forging operations.", negativeHighlight, pad); - } - if (expanded) { ForgeProductionTooltip.addExpandedInfo(tooltip); } + if (ENABLE_PENALTIES && !expanded) { + tooltip.addPara("Causes the fleet to %s and increases the range at which the fleet can be detected by %s.", + pad, highlight, "move slowly", (int) ForgeSettings.SENSOR_PROFILE_INCREASE + "%"); + + tooltip.addPara("*A fleet is considered slow-moving at a burn level of half that of its slowest ship.", gray, pad); + } + + if (!hasActiveForgeShips() && !expanded) { + ForgeProductionTooltip.addCannotForgeNote(tooltip); + } + addIncompatibleToTooltip(tooltip, expanded); } diff --git a/data/forge/abilities/ForgeProductionTooltip.java b/data/forge/abilities/ForgeProductionTooltip.java index 569b11a..3ededa7 100644 --- a/data/forge/abilities/ForgeProductionTooltip.java +++ b/data/forge/abilities/ForgeProductionTooltip.java @@ -23,14 +23,19 @@ public class ForgeProductionTooltip { + public static void addCannotForgeNote(TooltipMakerAPI tooltip) { + float pad = 6f; + Color negativeHighlight = Misc.getNegativeHighlightColor(); + tooltip.addPara("Your fleet currently cannot conduct forging operations.", negativeHighlight, pad); + } + public static void addOperationalShipsBreakdown(TooltipMakerAPI tooltip) { Color textColor = Misc.getTextColor(); Color highlightColor = Misc.getHighlightColor(); - Color positiveHighlightColor = Misc.getPositiveHighlightColor(); String indent = " "; - float pad = 6f; + float pad = 10f; tooltip.addSectionHeading("Operational ships", Alignment.MID, pad); tooltip.addSpacer(6f); @@ -57,7 +62,7 @@ public static void addOperationalShipsBreakdown(TooltipMakerAPI tooltip) { String label = indent + shipNameShort + ", " + shipClass; - tooltip.addToGrid(0, rowNumber++, label, forgeModule, positiveHighlightColor); + tooltip.addToGrid(0, rowNumber++, label, forgeModule, highlightColor); counter++; @@ -81,7 +86,7 @@ public static void addInactiveShipsBreakdown(TooltipMakerAPI tooltip) { Color highlightColor = Misc.getHighlightColor(); String indent = " "; - float pad = 6f; + float pad = 10f; tooltip.addSectionHeading("Inactive ships", Alignment.MID, pad); tooltip.addSpacer(6f); @@ -131,7 +136,7 @@ public static void addExpandedInfo(TooltipMakerAPI tooltip) { } if (ForgeConditionChecker.hasAnySpecialItem()) { - addSpecialItemsBreakdown(tooltip); + ForgeProductionTooltip.addSpecialItemsBreakdown(tooltip); } } diff --git a/data/forge/abilities/conversion/ForgeAssemblingLogic.java b/data/forge/abilities/conversion/ForgeAssemblingLogic.java index d34ae1b..c1c737d 100644 --- a/data/forge/abilities/conversion/ForgeAssemblingLogic.java +++ b/data/forge/abilities/conversion/ForgeAssemblingLogic.java @@ -34,7 +34,7 @@ public static void assembleMachinery(CampaignFleetAPI fleet) { float metalInAssembling = ForgeConditionChecker.getPlayerCargo(Commodities.METALS) / METAL_TO_ASSEMBLE; float transplutonicsInAssembling = ForgeConditionChecker.getPlayerCargo(Commodities.RARE_METALS) / TRANSPLUTONICS_TO_ASSEMBLE; - int assemblingCycles = (int) (Math.min(assemblingCapacity, + int assemblingCycles = (int) Math.floor(Math.min(assemblingCapacity, Math.min(machineryAvailableForAssembling, Math.min(metalInAssembling, transplutonicsInAssembling)))); boolean willHeavyMachineryBreakdown = ForgeConditionChecker.getMachineryBreakdownChance(); @@ -42,14 +42,14 @@ public static void assembleMachinery(CampaignFleetAPI fleet) { int machineryBroken = 0; for (int machineryInCheck = 0; machineryInCheck < MachineryInAssembling; machineryInCheck++) { - if (Math.random() < ((float) BREAKDOWN_SEVERITY * ForgeConditionChecker.getForgingQuality())) + if (Math.random() < (BREAKDOWN_SEVERITY * ForgeConditionChecker.getForgingQuality())) machineryBroken++; } - float dailyMetalSpent = METAL_TO_ASSEMBLE * assemblingCycles; - float dailyTransplutonicsSpent = TRANSPLUTONICS_TO_ASSEMBLE * assemblingCycles; - float dailyHeavyMachineryProduced = (HEAVY_MACHINERY_PRODUCED + ForgeConditionChecker.getNanoforgeAssemblingBonus()) * assemblingCycles; - float dailyHeavyMachineryBroken = machineryBroken; + int dailyMetalSpent = (int) Math.ceil(METAL_TO_ASSEMBLE * assemblingCycles); + int dailyTransplutonicsSpent = (int) Math.ceil(TRANSPLUTONICS_TO_ASSEMBLE * assemblingCycles); + int dailyHeavyMachineryProduced = (int) Math.floor((HEAVY_MACHINERY_PRODUCED + ForgeConditionChecker.getNanoforgeAssemblingBonus()) * assemblingCycles); + int dailyHeavyMachineryBroken = machineryBroken; fleet.getCargo().removeCommodity(Commodities.METALS, dailyMetalSpent); fleet.getCargo().removeCommodity(Commodities.RARE_METALS, dailyTransplutonicsSpent); diff --git a/data/forge/abilities/conversion/ForgeCentrifugingLogic.java b/data/forge/abilities/conversion/ForgeCentrifugingLogic.java index 543cf96..928fac4 100644 --- a/data/forge/abilities/conversion/ForgeCentrifugingLogic.java +++ b/data/forge/abilities/conversion/ForgeCentrifugingLogic.java @@ -42,19 +42,19 @@ public static void centrifugeFuel(CampaignFleetAPI fleet) { int initialCentrifugingCycles = (int) Math.min(centrifugingCapacity, Math.min(machineryAvailableForCentrifuging, volatilesInCentrifuging)); - int centrifugingCycles = Math.min(initialCentrifugingCycles, getPossibleCentrifugingCycles(fleet)); + int centrifugingCycles = (int) Math.floor(Math.min(initialCentrifugingCycles, getPossibleCentrifugingCycles(fleet))); boolean willHeavyMachineryBreakdown = ForgeConditionChecker.getMachineryBreakdownChance(); int machineryInCentrifuging = (int) Math.ceil((centrifugingCycles * HEAVY_MACHINERY_CENTRIFUGING_USAGE)); int machineryBroken = 0; for (int machineryInCheck = 0; machineryInCheck < machineryInCentrifuging; machineryInCheck++) { - if (Math.random()<((float) BREAKDOWN_SEVERITY * ForgeConditionChecker.getForgingQuality())) machineryBroken++; + if (Math.random()<(BREAKDOWN_SEVERITY * ForgeConditionChecker.getForgingQuality())) machineryBroken++; } - float dailyVolatilesSpent = VOLATILES_TO_CENTRIFUGE * centrifugingCycles; - float dailyFuelProduced = (FUEL_PRODUCED + ForgeConditionChecker.getSynchrotronCoreBonus()) * centrifugingCycles; - float dailyHeavyMachineryBroken = machineryBroken; + int dailyVolatilesSpent = (int) Math.ceil(VOLATILES_TO_CENTRIFUGE * centrifugingCycles); + int dailyFuelProduced = (int) Math.floor((FUEL_PRODUCED + ForgeConditionChecker.getSynchrotronCoreBonus()) * centrifugingCycles); + int dailyHeavyMachineryBroken = machineryBroken; fleet.getCargo().removeCommodity(Commodities.VOLATILES, dailyVolatilesSpent); fleet.getCargo().addCommodity(Commodities.FUEL, dailyFuelProduced); diff --git a/data/forge/abilities/conversion/ForgeConversionGeneral.java b/data/forge/abilities/conversion/ForgeConversionGeneral.java index d233774..89a443a 100644 --- a/data/forge/abilities/conversion/ForgeConversionGeneral.java +++ b/data/forge/abilities/conversion/ForgeConversionGeneral.java @@ -28,7 +28,7 @@ public static void applyForgingCRMalus(CampaignFleetAPI fleet, String forgeType) if ((!ForgeConditionChecker.isOperational(member))) continue; if (member.getVariant().hasHullMod(forgeType)) - member.getRepairTracker().applyCREvent(-(((float) CR_PRODUCTION_DECAY * ForgeConditionChecker.getForgingQuality()) * + member.getRepairTracker().applyCREvent(-((CR_PRODUCTION_DECAY * ForgeConditionChecker.getForgingQuality()) * (member.getRepairTracker().getCR() / 0.7f)), "Forged goods"); } } diff --git a/data/forge/abilities/conversion/ForgeManufacturingLogic.java b/data/forge/abilities/conversion/ForgeManufacturingLogic.java index ff9d2e0..b190c88 100644 --- a/data/forge/abilities/conversion/ForgeManufacturingLogic.java +++ b/data/forge/abilities/conversion/ForgeManufacturingLogic.java @@ -34,7 +34,7 @@ public static void manufactureSupplies(CampaignFleetAPI fleet) { float metalInManufacturing = ForgeConditionChecker.getPlayerCargo(Commodities.METALS) / METAL_TO_MANUFACTURE; float transplutonicsInManufacturing = ForgeConditionChecker.getPlayerCargo(Commodities.RARE_METALS) / TRANSPLUTONICS_TO_MANUFACTURE; - int manufacturingCycles = (int) (Math.min(manufacturingCapacity, + int manufacturingCycles = (int) Math.floor(Math.min(manufacturingCapacity, Math.min(machineryAvailableForManufacturing, Math.min(metalInManufacturing, transplutonicsInManufacturing)))); boolean willHeavyMachineryBreakdown = ForgeConditionChecker.getMachineryBreakdownChance(); @@ -42,14 +42,14 @@ public static void manufactureSupplies(CampaignFleetAPI fleet) { int machineryBroken = 0; for (int machineryInCheck = 0; machineryInCheck < MachineryInManufacturing; machineryInCheck++) { - if (Math.random() < ((float) BREAKDOWN_SEVERITY * ForgeConditionChecker.getForgingQuality())) + if (Math.random() < (BREAKDOWN_SEVERITY * ForgeConditionChecker.getForgingQuality())) machineryBroken++; } - float dailyMetalSpent = METAL_TO_MANUFACTURE * manufacturingCycles; - float dailyTransplutonicsSpent = TRANSPLUTONICS_TO_MANUFACTURE * manufacturingCycles; - float dailySuppliesProduced = (SUPPLIES_PRODUCED + ForgeConditionChecker.getNanoforgeManufacturingBonus()) * manufacturingCycles; - float dailyHeavyMachineryBroken = machineryBroken; + int dailyMetalSpent = (int) Math.ceil(METAL_TO_MANUFACTURE * manufacturingCycles); + int dailyTransplutonicsSpent = (int) Math.ceil(TRANSPLUTONICS_TO_MANUFACTURE * manufacturingCycles); + int dailySuppliesProduced = (int) Math.floor((SUPPLIES_PRODUCED + ForgeConditionChecker.getNanoforgeManufacturingBonus()) * manufacturingCycles); + int dailyHeavyMachineryBroken = machineryBroken; fleet.getCargo().removeCommodity(Commodities.METALS, dailyMetalSpent); fleet.getCargo().removeCommodity(Commodities.RARE_METALS, dailyTransplutonicsSpent); diff --git a/data/forge/abilities/conversion/ForgeRefiningLogic.java b/data/forge/abilities/conversion/ForgeRefiningLogic.java index ccf664f..7ef2f1d 100644 --- a/data/forge/abilities/conversion/ForgeRefiningLogic.java +++ b/data/forge/abilities/conversion/ForgeRefiningLogic.java @@ -35,19 +35,19 @@ public static void refineOre(CampaignFleetAPI fleet) { float oreInRefining = ForgeConditionChecker.getPlayerCargo(Commodities.ORE)/ ORE_TO_REFINE; - int refiningCycles = (int) (Math.min(refiningCapacity, Math.min(machineryAvailableForRefining, oreInRefining))); + int refiningCycles = (int) Math.floor(Math.min(refiningCapacity, Math.min(machineryAvailableForRefining, oreInRefining))); boolean willHeavyMachineryBreakdown = ForgeConditionChecker.getMachineryBreakdownChance(); int MachineryInRefining = (int) Math.ceil((refiningCycles * HEAVY_MACHINERY_REFINING_USAGE)); int machineryBroken = 0; for (int machineryInCheck = 0; machineryInCheck < MachineryInRefining; machineryInCheck++) { - if (Math.random()<((float) BREAKDOWN_SEVERITY * ForgeConditionChecker.getForgingQuality())) machineryBroken++; + if (Math.random()<(BREAKDOWN_SEVERITY * ForgeConditionChecker.getForgingQuality())) machineryBroken++; } - float dailyOreSpent = ORE_TO_REFINE * refiningCycles; - float dailyMetalProduced = (METAL_PRODUCED + ForgeConditionChecker.getCatalyticCoreBonus()) * refiningCycles; - float dailyHeavyMachineryBroken = machineryBroken; + int dailyOreSpent = (int) Math.ceil(ORE_TO_REFINE * refiningCycles); + int dailyMetalProduced = (int) Math.floor((METAL_PRODUCED + ForgeConditionChecker.getCatalyticCoreBonus()) * refiningCycles); + int dailyHeavyMachineryBroken = machineryBroken; fleet.getCargo().removeCommodity(Commodities.ORE, dailyOreSpent); fleet.getCargo().addCommodity(Commodities.METALS, dailyMetalProduced); @@ -79,19 +79,19 @@ public static void refineTransplutonicOre(CampaignFleetAPI fleet) { float transplutonicOreInRefining = ForgeConditionChecker.getPlayerCargo(Commodities.RARE_ORE) / TRANSPLUTONIC_ORE_TO_REFINE; - int refiningCycles = (int) (Math.min(refiningCapacity, Math.min(machineryAvailableForRefining, transplutonicOreInRefining))); + int refiningCycles = (int) Math.floor(Math.min(refiningCapacity, Math.min(machineryAvailableForRefining, transplutonicOreInRefining))); boolean willHeavyMachineryBreakdown = ForgeConditionChecker.getMachineryBreakdownChance(); int machineryInRefining = (int) Math.ceil((refiningCycles * HEAVY_MACHINERY_REFINING_USAGE)); int machineryBroken = 0; for (int machineryInCheck = 0; machineryInCheck < machineryInRefining; machineryInCheck++) { - if (Math.random()<((float) BREAKDOWN_SEVERITY * ForgeConditionChecker.getForgingQuality())) machineryBroken++; + if (Math.random()<(BREAKDOWN_SEVERITY * ForgeConditionChecker.getForgingQuality())) machineryBroken++; } - float dailyTransplutonicOreSpent = TRANSPLUTONIC_ORE_TO_REFINE * refiningCycles; - float dailyTransplutonicsProduced = (TRANSPLUTONICS_PRODUCED + ForgeConditionChecker.getCatalyticCoreBonus()) * refiningCycles; - float dailyHeavyMachineryBroken = machineryBroken; + int dailyTransplutonicOreSpent = (int) Math.ceil(TRANSPLUTONIC_ORE_TO_REFINE * refiningCycles); + int dailyTransplutonicsProduced = (int) Math.floor((TRANSPLUTONICS_PRODUCED + ForgeConditionChecker.getCatalyticCoreBonus()) * refiningCycles); + int dailyHeavyMachineryBroken = machineryBroken; fleet.getCargo().removeCommodity(Commodities.RARE_ORE, dailyTransplutonicOreSpent); fleet.getCargo().addCommodity(Commodities.RARE_METALS, dailyTransplutonicsProduced); diff --git a/data/forge/abilities/tooltip/ForgeTooltipBreakdown.java b/data/forge/abilities/tooltip/ForgeTooltipBreakdown.java index 61044c4..8d7274b 100644 --- a/data/forge/abilities/tooltip/ForgeTooltipBreakdown.java +++ b/data/forge/abilities/tooltip/ForgeTooltipBreakdown.java @@ -23,7 +23,6 @@ public static void addProductionBreakdown(TooltipMakerAPI tooltip) { Color textColor = Misc.getTextColor(); Color highlightColor = Misc.getHighlightColor(); Color negativeHighlight = Misc.getNegativeHighlightColor(); - Color positiveHighlight = Misc.getPositiveHighlightColor(); float pad = 10f; @@ -37,52 +36,23 @@ public static void addProductionBreakdown(TooltipMakerAPI tooltip) { tooltip.addSpacer(3f); int gridSize = 0; - float gridWidth = 195f; - tooltip.beginGridFlipped(gridWidth, 2, 40f, pad); + float gridWidth = 190f; + tooltip.beginGridFlipped(gridWidth, 2, 45f, pad); if (getForgingCapacity(fleet, REFINING) >= 1) { int maxMetalProductionCapacity = ((int) Math.ceil(getForgingCapacity(fleet, REFINING) * (METAL_PRODUCED + ForgeConditionChecker.getCatalyticCoreBonus()))); - String metalLabel = "Metal output."; + String metalLabel = "Metal / day"; tooltip.addToGrid(0, gridSize++, metalLabel, "+" + Misc.getWithDGS(maxMetalProductionCapacity), highlightColor); - String hasOre = " (Ore available)"; - if (ForgeConditionChecker.getPlayerCargo(Commodities.ORE) >= (ORE_TO_REFINE)) { - tooltip.setGridLabelColor(positiveHighlight); - tooltip.addToGrid(1, gridSize - 1, hasOre, "", positiveHighlight); - tooltip.setGridLabelColor(textColor); - } - - String hasNoOre = " (Halted: no ore)"; - if (ForgeConditionChecker.getPlayerCargo(Commodities.ORE) < (ORE_TO_REFINE)) { - tooltip.setGridLabelColor(negativeHighlight); - tooltip.addToGrid(1, gridSize - 1, hasNoOre, "", negativeHighlight); - tooltip.setGridLabelColor(textColor); - } - - int maxTransplutonicsProductionCapacity = (int) Math.ceil(getForgingCapacity(fleet, REFINING) * (TRANSPLUTONICS_PRODUCED + ForgeConditionChecker.getCatalyticCoreBonus())); - String transplutonicsLabel = "Transplutonics output."; + String transplutonicsLabel = "Transplutonics / day"; tooltip.addToGrid(0, gridSize++, transplutonicsLabel, "+" + Misc.getWithDGS(maxTransplutonicsProductionCapacity), highlightColor); - String hasTransplutonicOre = " (Ore available)"; - if (ForgeConditionChecker.getPlayerCargo(Commodities.RARE_ORE) >= (TRANSPLUTONIC_ORE_TO_REFINE)) { - tooltip.setGridLabelColor(positiveHighlight); - tooltip.addToGrid(1, gridSize - 1, hasTransplutonicOre, "", positiveHighlight); - tooltip.setGridLabelColor(textColor); - } - - String hasNoTransplutonicOre = " (Halted: no ore)"; - if (ForgeConditionChecker.getPlayerCargo(Commodities.RARE_ORE) < (TRANSPLUTONIC_ORE_TO_REFINE)) { - tooltip.setGridLabelColor(negativeHighlight); - tooltip.addToGrid(1, gridSize - 1, hasNoTransplutonicOre, "", negativeHighlight); - tooltip.setGridLabelColor(textColor); - } - } if (getForgingCapacity(fleet, CENTRIFUGING) >= 1) { @@ -91,7 +61,7 @@ public static void addProductionBreakdown(TooltipMakerAPI tooltip) { (FUEL_PRODUCED + ForgeConditionChecker.getSynchrotronCoreBonus())); String tanksAreFullFormat = "(Halted: tanks full)"; - String fuelLabel = "Fuel output."; + String fuelLabel = "Fuel / day"; tooltip.addToGrid(0, gridSize++, fuelLabel, "+" + Misc.getWithDGS(maxFuelProductionCapacity), highlightColor); @@ -107,7 +77,7 @@ public static void addProductionBreakdown(TooltipMakerAPI tooltip) { int maxSuppliesProductionCapacity = (int) Math.ceil(getForgingCapacity(fleet, MANUFACTURING) * (SUPPLIES_PRODUCED + ForgeConditionChecker.getNanoforgeManufacturingBonus())); - String suppliesLabel = "Supplies output."; + String suppliesLabel = "Supplies / day"; tooltip.addToGrid(0, gridSize++, suppliesLabel, "+" + Misc.getWithDGS(maxSuppliesProductionCapacity), highlightColor); @@ -117,7 +87,7 @@ public static void addProductionBreakdown(TooltipMakerAPI tooltip) { int maxHeavyMachineryProductionCapacity = (int) Math.ceil(getForgingCapacity(fleet, ASSEMBLING) * (HEAVY_MACHINERY_PRODUCED + ForgeConditionChecker.getNanoforgeAssemblingBonus())); - String machineryLabel = "Machinery output."; + String machineryLabel = "Machinery / day"; tooltip.addToGrid(0, gridSize++, machineryLabel, "+" + Misc.getWithDGS(maxHeavyMachineryProductionCapacity), highlightColor); @@ -151,8 +121,8 @@ public static void addMachineryRequirementLine(TooltipMakerAPI tooltip) { String machineryNeeded = Misc.getWithDGS(maxMachineryNeededFinal); String machineryAvailable = Misc.getWithDGS(heavyMachineryAvailable); - String demandMetFormat = "%sUsing all %s needed heavy machinery."; - String demandNotMetFormat = "%sUsing %s (out of %s needed) machinery."; + String demandMetFormat = "%sUsing all %s needed heavy machinery:"; + String demandNotMetFormat = "%sUsing %s (out of %s needed) machinery:"; if (heavyMachineryAvailable >= maxMachineryNeededFinal ) { tooltip.addPara(demandMetFormat, pad, positiveHighlights, indent, machineryNeeded); diff --git a/data/forge/abilities/tooltip/ForgeTooltipItems.java b/data/forge/abilities/tooltip/ForgeTooltipItems.java index aabd60f..0c02cca 100644 --- a/data/forge/abilities/tooltip/ForgeTooltipItems.java +++ b/data/forge/abilities/tooltip/ForgeTooltipItems.java @@ -27,7 +27,7 @@ public static void addCorruptedNanoforgeNote(TooltipMakerAPI tooltip) { int assemblingCapacity = (int) Math.ceil(getForgingCapacity(fleet, ASSEMBLING)); String manufacturingBonus = Misc.getWithDGS((int) Math.ceil(CORRUPTED_NANOFORGE_MANUFACTURING_BONUS * manufacturingCapacity)); String assemblingBonus = Misc.getWithDGS((int) Math.ceil(CORRUPTED_NANOFORGE_ASSEMBLING_BONUS * assemblingCapacity)); - String qualityBonus = ((int)(100-((float) CORRUPTED_NANOFORGE_QUALITY_BONUS*100)) + "%"); + String qualityBonus = ((int)(100-(CORRUPTED_NANOFORGE_QUALITY_BONUS*100)) + "%"); String nanoforge = "Corrupted Nanoforge"; String formatNoCapacity = "%s increases output of supplies, increases output of heavy machinery, and reduces " + "breakdowns and CR loss by %s."; @@ -65,7 +65,7 @@ public static void addPristineNanoforgeNote(TooltipMakerAPI tooltip) { int assemblingCapacity = (int) Math.ceil(getForgingCapacity(fleet, ASSEMBLING)); String manufacturingBonus = Misc.getWithDGS((int) Math.ceil(PRISTINE_NANOFORGE_MANUFACTURING_BONUS * manufacturingCapacity)); String assemblingBonus = Misc.getWithDGS((int) Math.ceil(PRISTINE_NANOFORGE_ASSEMBLING_BONUS * assemblingCapacity)); - String qualityBonus = ((int)(100-((float) PRISTINE_NANOFORGE_QUALITY_BONUS*100)) + "%"); + String qualityBonus = ((int)(100-(PRISTINE_NANOFORGE_QUALITY_BONUS*100)) + "%"); String nanoforge = "Pristine Nanoforge"; String formatNoCapacity = "%s increases output of supplies, increases output of heavy machinery, and reduces " + "breakdowns and CR loss by %s."; diff --git a/data/forge/campaign/ForgeConditionChecker.java b/data/forge/campaign/ForgeConditionChecker.java index 7710f88..6a1b576 100644 --- a/data/forge/campaign/ForgeConditionChecker.java +++ b/data/forge/campaign/ForgeConditionChecker.java @@ -1,5 +1,8 @@ package data.forge.campaign; +import java.util.List; +import java.util.ArrayList; + import com.fs.starfarer.api.Global; import com.fs.starfarer.api.campaign.CampaignFleetAPI; import com.fs.starfarer.api.campaign.CargoAPI; @@ -13,18 +16,13 @@ import data.forge.hullmods.ForgeHullmodsGeneral; import data.forge.plugins.ForgeSettings; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - import static data.forge.plugins.ForgeSettings.BASE_BREAKDOWN_CHANCE; import static data.forge.plugins.ForgeSettings.FUEL_PRODUCED; public class ForgeConditionChecker { public static boolean getMachineryBreakdownChance() { - return (Math.random()<((float) BASE_BREAKDOWN_CHANCE * ForgeConditionChecker.getForgingQuality())); + return (Math.random()<(BASE_BREAKDOWN_CHANCE * ForgeConditionChecker.getForgingQuality())); } public static boolean areFuelTanksFull(CampaignFleetAPI fleet) { @@ -61,10 +59,10 @@ public static boolean hasAnySpecialItem() { public static float getForgingQuality() { if (hasSpecialItem(Items.PRISTINE_NANOFORGE)) { - return (float) ForgeSettings.PRISTINE_NANOFORGE_QUALITY_BONUS; + return ForgeSettings.PRISTINE_NANOFORGE_QUALITY_BONUS; } if (hasSpecialItem(Items.CORRUPTED_NANOFORGE)) { - return (float) ForgeSettings.CORRUPTED_NANOFORGE_QUALITY_BONUS; + return ForgeSettings.CORRUPTED_NANOFORGE_QUALITY_BONUS; } return 1f; } @@ -85,20 +83,20 @@ public static float getSynchrotronCoreBonus() { public static float getNanoforgeManufacturingBonus() { if (hasSpecialItem(Items.PRISTINE_NANOFORGE)) { - return (float) ForgeSettings.PRISTINE_NANOFORGE_MANUFACTURING_BONUS; + return ForgeSettings.PRISTINE_NANOFORGE_MANUFACTURING_BONUS; } if (hasSpecialItem(Items.CORRUPTED_NANOFORGE)) { - return (float) ForgeSettings.CORRUPTED_NANOFORGE_MANUFACTURING_BONUS; + return ForgeSettings.CORRUPTED_NANOFORGE_MANUFACTURING_BONUS; } return 0f; } public static float getNanoforgeAssemblingBonus() { if (hasSpecialItem(Items.PRISTINE_NANOFORGE)) { - return (float) ForgeSettings.PRISTINE_NANOFORGE_ASSEMBLING_BONUS; + return ForgeSettings.PRISTINE_NANOFORGE_ASSEMBLING_BONUS; } if (hasSpecialItem(Items.CORRUPTED_NANOFORGE)) { - return (float) ForgeSettings.CORRUPTED_NANOFORGE_ASSEMBLING_BONUS; + return ForgeSettings.CORRUPTED_NANOFORGE_ASSEMBLING_BONUS; } return 0f; } diff --git a/data/forge/hullmods/ForgeAssemblyModule.java b/data/forge/hullmods/ForgeAssemblyModule.java index f7b1de9..60a0496 100644 --- a/data/forge/hullmods/ForgeAssemblyModule.java +++ b/data/forge/hullmods/ForgeAssemblyModule.java @@ -79,13 +79,19 @@ public void addPostDescriptionSection(TooltipMakerAPI tooltip, ShipAPI.HullSize highlightColor, highlightColor, highlightColor }; - String heavyMachinery = String.valueOf(((int)(ForgeSettings.HEAVY_MACHINERY_PRODUCED) * getShipCapacityMod(ship,hullSize))); - String metal = String.valueOf(((int)(ForgeSettings.METAL_TO_ASSEMBLE) * getShipCapacityMod(ship,hullSize))); - String transplutonics = String.valueOf(((int)(ForgeSettings.TRANSPLUTONICS_TO_ASSEMBLE) * getShipCapacityMod(ship,hullSize))); + String heavyMachinery = String.valueOf((int)(ForgeSettings.HEAVY_MACHINERY_PRODUCED * getShipCapacityMod(ship,hullSize))); + String metal = String.valueOf((int)(ForgeSettings.METAL_TO_ASSEMBLE * getShipCapacityMod(ship,hullSize))); + String transplutonics = String.valueOf((int)(ForgeSettings.TRANSPLUTONICS_TO_ASSEMBLE * getShipCapacityMod(ship,hullSize))); String firstLine = " • Assembles %s heavy machinery from %s metal and %s transplutonics."; + String firstLineNoCapacity = " • Assembles heavy machinery from metal and transplutonics."; - tooltip.addPara(firstLine, pad, firstLineHighlights, heavyMachinery, metal, transplutonics); + if (getShipCapacityMod(ship,hullSize) >= 1) { + tooltip.addPara(firstLine, pad, firstLineHighlights, heavyMachinery, metal, transplutonics); + } + if (getShipCapacityMod(ship,hullSize) < 1) { + tooltip.addPara(firstLineNoCapacity, pad); + } //Here: Second line @@ -93,12 +99,18 @@ public void addPostDescriptionSection(TooltipMakerAPI tooltip, ShipAPI.HullSize highlightColor, highlightColor }; - String heavyMachineryUsage = String.valueOf((int)(ForgeSettings.HEAVY_MACHINERY_ASSEMBLING_USAGE) * getShipCapacityMod(ship,hullSize)); - String breakdownChance = ((int)((float) ForgeSettings.BASE_BREAKDOWN_CHANCE * 100) + "%"); + String heavyMachineryUsage = String.valueOf((int)(ForgeSettings.HEAVY_MACHINERY_ASSEMBLING_USAGE * getShipCapacityMod(ship,hullSize))); + String breakdownChance = ((int)(ForgeSettings.BASE_BREAKDOWN_CHANCE * 100) + "%"); String secondLine = " • Uses %s heavy machinery, with %s chance of breakdown." ; + String secondLineNoCapacity = " • Uses heavy machinery, with %s chance of breakdown." ; - tooltip.addPara(secondLine, 2f, secondLineHighlights, heavyMachineryUsage, breakdownChance); + if (getShipCapacityMod(ship,hullSize) >= 1) { + tooltip.addPara(secondLine, 2f, secondLineHighlights, heavyMachineryUsage, breakdownChance); + } + if (getShipCapacityMod(ship,hullSize) < 1) { + tooltip.addPara(secondLineNoCapacity, 2f, highlightColor, breakdownChance); + } //Here: Third line diff --git a/data/forge/hullmods/ForgeCentrifugeModule.java b/data/forge/hullmods/ForgeCentrifugeModule.java index 9366f69..c124e89 100644 --- a/data/forge/hullmods/ForgeCentrifugeModule.java +++ b/data/forge/hullmods/ForgeCentrifugeModule.java @@ -79,12 +79,18 @@ public void addPostDescriptionSection(TooltipMakerAPI tooltip, ShipAPI.HullSize highlightColor, highlightColor, highlightColor, highlightColor }; - String volatiles = String.valueOf(((int)(ForgeSettings.VOLATILES_TO_CENTRIFUGE) * getShipCapacityMod(ship,hullSize))); - String fuel = String.valueOf(((int)(ForgeSettings.FUEL_PRODUCED) * getShipCapacityMod(ship,hullSize))); + String volatiles = String.valueOf((int)(ForgeSettings.VOLATILES_TO_CENTRIFUGE * getShipCapacityMod(ship,hullSize))); + String fuel = String.valueOf((int)(ForgeSettings.FUEL_PRODUCED * getShipCapacityMod(ship,hullSize))); String firstLine = " • Centrifuges %s fuel from %s volatiles."; + String firstLineNoCapacity = " • Centrifuges fuel from volatiles."; - tooltip.addPara(firstLine, pad, firstLineHighlights, fuel, volatiles); + if (getShipCapacityMod(ship,hullSize) >= 1) { + tooltip.addPara(firstLine, pad, firstLineHighlights, fuel, volatiles); + } + if (getShipCapacityMod(ship,hullSize) < 1) { + tooltip.addPara(firstLineNoCapacity, pad); + } //Here: Second line @@ -92,12 +98,18 @@ public void addPostDescriptionSection(TooltipMakerAPI tooltip, ShipAPI.HullSize highlightColor, highlightColor }; - String heavyMachineryUsage = String.valueOf((int)(ForgeSettings.HEAVY_MACHINERY_CENTRIFUGING_USAGE) * getShipCapacityMod(ship,hullSize)); - String breakdownChance = ((int)((float) ForgeSettings.BASE_BREAKDOWN_CHANCE * 100) + "%"); + String heavyMachineryUsage = String.valueOf((int)(ForgeSettings.HEAVY_MACHINERY_CENTRIFUGING_USAGE * getShipCapacityMod(ship,hullSize))); + String breakdownChance = ((int)(ForgeSettings.BASE_BREAKDOWN_CHANCE * 100) + "%"); String secondLine = " • Uses %s heavy machinery, with %s chance of breakdown." ; + String secondLineNoCapacity = " • Uses heavy machinery, with %s chance of breakdown." ; - tooltip.addPara(secondLine, 2f, secondLineHighlights, heavyMachineryUsage, breakdownChance); + if (getShipCapacityMod(ship,hullSize) >= 1) { + tooltip.addPara(secondLine, 2f, secondLineHighlights, heavyMachineryUsage, breakdownChance); + } + if (getShipCapacityMod(ship,hullSize) < 1) { + tooltip.addPara(secondLineNoCapacity, 2f, highlightColor, breakdownChance); + } //Here: Third line diff --git a/data/forge/hullmods/ForgeHullmodsGeneral.java b/data/forge/hullmods/ForgeHullmodsGeneral.java index 98ba956..98fd438 100644 --- a/data/forge/hullmods/ForgeHullmodsGeneral.java +++ b/data/forge/hullmods/ForgeHullmodsGeneral.java @@ -24,15 +24,15 @@ public class ForgeHullmodsGeneral { ALL_FORGE_HULLMODS.add("forge_assembly_module"); } - public static final Map shipSizeEffect = new HashMap<>(); + public static Map shipSizeEffect = new HashMap<>(); static { shipSizeEffect.put(ShipAPI.HullSize.DEFAULT, 0); shipSizeEffect.put(ShipAPI.HullSize.FIGHTER, 0); shipSizeEffect.put(ShipAPI.HullSize.FRIGATE, 0); shipSizeEffect.put(ShipAPI.HullSize.DESTROYER, 0); - shipSizeEffect.put(ShipAPI.HullSize.CRUISER, 4); - shipSizeEffect.put(ShipAPI.HullSize.CAPITAL_SHIP, 6); + shipSizeEffect.put(ShipAPI.HullSize.CRUISER, ForgeSettings.CAPACITY_CRUISER); + shipSizeEffect.put(ShipAPI.HullSize.CAPITAL_SHIP, ForgeSettings.CAPACITY_CAPITAL); } @@ -93,14 +93,14 @@ public static boolean hasCargoCapacity(ShipAPI ship) { public static int getShipCapacityMod (ShipAPI ship, ShipAPI.HullSize hullSize) { int shipSize = shipSizeEffect.get(hullSize); float getCurrentCR = (ship.getFleetMember().getRepairTracker().getCR() / 0.7f); - return (int) Math.ceil((shipSize) * getCurrentCR); + return (int) Math.ceil(shipSize * getCurrentCR); } public static void addCRNoteLine(TooltipMakerAPI tooltip) { Color [] thirdLineHighlights = {Misc.getHighlightColor()}; - String crDecrease = ((int)(((float) ForgeSettings.CR_PRODUCTION_DECAY)*100) + "%"); + String crDecrease = ((int)(( ForgeSettings.CR_PRODUCTION_DECAY)*100) + "%"); String CRNoteLine = " • Refining drains %s CR per day. Ships with low CR have lowered output and lose less CR." ; tooltip.addPara(CRNoteLine, 2f, thirdLineHighlights, crDecrease); @@ -111,7 +111,7 @@ public static void addInactiveLine(TooltipMakerAPI tooltip) { Color [] thirdLineHighlights = {Misc.getHighlightColor()}; - String crDecrease = ((int)(((float) ForgeSettings.CR_PRODUCTION_DECAY)*100) + "%"); + String crDecrease = ((int)(( ForgeSettings.CR_PRODUCTION_DECAY)*100) + "%"); String InactiveLine = " • Ships that are mothballed or do not receive repairs cannot activate their forge modules." ; tooltip.addPara(InactiveLine, 2f, thirdLineHighlights, crDecrease); diff --git a/data/forge/hullmods/ForgeManufactureModule.java b/data/forge/hullmods/ForgeManufactureModule.java index c5cc5e0..16bbd95 100644 --- a/data/forge/hullmods/ForgeManufactureModule.java +++ b/data/forge/hullmods/ForgeManufactureModule.java @@ -3,7 +3,6 @@ import com.fs.starfarer.api.combat.BaseHullMod; import com.fs.starfarer.api.combat.MutableShipStatsAPI; import com.fs.starfarer.api.combat.ShipAPI; -import com.fs.starfarer.api.impl.campaign.ids.HullMods; import com.fs.starfarer.api.ui.Alignment; import com.fs.starfarer.api.ui.TooltipMakerAPI; import com.fs.starfarer.api.util.Misc; @@ -80,13 +79,19 @@ public void addPostDescriptionSection(TooltipMakerAPI tooltip, ShipAPI.HullSize highlightColor, highlightColor, highlightColor }; - String supplies = String.valueOf(((int)(ForgeSettings.SUPPLIES_PRODUCED) * getShipCapacityMod(ship,hullSize))); - String metal = String.valueOf(((int)(ForgeSettings.METAL_TO_MANUFACTURE) * getShipCapacityMod(ship,hullSize))); - String transplutonics = String.valueOf(((int)(ForgeSettings.TRANSPLUTONICS_TO_MANUFACTURE) * getShipCapacityMod(ship,hullSize))); + String supplies = String.valueOf((int)(ForgeSettings.SUPPLIES_PRODUCED * getShipCapacityMod(ship,hullSize))); + String metal = String.valueOf((int)(ForgeSettings.METAL_TO_MANUFACTURE * getShipCapacityMod(ship,hullSize))); + String transplutonics = String.valueOf((int)(ForgeSettings.TRANSPLUTONICS_TO_MANUFACTURE * getShipCapacityMod(ship,hullSize))); String firstLine = " • Manufactures %s supplies from %s metal and %s transplutonics."; + String firstLineNoCapacity = " • Manufactures supplies from metal and transplutonics."; - tooltip.addPara(firstLine, pad, firstLineHighlights, supplies, metal, transplutonics); + if (getShipCapacityMod(ship,hullSize) >= 1) { + tooltip.addPara(firstLine, pad, firstLineHighlights, supplies, metal, transplutonics); + } + if (getShipCapacityMod(ship,hullSize) < 1) { + tooltip.addPara(firstLineNoCapacity, pad); + } //Here: Second line @@ -94,12 +99,18 @@ public void addPostDescriptionSection(TooltipMakerAPI tooltip, ShipAPI.HullSize highlightColor, highlightColor }; - String heavyMachineryUsage = String.valueOf((int)(ForgeSettings.HEAVY_MACHINERY_MANUFACTURING_USAGE) * getShipCapacityMod(ship,hullSize)); - String breakdownChance = ((int)((float) ForgeSettings.BASE_BREAKDOWN_CHANCE * 100) + "%"); + String heavyMachineryUsage = String.valueOf((int)(ForgeSettings.HEAVY_MACHINERY_MANUFACTURING_USAGE * getShipCapacityMod(ship,hullSize))); + String breakdownChance = ((int)(ForgeSettings.BASE_BREAKDOWN_CHANCE * 100) + "%"); String secondLine = " • Uses %s heavy machinery, with %s chance of breakdown." ; + String secondLineNoCapacity = " • Uses heavy machinery, with %s chance of breakdown." ; - tooltip.addPara(secondLine, 2f, secondLineHighlights, heavyMachineryUsage, breakdownChance); + if (getShipCapacityMod(ship,hullSize) >= 1) { + tooltip.addPara(secondLine, 2f, secondLineHighlights, heavyMachineryUsage, breakdownChance); + } + if (getShipCapacityMod(ship,hullSize) < 1) { + tooltip.addPara(secondLineNoCapacity, 2f, highlightColor, breakdownChance); + } //Here: Third line diff --git a/data/forge/hullmods/ForgeRefineryModule.java b/data/forge/hullmods/ForgeRefineryModule.java index 0729c2b..9d59b82 100644 --- a/data/forge/hullmods/ForgeRefineryModule.java +++ b/data/forge/hullmods/ForgeRefineryModule.java @@ -7,7 +7,6 @@ import com.fs.starfarer.api.combat.BaseHullMod; import com.fs.starfarer.api.combat.MutableShipStatsAPI; import com.fs.starfarer.api.combat.ShipAPI; -import com.fs.starfarer.api.impl.campaign.ids.HullMods; import com.fs.starfarer.api.ui.TooltipMakerAPI; import com.fs.starfarer.api.ui.Alignment; import com.fs.starfarer.api.util.Misc; @@ -79,15 +78,22 @@ public void addPostDescriptionSection(TooltipMakerAPI tooltip, ShipAPI.HullSize highlightColor, highlightColor, highlightColor, highlightColor }; - String ore = String.valueOf(((int)(ForgeSettings.ORE_TO_REFINE) * getShipCapacityMod(ship,hullSize))); - String metal = String.valueOf(((int)(ForgeSettings.METAL_PRODUCED) * getShipCapacityMod(ship,hullSize))); - String transplutonicOre = String.valueOf(((int)(ForgeSettings.TRANSPLUTONIC_ORE_TO_REFINE) * getShipCapacityMod(ship,hullSize))); - String transplutonics = String.valueOf(((int)(ForgeSettings.TRANSPLUTONICS_PRODUCED) * getShipCapacityMod(ship,hullSize))); + String ore = String.valueOf((int)(ForgeSettings.ORE_TO_REFINE * getShipCapacityMod(ship,hullSize))); + String metal = String.valueOf((int)(ForgeSettings.METAL_PRODUCED * getShipCapacityMod(ship,hullSize))); + String transplutonicOre = String.valueOf((int)(ForgeSettings.TRANSPLUTONIC_ORE_TO_REFINE * getShipCapacityMod(ship,hullSize))); + String transplutonics = String.valueOf((int)(ForgeSettings.TRANSPLUTONICS_PRODUCED * getShipCapacityMod(ship,hullSize))); String firstLine = " • Refines %s metal from %s ore and %s transplutonics from %s transplutonic ore."; + String firstLineNoCapacity = " • Refines metal from ore and transplutonics from transplutonic ore."; - tooltip.addPara(firstLine, pad, firstLineHighlights, - metal, ore, transplutonics, transplutonicOre); + if (getShipCapacityMod(ship,hullSize) >= 1) { + tooltip.addPara(firstLine, pad, firstLineHighlights, + metal, ore, transplutonics, transplutonicOre); + } + + if (getShipCapacityMod(ship,hullSize) < 1) { + tooltip.addPara(firstLineNoCapacity, pad); + } //Here: Second line @@ -95,12 +101,18 @@ public void addPostDescriptionSection(TooltipMakerAPI tooltip, ShipAPI.HullSize highlightColor, highlightColor }; - String heavyMachineryUsage = String.valueOf((int)(ForgeSettings.HEAVY_MACHINERY_REFINING_USAGE) * getShipCapacityMod(ship,hullSize)); - String breakdownChance = ((int)((float) ForgeSettings.BASE_BREAKDOWN_CHANCE * 100) + "%"); + String heavyMachineryUsage = String.valueOf((int)(ForgeSettings.HEAVY_MACHINERY_REFINING_USAGE * getShipCapacityMod(ship,hullSize))); + String breakdownChance = ((int)(ForgeSettings.BASE_BREAKDOWN_CHANCE * 100) + "%"); String secondLine = " • Uses %s heavy machinery, with %s chance of breakdown." ; + String secondLineNoCapacity = " • Uses heavy machinery, with %s chance of breakdown." ; + if (getShipCapacityMod(ship,hullSize) >= 1) { tooltip.addPara(secondLine, 2f, secondLineHighlights, heavyMachineryUsage, breakdownChance); + } + if (getShipCapacityMod(ship,hullSize) < 1) { + tooltip.addPara(secondLineNoCapacity, 2f, highlightColor, breakdownChance); + } //Here: Third line diff --git a/data/forge/plugins/ForgeDataSupplier.java b/data/forge/plugins/ForgeDataSupplier.java index 50896f2..f57370d 100644 --- a/data/forge/plugins/ForgeDataSupplier.java +++ b/data/forge/plugins/ForgeDataSupplier.java @@ -1,6 +1,8 @@ package data.forge.plugins; import java.io.IOException; +import java.math.BigDecimal; + import org.json.JSONException; import org.json.JSONObject; @@ -13,6 +15,7 @@ public static void loadSettings(String fileName) throws IOException, JSONExcepti JSONObject settings = Global.getSettings().loadJSON(fileName); // Here: Miscellaneous Settings + ForgeSettings.ENABLE_PENALTIES = settings.getBoolean("forge_enable_ability_penalties"); ForgeSettings.SENSOR_PROFILE_INCREASE = settings.getInt("forge_sensor_profile_increase"); ForgeSettings.SHIP_LIST_SIZE = settings.getInt("forge_ship_list_size"); @@ -21,46 +24,50 @@ public static void loadSettings(String fileName) throws IOException, JSONExcepti ForgeSettings.SHOW_NOTIFICATION = settings.getBoolean("forge_show_notification"); ForgeSettings.NOTIFICATION_INTERVAL = settings.getInt("forge_notification_interval"); + // Here: Capacity Settings + ForgeSettings.CAPACITY_CRUISER = settings.getInt("forge_capacity_cruiser"); + ForgeSettings.CAPACITY_CAPITAL = settings.getInt("forge_capacity_capital"); + // Here: Refining Settings - ForgeSettings.ORE_TO_REFINE = settings.getInt("forge_ore_to_refine"); - ForgeSettings.METAL_PRODUCED = settings.getInt("forge_metal_produced"); - ForgeSettings.TRANSPLUTONIC_ORE_TO_REFINE = settings.getInt("forge_transplutonic_ore_to_refine"); - ForgeSettings.TRANSPLUTONICS_PRODUCED = settings.getInt("forge_transplutonics_produced"); - ForgeSettings.HEAVY_MACHINERY_REFINING_USAGE = settings.getInt("forge_heavy_machinery_refining_usage"); + ForgeSettings.ORE_TO_REFINE = Float.parseFloat(settings.getString("forge_ore_to_refine")); + ForgeSettings.METAL_PRODUCED = Float.parseFloat(settings.getString("forge_metal_produced")); + ForgeSettings.TRANSPLUTONIC_ORE_TO_REFINE = Float.parseFloat(settings.getString("forge_transplutonic_ore_to_refine")); + ForgeSettings.TRANSPLUTONICS_PRODUCED = Float.parseFloat(settings.getString("forge_transplutonics_produced")); + ForgeSettings.HEAVY_MACHINERY_REFINING_USAGE = Float.parseFloat(settings.getString("forge_heavy_machinery_refining_usage")); // Here: Centrifuging Settings - ForgeSettings.VOLATILES_TO_CENTRIFUGE = settings.getInt("forge_volatiles_to_centrifuge"); - ForgeSettings.FUEL_PRODUCED = settings.getInt("forge_fuel_produced"); - ForgeSettings.HEAVY_MACHINERY_CENTRIFUGING_USAGE = settings.getInt("forge_heavy_machinery_centrifuging_usage"); + ForgeSettings.VOLATILES_TO_CENTRIFUGE = Float.parseFloat(settings.getString("forge_volatiles_to_centrifuge")); + ForgeSettings.FUEL_PRODUCED = Float.parseFloat(settings.getString("forge_fuel_produced")); + ForgeSettings.HEAVY_MACHINERY_CENTRIFUGING_USAGE = Float.parseFloat(settings.getString("forge_heavy_machinery_centrifuging_usage")); // Here: Manufacturing Settings - ForgeSettings.METAL_TO_MANUFACTURE = settings.getInt("forge_metal_to_manufacture"); - ForgeSettings.TRANSPLUTONICS_TO_MANUFACTURE = settings.getInt("forge_transplutonics_to_manufacture"); - ForgeSettings.SUPPLIES_PRODUCED = settings.getInt("forge_supplies_produced"); - ForgeSettings.HEAVY_MACHINERY_MANUFACTURING_USAGE = settings.getInt("forge_heavy_machinery_manufacturing_usage"); + ForgeSettings.METAL_TO_MANUFACTURE = Float.parseFloat(settings.getString("forge_metal_to_manufacture")); + ForgeSettings.TRANSPLUTONICS_TO_MANUFACTURE = Float.parseFloat(settings.getString("forge_transplutonics_to_manufacture")); + ForgeSettings.SUPPLIES_PRODUCED = Float.parseFloat(settings.getString("forge_supplies_produced")); + ForgeSettings.HEAVY_MACHINERY_MANUFACTURING_USAGE = Float.parseFloat(settings.getString("forge_heavy_machinery_manufacturing_usage")); // Here: Assembling Settings - ForgeSettings.METAL_TO_ASSEMBLE = settings.getInt("forge_metal_to_assemble"); - ForgeSettings.TRANSPLUTONICS_TO_ASSEMBLE = settings.getInt("forge_transplutonics_to_assemble"); - ForgeSettings.HEAVY_MACHINERY_PRODUCED = settings.getInt("forge_heavy_machinery_produced"); - ForgeSettings.HEAVY_MACHINERY_ASSEMBLING_USAGE = settings.getInt("forge_heavy_machinery_assembling_usage"); + ForgeSettings.METAL_TO_ASSEMBLE = Float.parseFloat(settings.getString("forge_metal_to_assemble")); + ForgeSettings.TRANSPLUTONICS_TO_ASSEMBLE = Float.parseFloat(settings.getString("forge_transplutonics_to_assemble")); + ForgeSettings.HEAVY_MACHINERY_PRODUCED = Float.parseFloat(settings.getString("forge_heavy_machinery_produced")); + ForgeSettings.HEAVY_MACHINERY_ASSEMBLING_USAGE = Float.parseFloat(settings.getString("forge_heavy_machinery_assembling_usage")); // Here: Machinery Breakdown Settings - ForgeSettings.BASE_BREAKDOWN_CHANCE = settings.getDouble("forge_base_heavy_machinery_breakdown_chance"); - ForgeSettings.BREAKDOWN_SEVERITY = settings.getDouble("forge_heavy_machinery_breakdown_severity"); + ForgeSettings.BASE_BREAKDOWN_CHANCE = Float.parseFloat(settings.getString("forge_base_heavy_machinery_breakdown_chance")); + ForgeSettings.BREAKDOWN_SEVERITY = Float.parseFloat(settings.getString("forge_heavy_machinery_breakdown_severity")); // Here: CR Settings - ForgeSettings.CR_PRODUCTION_DECAY = settings.getDouble("forge_combat_readiness_decay_when_producing"); + ForgeSettings.CR_PRODUCTION_DECAY = Float.parseFloat(settings.getString("forge_combat_readiness_decay_when_producing")); // Here: Special Item Settings - ForgeSettings.CORRUPTED_NANOFORGE_QUALITY_BONUS = settings.getDouble("forge_corrupted_nanoforge_quality_bonus"); - ForgeSettings.PRISTINE_NANOFORGE_QUALITY_BONUS = settings.getDouble("forge_pristine_nanoforge_quality_bonus"); - ForgeSettings.CATALYTIC_CORE_REFINING_BONUS = settings.getInt("forge_catalytic_core_refining_bonus"); - ForgeSettings.SYNCHROTRON_CORE_CENTRIFUGING_BONUS = settings.getInt("forge_synchrotron_core_centrifuging_bonus"); - ForgeSettings.CORRUPTED_NANOFORGE_MANUFACTURING_BONUS = settings.getInt("forge_corrupted_nanoforge_manufacturing_bonus"); - ForgeSettings.PRISTINE_NANOFORGE_MANUFACTURING_BONUS = settings.getInt("forge_pristine_nanoforge_manufacturing_bonus"); - ForgeSettings.CORRUPTED_NANOFORGE_ASSEMBLING_BONUS = settings.getInt("forge_corrupted_nanoforge_assembling_bonus"); - ForgeSettings.PRISTINE_NANOFORGE_ASSEMBLING_BONUS = settings.getInt("forge_pristine_nanoforge_assembling_bonus"); + ForgeSettings.CORRUPTED_NANOFORGE_QUALITY_BONUS = Float.parseFloat(settings.getString("forge_corrupted_nanoforge_quality_bonus")); + ForgeSettings.PRISTINE_NANOFORGE_QUALITY_BONUS = Float.parseFloat(settings.getString("forge_pristine_nanoforge_quality_bonus")); + ForgeSettings.CATALYTIC_CORE_REFINING_BONUS = Float.parseFloat(settings.getString("forge_catalytic_core_refining_bonus")); + ForgeSettings.SYNCHROTRON_CORE_CENTRIFUGING_BONUS = Float.parseFloat(settings.getString("forge_synchrotron_core_centrifuging_bonus")); + ForgeSettings.CORRUPTED_NANOFORGE_MANUFACTURING_BONUS = Float.parseFloat(settings.getString("forge_corrupted_nanoforge_manufacturing_bonus")); + ForgeSettings.PRISTINE_NANOFORGE_MANUFACTURING_BONUS = Float.parseFloat(settings.getString("forge_pristine_nanoforge_manufacturing_bonus")); + ForgeSettings.CORRUPTED_NANOFORGE_ASSEMBLING_BONUS = Float.parseFloat(settings.getString("forge_corrupted_nanoforge_assembling_bonus")); + ForgeSettings.PRISTINE_NANOFORGE_ASSEMBLING_BONUS = Float.parseFloat(settings.getString("forge_pristine_nanoforge_assembling_bonus")); } diff --git a/data/forge/plugins/ForgeSettings.java b/data/forge/plugins/ForgeSettings.java index 4a85341..2f2e610 100644 --- a/data/forge/plugins/ForgeSettings.java +++ b/data/forge/plugins/ForgeSettings.java @@ -3,6 +3,7 @@ public class ForgeSettings { // Here: Miscellaneous Settings + public static boolean ENABLE_PENALTIES = true; public static float SENSOR_PROFILE_INCREASE = 100; // Unused for now public static int SHIP_LIST_SIZE = 5; @@ -11,45 +12,49 @@ public class ForgeSettings { public static boolean SHOW_NOTIFICATION = true; public static int NOTIFICATION_INTERVAL = 3; + // Here: Capacity Settings + public static int CAPACITY_CRUISER = 40; + public static int CAPACITY_CAPITAL = 60; + // Here: Refining Settings - public static float ORE_TO_REFINE = 20; - public static float METAL_PRODUCED = 12; - public static float TRANSPLUTONIC_ORE_TO_REFINE = 10; - public static float TRANSPLUTONICS_PRODUCED = 6; - public static float HEAVY_MACHINERY_REFINING_USAGE = 6; + public static float ORE_TO_REFINE = 2f; + public static float METAL_PRODUCED = 1.2f; + public static float TRANSPLUTONIC_ORE_TO_REFINE = 1f; + public static float TRANSPLUTONICS_PRODUCED = 0.6f; + public static float HEAVY_MACHINERY_REFINING_USAGE = 0.6f; // Here: Centrifuging Settings - public static float VOLATILES_TO_CENTRIFUGE = 2; - public static float FUEL_PRODUCED = 24; - public static float HEAVY_MACHINERY_CENTRIFUGING_USAGE = 8; + public static float VOLATILES_TO_CENTRIFUGE = 0.1f; + public static float FUEL_PRODUCED = 1.2f; + public static float HEAVY_MACHINERY_CENTRIFUGING_USAGE = 0.8f; // Here: Manufacturing Settings - public static float METAL_TO_MANUFACTURE = 12; - public static float TRANSPLUTONICS_TO_MANUFACTURE = 2; - public static float SUPPLIES_PRODUCED = 8; - public static float HEAVY_MACHINERY_MANUFACTURING_USAGE = 10; + public static float METAL_TO_MANUFACTURE = 0.8f; + public static float TRANSPLUTONICS_TO_MANUFACTURE = 0.2f; + public static float SUPPLIES_PRODUCED = 0.4f; + public static float HEAVY_MACHINERY_MANUFACTURING_USAGE = 1f; // Here: Assembling Settings - public static float METAL_TO_ASSEMBLE = 20; - public static float TRANSPLUTONICS_TO_ASSEMBLE = 2; - public static float HEAVY_MACHINERY_PRODUCED = 4; - public static float HEAVY_MACHINERY_ASSEMBLING_USAGE = 16; + public static float METAL_TO_ASSEMBLE = 1.2f; + public static float TRANSPLUTONICS_TO_ASSEMBLE = 0.1f; + public static float HEAVY_MACHINERY_PRODUCED = 0.2f; + public static float HEAVY_MACHINERY_ASSEMBLING_USAGE = 1.6f; // Here: Machinery Breakdown Settings - public static double BASE_BREAKDOWN_CHANCE = 0.3; - public static double BREAKDOWN_SEVERITY = 0.05; + public static float BASE_BREAKDOWN_CHANCE = 0.3f; + public static float BREAKDOWN_SEVERITY = 0.05f; // Here: CR Settings - public static double CR_PRODUCTION_DECAY = 0.02; + public static float CR_PRODUCTION_DECAY = 0.02f; // Here: Special Item Settings - public static double CORRUPTED_NANOFORGE_QUALITY_BONUS = 0.8; - public static double PRISTINE_NANOFORGE_QUALITY_BONUS = 0.5; - public static int CATALYTIC_CORE_REFINING_BONUS = 3; - public static int SYNCHROTRON_CORE_CENTRIFUGING_BONUS = 6; - public static int CORRUPTED_NANOFORGE_MANUFACTURING_BONUS = 2; - public static int PRISTINE_NANOFORGE_MANUFACTURING_BONUS = 4; - public static int CORRUPTED_NANOFORGE_ASSEMBLING_BONUS = 1; - public static int PRISTINE_NANOFORGE_ASSEMBLING_BONUS = 2; + public static float CORRUPTED_NANOFORGE_QUALITY_BONUS = 0.8f; + public static float PRISTINE_NANOFORGE_QUALITY_BONUS = 0.5f; + public static float CATALYTIC_CORE_REFINING_BONUS = 0.2f; + public static float SYNCHROTRON_CORE_CENTRIFUGING_BONUS = 0.4f; + public static float CORRUPTED_NANOFORGE_MANUFACTURING_BONUS = 0.1f; + public static float PRISTINE_NANOFORGE_MANUFACTURING_BONUS = 0.2f; + public static float CORRUPTED_NANOFORGE_ASSEMBLING_BONUS = 0.05f; + public static float PRISTINE_NANOFORGE_ASSEMBLING_BONUS = 0.1f; } diff --git a/data/hullmods/hull_mods.csv b/data/hullmods/hull_mods.csv index 93dfa17..a082297 100644 --- a/data/hullmods/hull_mods.csv +++ b/data/hullmods/hull_mods.csv @@ -1,17 +1,17 @@ name,id,tier,rarity,tech/manufacturer,tags,uiTags,"base value",unlocked,hidden,hiddenEverywhere,cost_frigate,cost_dest,cost_cruiser,cost_capital,script,desc,short,sprite -"Ore Refinery",forge_refinery_module,3,"0.2 -",Forge,special,Special,120000,TRUE,FALSE,FALSE,15,15,30,40,data.forge.hullmods.ForgeRefineryModule,"Refits %s/%s available cargo space, depending on hull size, into ore refinery, allowing for production of metal and transplutonics from their raw ores. It requires additional %s/%s crew and %s/%s supplies per month, depending on hull size. +"Ore Refinery",forge_refinery_module,2,"0.8 +",Forge,"req_spaceport, special","Special, Requires Dock",120000,FALSE,FALSE,FALSE,25,25,25,30,data.forge.hullmods.ForgeRefineryModule,"Refits %s/%s available cargo space, depending on hull size, into ore refinery, allowing for production of metal and transplutonics from their raw ores. It requires additional %s/%s crew and %s/%s supplies per month, depending on hull size. Installable only on cruisers or capital ships with civilian-grade hull.","Allows refining of ore.",graphics/hullmods/ore_refinery_module.png -"Fuel Centrifuge",forge_centrifuge_module,3,"0.2 -",Forge,special,Special,140000,TRUE,FALSE,FALSE,15,15,30,40,data.forge.hullmods.ForgeCentrifugeModule,"Refits %s/%s available cargo space, depending on hull size, into fuel centrifuge, allowing for production of fuel from volatiles. It requires additional %s/%s crew and %s/%s supplies per month, depending on hull size. +"Fuel Centrifuge",forge_centrifuge_module,2,"0.6 +",Forge,"req_spaceport, special","Special, Requires Dock",140000,FALSE,FALSE,FALSE,25,25,25,30,data.forge.hullmods.ForgeCentrifugeModule,"Refits %s/%s available cargo space, depending on hull size, into fuel centrifuge, allowing for production of fuel from volatiles. It requires additional %s/%s crew and %s/%s supplies per month, depending on hull size. Installable only on cruisers or capital ships with civilian-grade hull.","Allows centrifuging of volatiles.",graphics/hullmods/fuel_centrifuge_module.png -"Supply Manufacture",forge_manufacture_module,3,"0.2 -",Forge,special,Special,160000,TRUE,FALSE,FALSE,15,15,30,40,data.forge.hullmods.ForgeManufactureModule,"Refits %s/%s available cargo space, depending on hull size, into supply manufacture, allowing for production of supplies from metal and transplutonics. It requires additional %s/%s crew and %s/%s supplies per month, depending on hull size. +"Supply Manufacture",forge_manufacture_module,3,"0.4 +",Forge,"req_spaceport, special","Special, Requires Dock",160000,FALSE,FALSE,FALSE,25,25,25,30,data.forge.hullmods.ForgeManufactureModule,"Refits %s/%s available cargo space, depending on hull size, into supply manufacture, allowing for production of supplies from metal and transplutonics. It requires additional %s/%s crew and %s/%s supplies per month, depending on hull size. Installable only on cruisers or capital ships with civilian-grade hull.","Allows manufacturing of supplies",graphics/hullmods/supply_manufacture_module.png "Machinery Assembly",forge_assembly_module,3,"0.2 -",Forge,special,Special,180000,TRUE,FALSE,FALSE,15,15,30,40,data.forge.hullmods.ForgeAssemblyModule,"Refits %s/%s available cargo space, depending on hull size, into machinery assembly, allowing for production of heavy machinery from metal and transplutonics. It requires additional %s/%s crew and %s/%s supplies per month, depending on hull size. +",Forge,"req_spaceport, special","Special, Requires Dock",180000,FALSE,FALSE,FALSE,25,25,25,30,data.forge.hullmods.ForgeAssemblyModule,"Refits %s/%s available cargo space, depending on hull size, into machinery assembly, allowing for production of heavy machinery from metal and transplutonics. It requires additional %s/%s crew and %s/%s supplies per month, depending on hull size. Installable only on cruisers or capital ships with civilian-grade hull.","Allows assembling of heavy machinery",graphics/hullmods/machinery_assembly_module.png diff --git a/mod_info.json b/mod_info.json index 677c365..7fabc9a 100644 --- a/mod_info.json +++ b/mod_info.json @@ -2,8 +2,8 @@ "id":"forge_production", "name":"Forge Production", "author":"Ontheheavens", - "version":"0.1.2", - "description":"Hullmods that allow ships to produce commodities.", + "version":"0.5.4", + "description":"Hullmods that allow ships to produce commodities with ability toggle.", "gameVersion":"0.95a", "jars":["jars/forge_production.jar"], "modPlugin":"data.forge.plugins.ForgeModPlugin",