From aac68a06463277dc147a98f8ca0dec453084557a Mon Sep 17 00:00:00 2001 From: Quantumshark Date: Wed, 20 Mar 2024 08:33:16 +0000 Subject: [PATCH] feat(mechanics): Separate delayed and non-delayed shield generation and hull repair attributes (#9771) --- data/_ui/tooltips.txt | 32 ++++++++++++++++++++++++++++---- data/kahet/kahet outfits.txt | 2 +- source/OutfitInfoDisplay.cpp | 8 ++++++++ source/Ship.cpp | 34 ++++++++++++++++++++-------------- source/ShipInfoDisplay.cpp | 18 ++++++++++++------ 5 files changed, 69 insertions(+), 25 deletions(-) diff --git a/data/_ui/tooltips.txt b/data/_ui/tooltips.txt index dedbf06ff3e1..5b6809a419db 100644 --- a/data/_ui/tooltips.txt +++ b/data/_ui/tooltips.txt @@ -267,18 +267,27 @@ tip "hull:" tip "hull energy:" `Energy consumed per second when repairing the hull.` +tip "delayed hull energy:" + `Additional energy consumed per second when repairing the hull after the repair delay period.` + tip "hull energy multiplier:" `Modifies the energy consumed when repairing the hull by the given factor.` tip "hull fuel:" `Fuel consumed per second when repairing the hull.` +tip "delayed hull fuel:" + `Additional fuel consumed per second when repairing the hull after the repair delay period.` + tip "hull fuel multiplier:" `Modifies the fuel consumed when repairing the hull by the given factor.` tip "hull heat:" `Heat produced per second when repairing the hull.` +tip "delayed hull heat:" + `Additional heat produced per second when repairing the hull after the repair delay period.` + tip "hull heat multiplier:" `Modifies the heat produced when repairing the hull by the given factor.` @@ -288,11 +297,14 @@ tip "hull multiplier:" tip "hull repair rate:" `Amount of hull strength that can be repaired per second. Repairs usually consume energy and may generate heat as well.` +tip "delayed hull repair rate:" + `Additional hull strength that can be repaired per second after the repair delay period.` + tip "repair delay:" - `The number of seconds it takes for hull repairs to begin after taking hull damage.` + `The number of seconds it takes for additional hull repairs to begin after taking hull damage.` tip "disabled repair delay:" - `The number of seconds it takes for hull repairs to begin after being disabled.` + `The number of seconds it takes for additional hull repairs to begin after being disabled.` tip "absolute threshold:" `The remaining hull strength at which the ship becomes disabled. This attribute takes priority over other attributes that change the disabled threshold.` @@ -519,24 +531,36 @@ tip "sells for:" tip "shield energy:" `Energy consumed per second when recharging shields.` +tip "delayed shield energy:" + `Additional energy consumed per second when recharging shields after the shield delay period.` + tip "shield energy multiplier:" `Modifies the energy consumed when recharging shields by the given factor.` tip "shield fuel:" `Fuel consumed per second when recharging shields.` +tip "delayed shield fuel:" + `Additional fuel consumed per second when recharging shields after the shield delay period.` + tip "shield fuel multiplier:" `Modifies the fuel consumed when recharging shields by the given factor.` tip "shield heat:" `Heat produced per second when recharging shields.` +tip "delayed shield heat:" + `Additional heat produced per second when recharging shields after the shield delay period.` + tip "shield heat multiplier:" `Modifies the heat produced when recharging shields by the given factor.` tip "shield generation:" `Shield points recharged per second. Recharging shields usually consumes energy, and may also produce heat.` +tip "delayed shield generation:" + `Additional shield points recharged per second after the shield delay period.` + tip "shield generation multiplier:" `Modifies the amount of shield points recharged per second by the given factor.` @@ -556,10 +580,10 @@ tip "shield multiplier:" `Modifies the ship's total shield strength by the given factor.` tip "shield delay:" - `The number of seconds it takes for shield generation to begin after taking shield damage.` + `The number of seconds it takes for additional shield generation to begin after taking shield damage.` tip "depleted shield delay:" - `The number of seconds it takes for shield generation to begin after your shields have been depleted.` + `The number of seconds it takes for additional shield generation to begin after your shields have been depleted.` tip "shield protection:" `Protection against shield damage. If you add more than one outfit with this attribute, each additional one is less effective: a total value of 1 results in a 1 percent reduction in shield damage, while a total value of 11 only results in a 10 percent reduction.` diff --git a/data/kahet/kahet outfits.txt b/data/kahet/kahet outfits.txt index 55160aa317ef..7b9c02cb5872 100644 --- a/data/kahet/kahet outfits.txt +++ b/data/kahet/kahet outfits.txt @@ -367,7 +367,7 @@ outfit "Ka'het Grand Restorer" thumbnail "outfit/ka'het grand restorer" "mass" 72 "outfit space" -86 - "shield generation" 7.08 + "delayed shield generation" 7.08 "energy consumption" 10.62 "depleted shield delay" 350 description "This shield generator is the apex of Ka'het shielding technology, a field that developed rapidly and out of necessity rather than gradually and perfected over long periods. Nevertheless, the Grand Restorer grants good protection for the largest Het ships, replacing the basic restorers used elsewhere." diff --git a/source/OutfitInfoDisplay.cpp b/source/OutfitInfoDisplay.cpp index b700b2b93a33..d166168f52d4 100644 --- a/source/OutfitInfoDisplay.cpp +++ b/source/OutfitInfoDisplay.cpp @@ -76,6 +76,10 @@ namespace { {"hull energy", 0}, {"hull fuel", 0}, {"hull heat", 0}, + {"delayed hull repair rate", 0}, + {"delayed hull energy", 0}, + {"delayed hull fuel", 0}, + {"delayed hull heat", 0}, {"ion resistance energy", 0}, {"ion resistance fuel", 0}, {"ion resistance heat", 0}, @@ -97,6 +101,10 @@ namespace { {"shield energy", 0}, {"shield fuel", 0}, {"shield heat", 0}, + {"delayed shield generation", 0}, + {"delayed shield energy", 0}, + {"delayed shield fuel", 0}, + {"delayed shield heat", 0}, {"slowing resistance energy", 0}, {"slowing resistance fuel", 0}, {"slowing resistance heat", 0}, diff --git a/source/Ship.cpp b/source/Ship.cpp index c72f78748779..59a632bc4485 100644 --- a/source/Ship.cpp +++ b/source/Ship.cpp @@ -3732,31 +3732,37 @@ void Ship::DoGeneration() // 4. Shields of carried fighters // 5. Transfer of excess energy and fuel to carried fighters. - const double hullAvailable = attributes.Get("hull repair rate") + const double hullAvailable = (attributes.Get("hull repair rate") + + (hullDelay ? 0 : attributes.Get("delayed hull repair rate"))) * (1. + attributes.Get("hull repair multiplier")); const double hullEnergy = (attributes.Get("hull energy") - * (1. + attributes.Get("hull energy multiplier"))) / hullAvailable; + + (hullDelay ? 0 : attributes.Get("delayed hull energy"))) + * (1. + attributes.Get("hull energy multiplier")) / hullAvailable; const double hullFuel = (attributes.Get("hull fuel") - * (1. + attributes.Get("hull fuel multiplier"))) / hullAvailable; + + (hullDelay ? 0 : attributes.Get("delayed hull fuel"))) + * (1. + attributes.Get("hull fuel multiplier")) / hullAvailable; const double hullHeat = (attributes.Get("hull heat") - * (1. + attributes.Get("hull heat multiplier"))) / hullAvailable; + + (hullDelay ? 0 : attributes.Get("delayed hull heat"))) + * (1. + attributes.Get("hull heat multiplier")) / hullAvailable; double hullRemaining = hullAvailable; - if(!hullDelay) - DoRepair(hull, hullRemaining, MaxHull(), - energy, hullEnergy, fuel, hullFuel, heat, hullHeat); + DoRepair(hull, hullRemaining, MaxHull(), + energy, hullEnergy, fuel, hullFuel, heat, hullHeat); - const double shieldsAvailable = attributes.Get("shield generation") + const double shieldsAvailable = (attributes.Get("shield generation") + + (shieldDelay ? 0 : attributes.Get("delayed shield generation"))) * (1. + attributes.Get("shield generation multiplier")); const double shieldsEnergy = (attributes.Get("shield energy") - * (1. + attributes.Get("shield energy multiplier"))) / shieldsAvailable; + + (shieldDelay ? 0 : attributes.Get("delayed shield energy"))) + * (1. + attributes.Get("shield energy multiplier")) / shieldsAvailable; const double shieldsFuel = (attributes.Get("shield fuel") - * (1. + attributes.Get("shield fuel multiplier"))) / shieldsAvailable; + + (shieldDelay ? 0 : attributes.Get("delayed shield fuel"))) + * (1. + attributes.Get("shield fuel multiplier")) / shieldsAvailable; const double shieldsHeat = (attributes.Get("shield heat") - * (1. + attributes.Get("shield heat multiplier"))) / shieldsAvailable; + + (shieldDelay ? 0 : attributes.Get("delayed shield heat"))) + * (1. + attributes.Get("shield heat multiplier")) / shieldsAvailable; double shieldsRemaining = shieldsAvailable; - if(!shieldDelay) - DoRepair(shields, shieldsRemaining, MaxShields(), - energy, shieldsEnergy, fuel, shieldsFuel, heat, shieldsHeat); + DoRepair(shields, shieldsRemaining, MaxShields(), + energy, shieldsEnergy, fuel, shieldsFuel, heat, shieldsHeat); if(!bays.empty()) { diff --git a/source/ShipInfoDisplay.cpp b/source/ShipInfoDisplay.cpp index 40e0bc548498..4706edbb4bc5 100644 --- a/source/ShipInfoDisplay.cpp +++ b/source/ShipInfoDisplay.cpp @@ -193,7 +193,8 @@ void ShipInfoDisplay::UpdateAttributes(const Ship &ship, const PlayerInfo &playe attributeLabels.push_back(string()); attributeValues.push_back(string()); attributesHeight += 10; - double shieldRegen = attributes.Get("shield generation") + double shieldRegen = (attributes.Get("shield generation") + + attributes.Get("delayed shield generation")) * (1. + attributes.Get("shield generation multiplier")); bool hasShieldRegen = shieldRegen > 0.; if(hasShieldRegen) @@ -208,7 +209,8 @@ void ShipInfoDisplay::UpdateAttributes(const Ship &ship, const PlayerInfo &playe attributeValues.push_back(Format::Number(ship.MaxShields())); } attributesHeight += 20; - double hullRepair = attributes.Get("hull repair rate") + double hullRepair = (attributes.Get("hull repair rate") + + attributes.Get("delayed hull repair rate")) * (1. + attributes.Get("hull repair multiplier")); bool hasHullRepair = hullRepair > 0.; if(hasHullRepair) @@ -375,16 +377,20 @@ void ShipInfoDisplay::UpdateAttributes(const Ship &ship, const PlayerInfo &playe // Add energy and heat when doing shield and hull repair to the table. attributesHeight += 20; - double shieldEnergy = (hasShieldRegen) ? attributes.Get("shield energy") + double shieldEnergy = (hasShieldRegen) ? (attributes.Get("shield energy") + + attributes.Get("delayed shield energy")) * (1. + attributes.Get("shield energy multiplier")) : 0.; - double hullEnergy = (hasHullRepair) ? attributes.Get("hull energy") + double hullEnergy = (hasHullRepair) ? (attributes.Get("hull energy") + + attributes.Get("delayed hull energy")) * (1. + attributes.Get("hull energy multiplier")) : 0.; tableLabels.push_back((shieldEnergy && hullEnergy) ? "shields / hull:" : hullEnergy ? "repairing hull:" : "charging shields:"); energyTable.push_back(Format::Number(-60. * (shieldEnergy + hullEnergy))); - double shieldHeat = (hasShieldRegen) ? attributes.Get("shield heat") + double shieldHeat = (hasShieldRegen) ? (attributes.Get("shield heat") + + attributes.Get("delayed shield heat")) * (1. + attributes.Get("shield heat multiplier")) : 0.; - double hullHeat = (hasHullRepair) ? attributes.Get("hull heat") + double hullHeat = (hasHullRepair) ? (attributes.Get("hull heat") + + attributes.Get("delayed hull heat")) * (1. + attributes.Get("hull heat multiplier")) : 0.; heatTable.push_back(Format::Number(60. * (shieldHeat + hullHeat)));