Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mechanics): Separate delayed and non-delayed shield generation and hull repair attributes #9771

Merged
merged 10 commits into from
Mar 20, 2024
32 changes: 28 additions & 4 deletions data/_ui/tooltips.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.`

Expand All @@ -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.`
Expand Down Expand Up @@ -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.`

Expand All @@ -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.`
Expand Down
2 changes: 1 addition & 1 deletion data/kahet/kahet outfits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
8 changes: 8 additions & 0 deletions source/OutfitInfoDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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},
Expand Down
18 changes: 12 additions & 6 deletions source/Ship.cpp
Quantumshark marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3730,30 +3730,36 @@ void Ship::DoGeneration()
// 5. Transfer of excess energy and fuel to carried fighters.

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")
+ (hullDelay ? 0 : attributes.Get("delayed hull energy"))
* (1. + attributes.Get("hull energy multiplier"))) / hullAvailable;
const double hullFuel = (attributes.Get("hull fuel")
+ (hullDelay ? 0 : attributes.Get("delayed hull fuel"))
* (1. + attributes.Get("hull fuel multiplier"))) / hullAvailable;
const double hullHeat = (attributes.Get("hull heat")
+ (hullDelay ? 0 : attributes.Get("delayed hull heat"))
* (1. + attributes.Get("hull heat multiplier"))) / hullAvailable;
Quantumshark marked this conversation as resolved.
Show resolved Hide resolved
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")
+ (shieldDelay ? 0 : attributes.Get("delayed shield generation"))
* (1. + attributes.Get("shield generation multiplier"));
const double shieldsEnergy = (attributes.Get("shield energy")
+ (shieldDelay ? 0 : attributes.Get("delayed shield energy"))
* (1. + attributes.Get("shield energy multiplier"))) / shieldsAvailable;
const double shieldsFuel = (attributes.Get("shield fuel")
+ (shieldDelay ? 0 : attributes.Get("delayed shield fuel"))
* (1. + attributes.Get("shield fuel multiplier"))) / shieldsAvailable;
const double shieldsHeat = (attributes.Get("shield heat")
+ (shieldDelay ? 0 : attributes.Get("delayed shield heat"))
* (1. + attributes.Get("shield heat multiplier"))) / shieldsAvailable;
Quantumshark marked this conversation as resolved.
Show resolved Hide resolved
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())
{
Expand Down