Skip to content

Commit

Permalink
李宁玉和老汉死亡时澄清优化 (#280)
Browse files Browse the repository at this point in the history
* 李宁玉和老汉死亡时澄清优化

* 优化老汉【视死】AI

* 当前回合是篡夺者时,队友会救李宁玉防止发技能获胜

---------

Co-authored-by: 奇葩の灵梦 <[email protected]>
  • Loading branch information
zc-meng and CuteReimu authored Sep 2, 2024
1 parent 53a80d3 commit 52d6d97
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 deletions src/main/kotlin/MessageCardValue.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.fengsheng.ScoreFactory.logger
import com.fengsheng.card.Card
import com.fengsheng.card.count
import com.fengsheng.card.countTrueCard
import com.fengsheng.card.filter
import com.fengsheng.phase.FightPhaseIdle
import com.fengsheng.protos.Common.*
import com.fengsheng.protos.Common.card_type.*
Expand Down Expand Up @@ -268,7 +269,11 @@ fun Player.calculateMessageCardValue(
inFrontOfWhom.messageCards.removeLast()
}
if (Black in colors && inFrontOfWhom.skills.any { it is ShiSi }) { // 老汉【视死】
v1 += 20
if (isPartnerOrSelf(inFrontOfWhom)) {
v1 += 20
} else if (inFrontOfWhom.identity != Black && identity != Black) { // 自己是神秘人就无视,老汉是神秘人也无视
v1 -= 20
}
}
if (Black in colors && inFrontOfWhom.skills.any { it is YiXin } && inFrontOfWhom.messageCards.count(Black) == 2) {
// 李宁玉【遗信】
Expand Down Expand Up @@ -606,9 +611,36 @@ fun Player.calSendMessageCard(
* 是否要救人
*/
fun Player.wantToSave(whoseTurn: Player, whoDie: Player): Boolean {
if (whoDie.skills.any { it is RuGui } && whoDie.messageCards.isNotEmpty() ||
whoDie.skills.any { it is YiXin } && whoDie.cards.isNotEmpty())
return false // 如果李宁玉有手牌|老汉有情报,则所有人都不救
// 如果死亡的是老汉且有情报
if (whoDie.skills.any { it is RuGui } && whoDie.messageCards.isNotEmpty()) {
// 如果老汉和当前回合角色是同一身份+老汉情报区有该颜色情报+当前回合角色听牌
if (whoDie !== whoseTurn && whoDie.identity == whoseTurn.identity &&
!whoDie.messageCards.filter(whoDie.identity).isEmpty() &&
whoseTurn.messageCards.count(whoseTurn.identity) == 2) {
// 如果自己也是同一阵营,则不救
if (isPartnerOrSelf(whoDie)) {
return false
}
// 如果自己不是同一阵营,则救(防止发动技能后敌方胜利)
return true
}
}
// 如果死亡的是李宁玉且有手牌
if (whoDie.skills.any { it is YiXin } && whoDie.cards.isNotEmpty()) {
// 如果李宁玉的队友听牌
if (whoDie.game!!.players.any {
it!!.alive && it !== whoDie && it.identity == whoDie.identity && it.messageCards.count(whoDie.identity) == 2
}) {
// 如果自己也是同一阵营,则不救
if (isPartnerOrSelf(whoDie)) {
val stealer = game!!.players.find { it!!.alive && it.identity == Black && it.secretTask == Stealer }
// 特殊情况:当前回合是篡夺者,则救
return whoseTurn === stealer
}
// 如果自己不是同一阵营,则救(防止发动技能后敌方胜利)
return true
}
}
var save = isPartnerOrSelf(whoDie)
var notSave = false
val killer = game!!.players.find { it!!.alive && it.identity == Black && it.secretTask == Killer }
Expand Down

0 comments on commit 52d6d97

Please sign in to comment.