mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-22 16:50:13 +00:00
Stop getting gold from conquering inactive players 🔧 (#3020)
## Description:
Maybe for v29.
In the 5M starting gold modifier games you can conquer a inactive player
(spawned but didn't do anything) and get their 5M gold.
Huge unfair advantage.
I think that even without the starting gold modifier you should not get
the gold of inactive players because its unfair.
I identify inactive players (spawned but didn't do anything) by checking
the attack stats.
I added a translation for the displayMessage "Conquered {name}, received
{gold} gold". Why was that not translated?
I added a new message "Conquered {name} (Inactive player, received no
gold)".
## 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: Ryan <7389646+ryanbarlow97@users.noreply.github.com>
This commit is contained in:
@@ -34,11 +34,36 @@ describe("AttackStats", () => {
|
||||
|
||||
test("should increase war gold stat when a player is eliminated", () => {
|
||||
expect(player1.sharesBorderWith(player2)).toBeTruthy();
|
||||
// Player2 must attack to be considered active (otherwise gold won't transfer)
|
||||
game.addExecution(
|
||||
new AttackExecution(1, player2, game.terraNullius().id()),
|
||||
);
|
||||
game.executeNextTick();
|
||||
performAttack(game, player1, player2);
|
||||
expectWarGoldStatIsIncreasedAfterKill(game, player1, player2);
|
||||
});
|
||||
|
||||
test("should NOT increase war gold stat when a inactive player is eliminated", () => {
|
||||
expect(player1.sharesBorderWith(player2)).toBeTruthy();
|
||||
|
||||
const attackerStatsBefore = game.stats().stats()[player1.clientID()!];
|
||||
const warGoldBefore = attackerStatsBefore?.gold?.[GOLD_INDEX_WAR] ?? 0n;
|
||||
|
||||
performAttack(game, player1, player2);
|
||||
|
||||
const attackerStatsAfter = game.stats().stats()[player1.clientID()!];
|
||||
const warGoldAfter = attackerStatsAfter?.gold?.[GOLD_INDEX_WAR] ?? 0n;
|
||||
|
||||
expect(warGoldAfter).toBe(warGoldBefore);
|
||||
});
|
||||
|
||||
test("should increase war gold stat when elimination occurs via territory annexation", () => {
|
||||
// Player2 must attack to be considered active (otherwise gold won't transfer)
|
||||
game.addExecution(
|
||||
new AttackExecution(1, player2, game.terraNullius().id()),
|
||||
);
|
||||
game.executeNextTick();
|
||||
|
||||
// Mark every tile on the map as owned by player1
|
||||
for (let x = 0; x < game.map().width(); x++) {
|
||||
for (let y = 0; y < game.map().height(); y++) {
|
||||
|
||||
Reference in New Issue
Block a user