fix rule logic

This commit is contained in:
TONY_All 2023-06-10 22:02:00 +08:00
parent 20b1004e62
commit ef8e2391d6
No known key found for this signature in database
GPG Key ID: B868A344D7435E88
1 changed files with 5 additions and 3 deletions

View File

@ -39,15 +39,17 @@ 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).also { result -> debug("area $it contains $loc is $result") } it.containsBlock(loc)
}.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_wall_conditional") { player, type, loc ->
val team = player.team ?: return@addRule false val team = player.team ?: return@addRule false
val isWall = game.teams val isWall = game.teams
.map { team.teamInfo.wall.containsBlock(loc) } .map {
it.teamInfo.wall.containsBlock(loc).also { result -> debug("area ${it.teamInfo.wall} contains $loc is $result") }
}
.reduce { a, b -> a || b } .reduce { a, b -> a || b }
if (!isWall) return@addRule false if (!isWall) return@addRule false
val isHome = team.teamInfo.wall.containsBlock(loc) val isHome = team.teamInfo.wall.containsBlock(loc)