From 764ead46c277c43c05ac0c31cfbe36dd22589283 Mon Sep 17 00:00:00 2001 From: tony_all Date: Wed, 7 Jun 2023 16:05:45 +0800 Subject: [PATCH] fix rule match add debug --- .../cc/maxmc/blastingcrisis/game/GamePlaceBreakRule.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/cc/maxmc/blastingcrisis/game/GamePlaceBreakRule.kt b/src/main/kotlin/cc/maxmc/blastingcrisis/game/GamePlaceBreakRule.kt index 3fced52..2c0a716 100644 --- a/src/main/kotlin/cc/maxmc/blastingcrisis/game/GamePlaceBreakRule.kt +++ b/src/main/kotlin/cc/maxmc/blastingcrisis/game/GamePlaceBreakRule.kt @@ -39,17 +39,19 @@ class GamePlaceBreakRule(val game: Game) { game.map.teams.flatMap { it.sides + it.mine }.map { - it.containsBlock(loc) + it.containsBlock(loc).also { result -> debug("area $it contains $loc is $result") } }.reduce { a, b -> a || b } } // allow enemy wall addRule("allow_enemy_wall") { player, type, loc -> val team = player.team ?: return@addRule false - val result = game.teams.filterNot { it == team } + val isWall = game.teams .map { team.teamInfo.wall.containsBlock(loc) } .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 } } } \ No newline at end of file