Skip to content

Commit

Permalink
优化威逼逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteReimu committed Dec 6, 2024
1 parent 82adf7f commit b33d704
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/kotlin/Game.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class Game(val id: Int, totalPlayerCount: Int, val actorRef: ActorRef) {
var playTime: Long = 0
val isEarly: Boolean
get() = turn <= players.size

/** 威逼的明牌,回合末清空 */
val canWeiBiCardIds = ArrayList<Int>()

val waitSecond: Int
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/card/WeiBi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,10 @@ class WeiBi : Card {
.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 cardType =
if (player.weiBiFailRate > 0) listOf(Jie_Huo, Wu_Dao, Diao_Bao).random() // 威逼成功后一定纯随机
if (canWeiBiCards.isNotEmpty()) canWeiBiCards.random().type // 有明牌优先威逼明牌
else if (player.weiBiFailRate > 0) listOf(Jie_Huo, Wu_Dao, Diao_Bao).random() // 威逼成功后一定纯随机
else availableCardType.filter { cardType -> p.cards.any { it.type == cardType } }.run {
filter { it != Cheng_Qing }.ifEmpty { this }
}.random()
Expand Down

0 comments on commit b33d704

Please sign in to comment.