mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-08-07 19:21:30 +00:00
Cancel nukes when accepting alliance via radial menu (#3155)
Resolves #3154 ## Description: #2716 introduced nuke cancellation logic on alliance acceptance via `AllianceRequestReplyExecution`. The radial menu action, though, calls `AllianceRequestExecution` instead, which accepts the alliance if a request has already been made by the other player. This PR moves the nuke cancellation logic to `GameImpl`, hooking into the `acceptAllianceRequest` method, therefore accounting for every alliance acceptance, regardless of the specific action that brought to that. ## 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: deshack_82603
This commit is contained in:
@@ -3,7 +3,6 @@ import { AttackExecution } from "../../../src/core/execution/AttackExecution";
|
||||
import { SpawnExecution } from "../../../src/core/execution/SpawnExecution";
|
||||
//import { TransportShipExecution } from "../../../src/core/execution/TransportShipExecution";
|
||||
import { AllianceRequestExecution } from "../../../src/core/execution/alliance/AllianceRequestExecution";
|
||||
import { AllianceRequestReplyExecution } from "../../../src/core/execution/alliance/AllianceRequestReplyExecution";
|
||||
import {
|
||||
Game,
|
||||
Player,
|
||||
@@ -68,16 +67,11 @@ describe("GameImpl", () => {
|
||||
|
||||
test("Don't become traitor when betraying inactive player", async () => {
|
||||
vi.spyOn(attacker, "canSendAllianceRequest").mockReturnValue(true);
|
||||
vi.spyOn(defender, "canSendAllianceRequest").mockReturnValue(true);
|
||||
game.addExecution(new AllianceRequestExecution(attacker, defender.id()));
|
||||
|
||||
game.executeNextTick();
|
||||
game.executeNextTick();
|
||||
|
||||
game.addExecution(
|
||||
new AllianceRequestReplyExecution(attacker.id(), defender, true),
|
||||
);
|
||||
|
||||
game.executeNextTick();
|
||||
game.addExecution(new AllianceRequestExecution(defender, attacker.id()));
|
||||
game.executeNextTick();
|
||||
|
||||
expect(attacker.allianceWith(defender)).toBeTruthy();
|
||||
@@ -107,16 +101,11 @@ describe("GameImpl", () => {
|
||||
|
||||
test("Do become traitor when betraying active player", async () => {
|
||||
vi.spyOn(attacker, "canSendAllianceRequest").mockReturnValue(true);
|
||||
vi.spyOn(defender, "canSendAllianceRequest").mockReturnValue(true);
|
||||
game.addExecution(new AllianceRequestExecution(attacker, defender.id()));
|
||||
|
||||
game.executeNextTick();
|
||||
game.executeNextTick();
|
||||
|
||||
game.addExecution(
|
||||
new AllianceRequestReplyExecution(attacker.id(), defender, true),
|
||||
);
|
||||
|
||||
game.executeNextTick();
|
||||
game.addExecution(new AllianceRequestExecution(defender, attacker.id()));
|
||||
game.executeNextTick();
|
||||
|
||||
expect(attacker.allianceWith(defender)).toBeTruthy();
|
||||
|
||||
Reference in New Issue
Block a user