Skip to content

Commit

Permalink
修复AI会威逼错误类型的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteReimu committed Dec 7, 2024
1 parent b33d704 commit 75f1bca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/kotlin/card/WeiBi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,14 @@ class WeiBi : Card {
it.isEnemy(player) &&
it.cards.any { card -> card.type in availableCardType }
}.run {
filter { it!!.cards.any { card -> card.id in player.game!!.canWeiBiCardIds } }.ifEmpty {
filter { it!!.cards.any { card ->
card.id in player.game!!.canWeiBiCardIds && card.type in availableCardType }
}.ifEmpty {
filter { it!!.cards.any { card -> card.type in listOf(Jie_Huo, Wu_Dao, Diao_Bao) } }.ifEmpty { this }
.run { if (player.identity != Black) filter { it!!.identity != Black }.ifEmpty { this } else this }
}
}.randomOrNull() ?: return false
val canWeiBiCards = p.cards.filter { it.id in player.game!!.canWeiBiCardIds }
val canWeiBiCards = p.cards.filter { it.id in player.game!!.canWeiBiCardIds && card.type in availableCardType }
val cardType =
if (canWeiBiCards.isNotEmpty()) canWeiBiCards.random().type // 有明牌优先威逼明牌
else if (player.weiBiFailRate > 0) listOf(Jie_Huo, Wu_Dao, Diao_Bao).random() // 威逼成功后一定纯随机
Expand Down

0 comments on commit 75f1bca

Please sign in to comment.