Skip to content

Commit

Permalink
优化调虎离山和试探的出牌时机 (#283)
Browse files Browse the repository at this point in the history
* 优化调虎离山和试探的出牌时机

* 更改判断时机错误

* 优化代码
  • Loading branch information
zc-meng authored Sep 4, 2024
1 parent bacb596 commit c5c7e18
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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

0 comments on commit c5c7e18

Please sign in to comment.