diff --git a/resources/images/VintageMap2.png b/resources/images/VintageMap2.png new file mode 100644 index 000000000..d98438680 Binary files /dev/null and b/resources/images/VintageMap2.png differ diff --git a/src/client/Client.ts b/src/client/Client.ts index 2d2b53787..e0d2c8917 100644 --- a/src/client/Client.ts +++ b/src/client/Client.ts @@ -6,7 +6,7 @@ import {GameID, Lobby, ServerMessage, ServerMessageSchema} from "../core/Schemas import {loadTerrainMap, TerrainMap} from "../core/TerrainMapLoader"; import {ClientGame, createClientGame} from "./ClientGame"; import {v4 as uuidv4} from 'uuid'; -import backgroundImage from '../../resources/images/VintageMap.png'; +import backgroundImage from '../../resources/images/VintageMap2.png'; import favicon from '../../resources/images/Favicon.png'; import './styles.css'; diff --git a/src/client/ClientGame.ts b/src/client/ClientGame.ts index 00aa4a8da..02d37b8aa 100644 --- a/src/client/ClientGame.ts +++ b/src/client/ClientGame.ts @@ -1,5 +1,5 @@ import {Executor} from "../core/execution/Executor"; -import {Cell, MutableGame, PlayerEvent, PlayerID, MutablePlayer, TileEvent, Player, Game, BoatEvent} from "../core/Game"; +import {Cell, MutableGame, PlayerEvent, PlayerID, MutablePlayer, TileEvent, Player, Game, BoatEvent, Tile} from "../core/Game"; import {createGame} from "../core/GameImpl"; import {EventBus} from "../core/EventBus"; import {Config} from "../core/configuration/Config"; @@ -188,24 +188,37 @@ export class ClientGame { } const owner = tile.owner() - const targetID = owner.isPlayer() ? owner.id() : null - if (tile.owner() != this.myPlayer && tile.isLand()) { - const tn = Array.from(bfs(tile, 6)) - .filter(t => t.isOcean()) - .filter(t => !t.hasOwner()) - .sort((a, b) => manhattanDist(tile.cell(), a.cell()) - manhattanDist(tile.cell(), b.cell())) - .flatMap(t => t.neighbors()) - .filter(n => n.isShore()) + const targetID = owner.isPlayer() ? owner.id() : null; + let tn: Tile[] = [] + if (tile.owner() != this.myPlayer) { + + // Boat Attack Terra Nullius + if (tile.isLand()) { + tn = Array.from(bfs(tile, 2)) + .filter(t => t.isOcean()) + .sort((a, b) => manhattanDist(tile.cell(), a.cell()) - manhattanDist(tile.cell(), b.cell())) + .flatMap(t => t.neighbors()) + .filter(n => n.isShore()) + .filter(n => !n.hasOwner()) + } else if (tile.isOcean()) { + tn = Array.from(bfs(tile, 3)) + .filter(t => t.isShore()) + .filter(t => !t.hasOwner()) + .sort((a, b) => manhattanDist(tile.cell(), a.cell()) - manhattanDist(tile.cell(), b.cell())) + } if (tn.length > 0) { this.sendBoatAttackIntent(targetID, tn[0].cell(), this.gs.config().player().boatAttackAmount(this.myPlayer, owner)) return } - if (this.myPlayer.sharesBorderWith(tile.owner())) { - this.sendAttackIntent(targetID, cell, this.gs.config().player().attackAmount(this.myPlayer, owner)) - } else if (owner.isPlayer()) { - console.log('going to send boat') - this.sendBoatAttackIntent(targetID, cell, this.gs.config().player().boatAttackAmount(this.myPlayer, owner)) + // Attack Player + if (tile.isLand()) { + if (this.myPlayer.sharesBorderWith(tile.owner())) { + this.sendAttackIntent(targetID, cell, this.gs.config().player().attackAmount(this.myPlayer, owner)) + } else if (owner.isPlayer()) { + console.log('going to send boat') + this.sendBoatAttackIntent(targetID, cell, this.gs.config().player().boatAttackAmount(this.myPlayer, owner)) + } } } } diff --git a/src/client/index.html b/src/client/index.html index 10fa9afcb..be2667af0 100644 --- a/src/client/index.html +++ b/src/client/index.html @@ -4,7 +4,7 @@
-