parent
84baa309e3
commit
764ead46c2
|
|
@ -39,17 +39,19 @@ class GamePlaceBreakRule(val game: Game) {
|
||||||
game.map.teams.flatMap {
|
game.map.teams.flatMap {
|
||||||
it.sides + it.mine
|
it.sides + it.mine
|
||||||
}.map {
|
}.map {
|
||||||
it.containsBlock(loc)
|
it.containsBlock(loc).also { result -> debug("area $it contains $loc is $result") }
|
||||||
}.reduce { a, b -> a || b }
|
}.reduce { a, b -> a || b }
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow enemy wall
|
// allow enemy wall
|
||||||
addRule("allow_enemy_wall") { player, type, loc ->
|
addRule("allow_enemy_wall") { player, type, loc ->
|
||||||
val team = player.team ?: return@addRule false
|
val team = player.team ?: return@addRule false
|
||||||
val result = game.teams.filterNot { it == team }
|
val isWall = game.teams
|
||||||
.map { team.teamInfo.wall.containsBlock(loc) }
|
.map { team.teamInfo.wall.containsBlock(loc) }
|
||||||
.reduce { a, b -> a || b }
|
.reduce { a, b -> a || b }
|
||||||
if (type == BREAK) result else !result
|
if (!isWall) return@addRule false
|
||||||
|
val isHome = team.teamInfo.wall.containsBlock(loc)
|
||||||
|
(type == BREAK) xor isHome
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue