diff --git a/TODO.txt b/TODO.txt index a09766dfb..2ef803337 100644 --- a/TODO.txt +++ b/TODO.txt @@ -151,8 +151,6 @@ * BUG: alliance cooldown request * add request attack * add emoji button -* buttons greyed out when not active -* make alliance request mobile friendly * request to attack other players * make year clock * block user inputs if too far behind server diff --git a/src/client/graphics/layers/RadialMenu.ts b/src/client/graphics/layers/RadialMenu.ts index 999945998..834b2a0d7 100644 --- a/src/client/graphics/layers/RadialMenu.ts +++ b/src/client/graphics/layers/RadialMenu.ts @@ -1,7 +1,7 @@ import {EventBus} from "../../../core/EventBus"; import {Cell, Game, Player, PlayerID} from "../../../core/game/Game"; import {ClientID} from "../../../core/Schemas"; -import {manhattanDist, sourceDstOceanShore} from "../../../core/Util"; +import {manhattanDist, manhattanDistWrapped, sourceDstOceanShore} from "../../../core/Util"; import {ContextMenuEvent, MouseUpEvent} from "../../InputHandler"; import {SendAllianceRequestIntentEvent, SendAttackIntentEvent, SendBoatAttackIntentEvent, SendBreakAllianceIntentEvent, SendSpawnIntentEvent} from "../../Transport"; import {TransformHandler} from "../TransformHandler"; @@ -284,7 +284,7 @@ export class RadialMenu implements Layer { if (myPlayerBordersOcean && otherPlayerBordersOcean) { const [src, dst] = sourceDstOceanShore(this.game, myPlayer, other, this.clickedCell) if (src != null && dst != null) { - if (manhattanDist(src.cell(), dst.cell()) < this.game.config().boatMaxDistance()) { + if (manhattanDistWrapped(src.cell(), dst.cell(), this.game.width()) < this.game.config().boatMaxDistance()) { this.activateMenuElement(RadialElement.BoatAttack, () => { this.eventBus.emit( new SendBoatAttackIntentEvent(other.id(), this.clickedCell, null) diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index 8c91c5868..2c35e9153 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -26,7 +26,7 @@ export class DefaultConfig implements Config { return 400 } numFakeHumans(gameID: GameID): number { - return simpleHash(gameID) % 20 + return simpleHash(gameID) % 40 } turnIntervalMs(): number { return 100 @@ -59,12 +59,20 @@ export class DefaultConfig implements Config { // speed = mag if (attacker.isPlayer() && defender.isPlayer()) { - if (attacker.type() == PlayerType.Bot && (defender.type() == PlayerType.FakeHuman || defender.type() == PlayerType.Human)) { + if (attacker.type() == PlayerType.Bot && defender.type() == PlayerType.Human) { mag *= 1.2 } - if ((attacker.type() == PlayerType.FakeHuman || attacker.type() == PlayerType.Human) && defender.type() == PlayerType.Bot) { + if (attacker.type() == PlayerType.Bot && defender.type() == PlayerType.FakeHuman) { + mag *= 1.5 + } + + + if (attacker.type() == PlayerType.Human && defender.type() == PlayerType.Bot) { mag *= .8 } + if (attacker.type() == PlayerType.FakeHuman && defender.type() == PlayerType.Bot) { + mag *= .6 + } } if (defender.isPlayer()) { @@ -124,7 +132,7 @@ export class DefaultConfig implements Config { // console.log(`to add ${toAdd}`) if (player.type() == PlayerType.FakeHuman) { - toAdd *= 1.0 + toAdd *= 1.1 } if (player.type() == PlayerType.Bot) { toAdd *= .7 diff --git a/src/core/configuration/DevConfig.ts b/src/core/configuration/DevConfig.ts index 4d1daf00c..c12f8a1a4 100644 --- a/src/core/configuration/DevConfig.ts +++ b/src/core/configuration/DevConfig.ts @@ -27,9 +27,9 @@ export const devConfig = new class extends DefaultConfig { // return 10 * 10 // } - numFakeHumans(gameID: GameID): number { - return 0 - } + // numFakeHumans(gameID: GameID): number { + // return 0 + // } // startTroops(playerInfo: PlayerInfo): number { // if (playerInfo.isBot) { diff --git a/src/core/execution/FakeHumanExecution.ts b/src/core/execution/FakeHumanExecution.ts index ac04d6deb..75f0ebbfd 100644 --- a/src/core/execution/FakeHumanExecution.ts +++ b/src/core/execution/FakeHumanExecution.ts @@ -18,6 +18,7 @@ export class FakeHumanExecution implements Execution { private enemy: Player | null = null private rejected: Set = new Set + private isTraitor = false constructor(private playerInfo: PlayerInfo) { @@ -26,6 +27,9 @@ export class FakeHumanExecution implements Execution { init(mg: MutableGame, ticks: number) { this.mg = mg + if (this.random.chance(2)) { + this.isTraitor = true + } } tick(ticks: number) { @@ -106,11 +110,11 @@ export class FakeHumanExecution implements Execution { } if (this.random.chance(2)) { - if (!this.player.isAlliedWith(enemies[0]) || this.random.chance(30)) { + if (!this.player.isAlliedWith(enemies[0]) || (this.random.chance(90) && this.isTraitor)) { this.sendAttack(enemies[0]) } } else { - if (!this.player.isAlliedWith(enemies[0]) || this.random.chance(60)) { + if (!this.player.isAlliedWith(enemies[0]) || (this.random.chance(180) && this.isTraitor)) { this.sendAttack(this.random.randElement(enemies)) } }