mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-08-18 17:53:29 +00:00
Add PVP immunity to 5M starting gold modifier games 🔧 (#3180)
## Description: Adds 30 seconds of PVP immunity to 5M starting gold modifier games. So you cannot insta-nuke other players. Because I'm sure people would be confused "I cannot attack!!!!" I added a HeadsUpMessage which informs about the PVP immunity. We already have a ImmunityTimer progress bar but I don't think its enough. <img width="1270" height="745" alt="image" src="https://github.com/user-attachments/assets/0ee23dc4-1c7b-4d62-8b3d-8de214f03c2b" /> I had a second count in the HeadsUpMessage (seconds until PVP immunity is over) but it felt too busy. So I removed it. You can tell when PVP immunity is over by looking at the progress bar. ## 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: FloPinguin --------- Co-authored-by: Evan <evanpelle@gmail.com>
This commit is contained in:
@@ -391,17 +391,17 @@ describe("Attack immunity", () => {
|
||||
|
||||
test("Ensure a player can't attack during all the immunity phase", async () => {
|
||||
// Execute a few ticks but stop right before the immunity phase is over
|
||||
for (let i = 0; i < immunityPhaseTicks - 1; i++) {
|
||||
for (let i = 0; i < immunityPhaseTicks - 2; i++) {
|
||||
game.executeNextTick();
|
||||
}
|
||||
// Player A attacks Player B
|
||||
game.addExecution(new AttackExecution(null, playerA, playerB.id(), null));
|
||||
game.executeNextTick(); // ticks === immunityPhaseTicks here
|
||||
game.executeNextTick(); // ticks === immunityPhaseTicks - 1 here
|
||||
// Attack is not possible during immunity
|
||||
expect(playerA.outgoingAttacks()).toHaveLength(0);
|
||||
|
||||
// Retry after the immunity is over
|
||||
game.executeNextTick(); // ticks === immunityPhaseTicks + 1
|
||||
game.executeNextTick(); // ticks === immunityPhaseTicks
|
||||
game.addExecution(new AttackExecution(null, playerA, playerB.id(), null));
|
||||
game.executeNextTick();
|
||||
// Attack is now possible right after
|
||||
|
||||
Reference in New Issue
Block a user