Nations send emoji when declining assistance requests (#1911)

Nations will now send emoji when declining assistance requests.

- [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

Cancel alliance requests if the recipient attacks (#1733)

Problem: attacking a player right before accepting an alliance request
is very effective since the requester can't fight back or reclaim his
territory without canceling the alliance and being penalized with the
traitor debuff.

Change:
- Attacking a player after he requested an alliance automatically
rejects the request
- No changes to existing attacks in both directions, only new attacks
affect the request

- [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
- [x] I have read and accepted the CLA agreement (only required once).

regression is found:

IngloriousTom
This commit is contained in:
Scott Anderson
2025-08-26 17:57:40 -04:00
committed by evanpelle
parent f0f9318852
commit 81bd98c8d6
6 changed files with 53 additions and 27 deletions
+30 -8
View File
@@ -13,12 +13,34 @@ import { AllianceExtensionExecution } from "../alliance/AllianceExtensionExecuti
import { AttackExecution } from "../AttackExecution";
import { EmojiExecution } from "../EmojiExecution";
const emojiId = (e: typeof flattenedEmojiTable[number]) => flattenedEmojiTable.indexOf(e);
const EMOJI_ASSIST_ACCEPT = ([
"👍",
"⛵",
"🤝",
"🎯",
] as const).map(emojiId);
const EMOJI_RELATION_TOO_LOW = ([
"🥱",
"🤦‍♂️",
] as const).map(emojiId);
const EMOJI_TARGET_ME = ([
"🥺",
"💀",
] as const).map(emojiId);
const EMOJI_TARGET_ALLY = ([
"🕊️",
"👎",
] as const).map(emojiId);
export const EMOJI_HECKLE = ([
"🤡",
"😡",
] as const).map(emojiId);
export class BotBehavior {
private enemy: Player | null = null;
private enemyUpdated: Tick;
private assistAcceptEmoji = flattenedEmojiTable.indexOf("👍");
constructor(
private random: PseudoRandom,
private game: Game,
@@ -110,26 +132,26 @@ export class BotBehavior {
}
assistAllies() {
outer: for (const ally of this.player.allies()) {
for (const ally of this.player.allies()) {
if (ally.targets().length === 0) continue;
if (this.player.relation(ally) < Relation.Friendly) {
// this.emoji(ally, "🤦");
this.emoji(ally, this.random.randElement(EMOJI_RELATION_TOO_LOW));
continue;
}
for (const target of ally.targets()) {
if (target === this.player) {
// this.emoji(ally, "💀");
this.emoji(ally, this.random.randElement(EMOJI_TARGET_ME));
continue;
}
if (this.player.isAlliedWith(target)) {
// this.emoji(ally, "👎");
this.emoji(ally, this.random.randElement(EMOJI_TARGET_ALLY));
continue;
}
// All checks passed, assist them
this.player.updateRelation(ally, -20);
this.setNewEnemy(target);
this.emoji(ally, this.assistAcceptEmoji);
break outer;
this.emoji(ally, this.random.randElement(EMOJI_ASSIST_ACCEPT));
return;
}
}
}