mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 13:20:43 +00:00
Nations send emoji when declining assistance requests (#1911)
## Description: Nations will now send emoji when declining assistance requests. ## 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
This commit is contained in:
committed by
evanpelle
parent
81bd98c8d6
commit
8308d7f1e7
+2
-3
@@ -270,12 +270,11 @@ export const emojiTable = [
|
||||
["↙️", "⬇️", "↘️", "❤️", "💔"],
|
||||
["💰", "⚓", "⛵", "🏡", "🛡️"],
|
||||
] as const;
|
||||
|
||||
export type Emoji = (typeof emojiTable)[number][number];
|
||||
|
||||
// 2d to 1d array
|
||||
export const flattenedEmojiTable = emojiTable.flat();
|
||||
|
||||
export type Emoji = (typeof flattenedEmojiTable)[number];
|
||||
|
||||
/**
|
||||
* JSON.stringify replacer function that converts bigint values to strings.
|
||||
*/
|
||||
|
||||
@@ -30,7 +30,9 @@ export function structureSpawnTileValue(
|
||||
}
|
||||
|
||||
// Prefer to be away from other structures of the same type
|
||||
const otherTiles: Set<TileRef> = new Set(otherUnits.map((u) => u.tile()));
|
||||
const otherTiles: Set<TileRef> = new Set(
|
||||
otherUnits.map((u) => u.tile()),
|
||||
);
|
||||
otherTiles.delete(tile);
|
||||
const closestOther = closestTwoTiles(mg, otherTiles, [tile]);
|
||||
if (closestOther !== null) {
|
||||
@@ -47,7 +49,9 @@ export function structureSpawnTileValue(
|
||||
let w = 0;
|
||||
|
||||
// Prefer to be away from other structures of the same type
|
||||
const otherTiles: Set<TileRef> = new Set(otherUnits.map((u) => u.tile()));
|
||||
const otherTiles: Set<TileRef> = new Set(
|
||||
otherUnits.map((u) => u.tile()),
|
||||
);
|
||||
otherTiles.delete(tile);
|
||||
const closestOther = closestTwoTiles(mg, otherTiles, [tile]);
|
||||
if (closestOther !== null) {
|
||||
@@ -82,12 +86,15 @@ export function structureSpawnTileValue(
|
||||
neighbors.add(neighbor);
|
||||
}
|
||||
for (const neighbor of neighbors) {
|
||||
w += borderSpacing * (Relation.Friendly - player.relation(neighbor));
|
||||
w +=
|
||||
borderSpacing * (Relation.Friendly - player.relation(neighbor));
|
||||
}
|
||||
}
|
||||
|
||||
// Prefer to be away from other structures of the same type
|
||||
const otherTiles: Set<TileRef> = new Set(otherUnits.map((u) => u.tile()));
|
||||
const otherTiles: Set<TileRef> = new Set(
|
||||
otherUnits.map((u) => u.tile()),
|
||||
);
|
||||
otherTiles.delete(tile);
|
||||
const closestOther = closestTwoTiles(mg, otherTiles, [tile]);
|
||||
if (closestOther !== null) {
|
||||
@@ -125,7 +132,9 @@ export function structureSpawnTileValue(
|
||||
}
|
||||
|
||||
// Prefer to be away from other structures of the same type
|
||||
const otherTiles: Set<TileRef> = new Set(otherUnits.map((u) => u.tile()));
|
||||
const otherTiles: Set<TileRef> = new Set(
|
||||
otherUnits.map((u) => u.tile()),
|
||||
);
|
||||
otherTiles.delete(tile);
|
||||
const closestOther = closestTwoTiles(mg, otherTiles, [tile]);
|
||||
if (closestOther !== null) {
|
||||
|
||||
@@ -13,33 +13,17 @@ 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);
|
||||
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 enemyUpdated: Tick | undefined;
|
||||
|
||||
constructor(
|
||||
private random: PseudoRandom,
|
||||
@@ -98,7 +82,7 @@ export class BotBehavior {
|
||||
|
||||
forgetOldEnemies() {
|
||||
// Forget old enemies
|
||||
if (this.game.ticks() - this.enemyUpdated > 100) {
|
||||
if (this.game.ticks() - (this.enemyUpdated ?? 0) > 100) {
|
||||
this.clearEnemy();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user