mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 10:00:44 +00:00
no attack if not connected to the empty land.
This commit is contained in:
@@ -169,11 +169,18 @@ export class ClientGame {
|
||||
}
|
||||
|
||||
if (tile.isLand()) {
|
||||
for (const border of this.myPlayer.borderTiles()) {
|
||||
for (const n of border.neighbors()) {
|
||||
if (n.owner() == tile.owner()) {
|
||||
this.eventBus.emit(new SendAttackIntentEvent(targetID))
|
||||
return
|
||||
if (tile.hasOwner()) {
|
||||
if (this.myPlayer.sharesBorderWith(tile.owner())) {
|
||||
this.eventBus.emit(new SendAttackIntentEvent(targetID))
|
||||
}
|
||||
} else {
|
||||
|
||||
outer_loop: for (const t of bfs(tile, and(t => !t.hasOwner() && t.isLand(), dist(tile, 200)))) {
|
||||
for (const n of t.neighbors()) {
|
||||
if (n.owner() == this.myPlayer) {
|
||||
this.eventBus.emit(new SendAttackIntentEvent(targetID))
|
||||
break outer_loop
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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, manhattanDistWrapped, sourceDstOceanShore} from "../../../core/Util";
|
||||
import {and, bfs, dist, manhattanDist, manhattanDistWrapped, sourceDstOceanShore} from "../../../core/Util";
|
||||
import {ContextMenuEvent, MouseUpEvent} from "../../InputHandler";
|
||||
import {SendAllianceRequestIntentEvent, SendAttackIntentEvent, SendBoatAttackIntentEvent, SendBreakAllianceIntentEvent, SendSpawnIntentEvent, SendTargetPlayerIntentEvent} from "../../Transport";
|
||||
import {TransformHandler} from "../TransformHandler";
|
||||
@@ -231,8 +231,19 @@ export class RadialMenu implements Layer {
|
||||
}
|
||||
|
||||
if (tile.owner() != myPlayer && tile.isLand() && myPlayer.sharesBorderWith(other)) {
|
||||
if (!other.isPlayer() || !myPlayer.isAlliedWith(other)) {
|
||||
this.renderCenterButton(true)
|
||||
if (other.isPlayer()) {
|
||||
if (!myPlayer.isAlliedWith(other)) {
|
||||
this.renderCenterButton(true)
|
||||
}
|
||||
} else {
|
||||
outer_loop: for (const t of bfs(tile, and(t => !t.hasOwner() && t.isLand(), dist(tile, 200)))) {
|
||||
for (const n of t.neighbors()) {
|
||||
if (n.owner() == myPlayer) {
|
||||
this.renderCenterButton(true)
|
||||
break outer_loop
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user