mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 09:30:45 +00:00
no attack if not connected to the empty land.
This commit is contained in:
@@ -153,7 +153,7 @@
|
||||
* make create/break alliance single button DONE 10/1/2024
|
||||
* add request attack other players DONE 10/2/2024
|
||||
* Improve alliance icon DONE 10/2/2024
|
||||
* BUG: center button should be disabled select island
|
||||
* BUG: center button should be disabled select island DONE 10/2/2024
|
||||
* BUG: boat icon appears when click inland
|
||||
* BUG: double tap zooms on mobile
|
||||
* Make fake humans spawn by their country
|
||||
|
||||
@@ -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