Merge branch 'main' of https://github.com/openfrontio/OpenFrontIO into bomb-confirmation

This commit is contained in:
Ryan Barlow
2026-01-08 15:38:26 +00:00
2 changed files with 37 additions and 23 deletions
+18 -14
View File
@@ -5,6 +5,7 @@ import {
Gold,
Player,
PlayerID,
PlayerType,
} from "../game/Game";
import { PseudoRandom } from "../PseudoRandom";
import { assertNever, toInt } from "../Util";
@@ -60,21 +61,24 @@ export class DonateGoldExecution implements Execution {
this.recipient.updateRelation(this.sender, relationUpdate);
}
// Select emoji based on donation value
const emoji =
relationUpdate >= 50
? EMOJI_LOVE
: relationUpdate > 0
? EMOJI_DONATION_OK
: EMOJI_DONATION_TOO_SMALL;
// Only AI nations auto-respond with emojis, human players should not
if (this.recipient.type() === PlayerType.Nation) {
// Select emoji based on donation value
const emoji =
relationUpdate >= 50
? EMOJI_LOVE
: relationUpdate > 0
? EMOJI_DONATION_OK
: EMOJI_DONATION_TOO_SMALL;
this.mg.addExecution(
new EmojiExecution(
this.recipient,
this.sender.id(),
this.random.randElement(emoji),
),
);
this.mg.addExecution(
new EmojiExecution(
this.recipient,
this.sender.id(),
this.random.randElement(emoji),
),
);
}
} else {
console.warn(
`cannot send gold from ${this.sender.name()} to ${this.recipient.name()}`,
+19 -9
View File
@@ -1,4 +1,11 @@
import { Difficulty, Execution, Game, Player, PlayerID } from "../game/Game";
import {
Difficulty,
Execution,
Game,
Player,
PlayerID,
PlayerType,
} from "../game/Game";
import { PseudoRandom } from "../PseudoRandom";
import { assertNever } from "../Util";
import { EmojiExecution } from "./EmojiExecution";
@@ -54,15 +61,18 @@ export class DonateTroopsExecution implements Execution {
this.recipient.updateRelation(this.sender, 50);
}
this.mg.addExecution(
new EmojiExecution(
this.recipient,
this.sender.id(),
this.random.randElement(
this.troops >= minTroops ? EMOJI_LOVE : EMOJI_DONATION_TOO_SMALL,
// Only AI nations auto-respond with emojis, human players should not
if (this.recipient.type() === PlayerType.Nation) {
this.mg.addExecution(
new EmojiExecution(
this.recipient,
this.sender.id(),
this.random.randElement(
this.troops >= minTroops ? EMOJI_LOVE : EMOJI_DONATION_TOO_SMALL,
),
),
),
);
);
}
} else {
console.warn(
`cannot send troops from ${this.sender} to ${this.recipient}`,