mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-29 23:22:10 +00:00
Merge branch 'main' of https://github.com/openfrontio/OpenFrontIO into bomb-confirmation
This commit is contained in:
@@ -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()}`,
|
||||
|
||||
@@ -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}`,
|
||||
|
||||
Reference in New Issue
Block a user