From ef8e2391d616b8a6efc7f0cf9b5da4f66d296219 Mon Sep 17 00:00:00 2001 From: TONY_All Date: Sat, 10 Jun 2023 22:02:00 +0800 Subject: [PATCH] fix rule logic --- .../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 2c0a716..0f65697 100644 --- a/src/main/kotlin/cc/maxmc/blastingcrisis/game/GamePlaceBreakRule.kt +++ b/src/main/kotlin/cc/maxmc/blastingcrisis/game/GamePlaceBreakRule.kt @@ -39,15 +39,17 @@ class GamePlaceBreakRule(val game: Game) { game.map.teams.flatMap { it.sides + it.mine }.map { - it.containsBlock(loc).also { result -> debug("area $it contains $loc is $result") } + it.containsBlock(loc) }.reduce { a, b -> a || b } } // 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 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 } if (!isWall) return@addRule false val isHome = team.teamInfo.wall.containsBlock(loc)