diff --git a/src/client/index.html b/src/client/index.html index 42742c31c..d335c01f5 100644 --- a/src/client/index.html +++ b/src/client/index.html @@ -95,16 +95,16 @@ - - - + + + - - - - - + + + + + diff --git a/src/core/Schemas.ts b/src/core/Schemas.ts index 7495d0ff6..7133f0d37 100644 --- a/src/core/Schemas.ts +++ b/src/core/Schemas.ts @@ -47,8 +47,14 @@ export interface Lobby { numClients: number; } - - +const EmojiSchema = z.string().refine( + (val) => { + return /\p{Emoji}/u.test(val); + }, + { + message: "Must contain at least one emoji character" + } +); // Zod schemas const BaseIntentSchema = z.object({ type: z.enum(['attack', 'spawn', 'boat', 'name', 'targetPlayer', 'emoji']), @@ -119,12 +125,7 @@ export const EmojiIntentSchema = BaseIntentSchema.extend({ type: z.literal('emoji'), sender: z.string(), recipient: z.string(), - emoji: z.string().refine( - (val) => /^\p{Emoji}$/u.test(val), - { - message: "Must be a single emoji" - } - ) + emoji: EmojiSchema, }) const IntentSchema = z.union([ diff --git a/src/core/configuration/DevConfig.ts b/src/core/configuration/DevConfig.ts index 63033ec31..793d1247a 100644 --- a/src/core/configuration/DevConfig.ts +++ b/src/core/configuration/DevConfig.ts @@ -30,12 +30,12 @@ export const devConfig = new class extends DefaultConfig { // return 1 // } - startTroops(playerInfo: PlayerInfo): number { - // if (playerInfo.isBot) { - // return 5000 - // } - return 50000 - } + // startTroops(playerInfo: PlayerInfo): number { + // // if (playerInfo.isBot) { + // // return 5000 + // // } + // return 50000 + // } // troopAdditionRate(player: Player): number { // if (player.isBot()) { diff --git a/src/core/execution/FakeHumanExecution.ts b/src/core/execution/FakeHumanExecution.ts index 8805cd91d..ef3c361f1 100644 --- a/src/core/execution/FakeHumanExecution.ts +++ b/src/core/execution/FakeHumanExecution.ts @@ -149,12 +149,14 @@ export class FakeHumanExecution implements Execution { } } - sendBoat(tries: number = 0) { - if (tries > 100) { + sendBoat(tries: number = 0, oceanShore: Tile[] = null) { + if (tries > 10) { return } - const oceanShore = Array.from(this.player.borderTiles()).filter(t => t.isOceanShore()) + if (oceanShore == null) { + oceanShore = Array.from(this.player.borderTiles()).filter(t => t.isOceanShore()) + } if (oceanShore.length == 0) { return } @@ -171,7 +173,7 @@ export class FakeHumanExecution implements Execution { return } - for (let i = 0; i < 100; i++) { + for (let i = 0; i < 20; i++) { const dst = this.random.randElement(otherShore) if (this.isSmallIsland(dst)) { continue @@ -188,8 +190,7 @@ export class FakeHumanExecution implements Execution { )) return } - this.sendBoat(tries + 1) - + this.sendBoat(tries + 1, oceanShore) } randomLand(): Tile { @@ -216,7 +217,7 @@ export class FakeHumanExecution implements Execution { } isSmallIsland(tile: Tile): boolean { - return bfs(tile, and((t) => t.isLand(), dist(tile, 50))).size < 50 + return bfs(tile, and((t) => t.isLand(), dist(tile, 10))).size < 50 } owner(): MutablePlayer {