Skip to content

Commit

Permalink
神秘人试探优化 (#282)
Browse files Browse the repository at this point in the history
* 神秘人试探优化

* 优化代码

---------

Co-authored-by: 奇葩の灵梦 <[email protected]>
  • Loading branch information
zc-meng and CuteReimu authored Sep 4, 2024
1 parent 0182a69 commit bacb596
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main/kotlin/card/ShiTan.kt
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,24 @@ class ShiTan : Card {
}
}

player.identity == Black -> {
// 按照和自己身份相同的情报数降序排列,然后按照手牌数升序排列
val c1: Comparator<Player?> = Comparator { p1, p2 ->
val p1MsgCount = p1!!.messageCards.count(p1.identity)
val p2MsgCount = p2!!.messageCards.count(p2.identity)
if (p1MsgCount != p2MsgCount)
return@Comparator p2MsgCount.compareTo(p1MsgCount)
p1.cards.size.compareTo(p2.cards.size)
}
val colors = listOf(Red, Blue).filter { it !in (card as ShiTan).whoDrawCard }
if (colors.isEmpty()) return false
else {
listOf(player.game!!.players.filter {
it!!.alive && it.identity in colors && it.cards.isNotEmpty()
}.minWithOrNull(c1))
}
}

jianXianSheng != null && player.isPartner(jianXianSheng) ->
listOf(jianXianSheng)

Expand Down

0 comments on commit bacb596

Please sign in to comment.