Discounts can only be used one time (#892)

## Description:

Discounts on structures and warships can only be used one time.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

---------

Co-authored-by: Scott Anderson <scottanderson@users.noreply.github.com>
This commit is contained in:
Scott Anderson
2025-06-23 00:23:20 -04:00
committed by GitHub
parent b71acdc993
commit 5c4692bc29
4 changed files with 45 additions and 32 deletions
+6 -21
View File
@@ -332,9 +332,7 @@ export class DefaultConfig implements Config {
: BigInt(
Math.min(
1_000_000,
(p.unitsIncludingConstruction(UnitType.Warship).length +
1) *
250_000,
(p.unitsConstructed(UnitType.Warship) + 1) * 250_000,
),
),
territoryBound: false,
@@ -359,10 +357,7 @@ export class DefaultConfig implements Config {
: BigInt(
Math.min(
1_000_000,
Math.pow(
2,
p.unitsIncludingConstruction(UnitType.Port).length,
) * 125_000,
Math.pow(2, p.unitsConstructed(UnitType.Port)) * 125_000,
),
),
territoryBound: true,
@@ -421,9 +416,7 @@ export class DefaultConfig implements Config {
: BigInt(
Math.min(
250_000,
(p.unitsIncludingConstruction(UnitType.DefensePost).length +
1) *
50_000,
(p.unitsConstructed(UnitType.DefensePost) + 1) * 50_000,
),
),
territoryBound: true,
@@ -438,9 +431,7 @@ export class DefaultConfig implements Config {
: BigInt(
Math.min(
3_000_000,
(p.unitsIncludingConstruction(UnitType.SAMLauncher).length +
1) *
1_500_000,
(p.unitsConstructed(UnitType.SAMLauncher) + 1) * 1_500_000,
),
),
territoryBound: true,
@@ -455,10 +446,7 @@ export class DefaultConfig implements Config {
: BigInt(
Math.min(
1_000_000,
Math.pow(
2,
p.unitsIncludingConstruction(UnitType.City).length,
) * 125_000,
Math.pow(2, p.unitsConstructed(UnitType.City)) * 125_000,
),
),
territoryBound: true,
@@ -473,10 +461,7 @@ export class DefaultConfig implements Config {
: BigInt(
Math.min(
1_000_000,
Math.pow(
2,
p.unitsIncludingConstruction(UnitType.Factory).length,
) * 125_000,
Math.pow(2, p.unitsConstructed(UnitType.Factory)) * 125_000,
),
),
territoryBound: true,