conqueror receives 50% of gold when conquering a human player (#3818)

## Description:

The motivation is to prevent snowballing players from also gaining too
much gold by conquering other players

- Adds `conquerGoldAmount` to `Config`/`DefaultConfig`: returns 100% of
captured gold for bots/nations, 50% for human players
- Updates `GameImpl.conquerPlayer` to use this amount for the
conqueror's gold gain (the conquered player still loses their full 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:

evan
This commit is contained in:
Evan
2026-05-02 09:23:49 -06:00
committed by GitHub
parent bcdc2126c6
commit f90e73c2f7
4 changed files with 122 additions and 4 deletions
+1
View File
@@ -86,6 +86,7 @@ export interface Config {
startManpower(playerInfo: PlayerInfo): number;
troopIncreaseRate(player: Player | PlayerView): number;
goldAdditionRate(player: Player | PlayerView): Gold;
conquerGoldAmount(captured: Player): Gold;
attackTilesPerTick(
attckTroops: number,
attacker: Player,
+11
View File
@@ -512,6 +512,17 @@ export class DefaultConfig implements Config {
return base;
}
public conquerGoldAmount(captured: Player): Gold {
if (
captured.type() === PlayerType.Bot ||
captured.type() === PlayerType.Nation
) {
return captured.gold();
} else {
return captured.gold() / 2n;
}
}
private startingGoldFor(playerInfo: PlayerInfo): Gold {
const base = BigInt(this._gameConfig.startingGold ?? 0);
const hc = this._gameConfig.hostCheats;
+7 -4
View File
@@ -1204,6 +1204,9 @@ export class GameImpl implements Game {
const skipGoldTransfer =
attacksSent === 0n && conquered.type() === PlayerType.Human;
const gold = skipGoldTransfer ? 0n : conquered.gold();
const goldCaptured = skipGoldTransfer
? 0n
: this._config.conquerGoldAmount(conquered);
if (skipGoldTransfer) {
this.displayMessage(
@@ -1222,22 +1225,22 @@ export class GameImpl implements Game {
conqueror.id(),
gold,
{
gold: renderNumber(gold),
gold: renderNumber(goldCaptured),
name: conquered.displayName(),
},
);
conqueror.addGold(gold);
conqueror.addGold(goldCaptured);
conquered.removeGold(gold);
// Record stats
this.stats().goldWar(conqueror, conquered, gold);
this.stats().goldWar(conqueror, conquered, goldCaptured);
}
this.addUpdate({
type: GameUpdateType.ConquestEvent,
conquerorId: conqueror.id(),
conqueredId: conquered.id(),
gold,
gold: goldCaptured,
});
}
}