mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 14:30:44 +00:00
fix calculate cluster conquering itself because removeCluster changed tile ownership
This commit is contained in:
@@ -148,6 +148,11 @@ export class PlayerExecution implements Execution {
|
||||
|
||||
private removeCluster(cluster: Set<Tile>) {
|
||||
const arr = Array.from(cluster)
|
||||
if (arr.some(t => t.owner() != this.player)) {
|
||||
// Other removeCluster operations could change tile owners,
|
||||
// so double check.
|
||||
return
|
||||
}
|
||||
const mode = getMode(arr.flatMap(t => t.neighbors()).filter(t => t.hasOwner() && t.owner() != this.player).map(t => t.owner().id()))
|
||||
if (!this.mg.hasPlayer(mode)) {
|
||||
consolex.warn('mode is not found')
|
||||
|
||||
Reference in New Issue
Block a user