Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化调虎离山和试探的出牌时机 #283

Merged
merged 3 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/kotlin/card/DiaoHuLiShan.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.fengsheng.phase.OnFinishResolveCard
import com.fengsheng.phase.ResolveCard
import com.fengsheng.protos.Common.card_type.Diao_Hu_Li_Shan
import com.fengsheng.protos.Common.color
import com.fengsheng.protos.Common.color.*
import com.fengsheng.protos.Common.direction
import com.fengsheng.protos.useDiaoHuLiShanToc
import com.fengsheng.send
Expand Down Expand Up @@ -87,6 +88,11 @@ class DiaoHuLiShan : Card {
return p.cards.count { c -> c.type in WeiBi.availableCardType }
}

// 只有在有阵营听牌时才会打出调虎离山
player.game!!.players.any {
it!!.alive && it.identity in listOf(Red, Blue) && it.messageCards.count(it.identity) == 2
} || return false

val enemies = player.game!!.players.filter {
it!!.alive && it.isEnemy(player)
}.filterNotNull().shuffled()
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/card/ShiTan.kt
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ class ShiTan : Card {
}

player.identity == Black -> {
player.game!!.players.any {
it!!.alive && it.identity in listOf(Red, Blue) && it.messageCards.count(it.identity) == 2
} || return false
// 按照和自己身份相同的情报数降序排列,然后按照手牌数升序排列
val c1: Comparator<Player?> = Comparator { p1, p2 ->
val p1MsgCount = p1!!.messageCards.count(p1.identity)
Expand Down