mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 09:10:42 +00:00
BUG FIX: Gold double deduction + Rmoval of UnitType.Construction (#2378)
## Description: - Removed the temporary UnitType.Construction and embedded construction state into real units via isUnderConstruction(). - Centralized non-structure spawning to perform a single validation right before unit creation/launch. - Updated UI layers to render construction state without relying on the removed enum. - Adjusted and created tests to match the new flow and to cover the no-refundscenarios. # Tests updated - tests/economy/ConstructionGold.test.ts: covers structure cost deduction and income, tolerant of passive income; ensures no refunds during construction. - tests/nukes/HydrogenAndMirv.test.ts: accounts for single-check launch flow; MIRV test targets a player-owned tile; ensures launch after payment. - tests/client/graphics/UILayer.test.ts: mocks now provide isUnderConstruction and real type strings; ## 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 ## Please put your Discord username so you can be contacted if a bug or regression is found: CrackeRR1 --------- Co-authored-by: Evan <evanpelle@gmail.com>
This commit is contained in:
@@ -145,7 +145,13 @@ describe("Shell Random Damage", () => {
|
||||
});
|
||||
|
||||
test("Defense post shell attacks have random damage", () => {
|
||||
const defensePost = new DefensePostExecution(player1, game.ref(coastX, 5));
|
||||
player1.conquer(game.ref(coastX, 5));
|
||||
const spawn = player1.canBuild(UnitType.DefensePost, game.ref(coastX, 5));
|
||||
if (spawn === false) {
|
||||
throw new Error("Unable to build defense post for test");
|
||||
}
|
||||
const defensePostUnit = player1.buildUnit(UnitType.DefensePost, spawn, {});
|
||||
const defensePost = new DefensePostExecution(defensePostUnit);
|
||||
|
||||
const target = player2.buildUnit(
|
||||
UnitType.Warship,
|
||||
|
||||
Reference in New Issue
Block a user