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

秦圆圆想要和清道夫、镇压者双飞杀队友,但又澄清救队友 #318

Open
CuteReimu opened this issue Dec 28, 2024 · 0 comments
Labels
AI AI相关 good first issue 适合新贡献者尝试的问题

Comments

@CuteReimu
Copy link
Owner

CuteReimu commented Dec 28, 2024

这里没有排除这种情况

/**
* 是否要救人
*/
fun Player.wantToSave(whoseTurn: Player, whoDie: Player): Boolean {
// 如果死亡的是老汉且有情报
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.roleFaceUp && 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 }
val pioneer = game!!.players.find { it!!.alive && it.identity == Black && it.secretTask == Pioneer }
val sweeper = game!!.players.find { it!!.alive && it.identity == Black && it.secretTask == Sweeper }
val stealer = game!!.players.find { it!!.alive && it.identity == Black && it.secretTask == Stealer }
if (killer === whoseTurn && whoDie.messageCards.countTrueCard() >= 2) {
if (killer === this) notSave = true
save = save || killer !== this
}
if (pioneer === whoDie && whoDie.messageCards.countTrueCard() >= 1) {
if (pioneer === this && whoseTurn !== stealer) notSave = true
if (stealer === this && whoseTurn === this) notSave = true
save = save || pioneer !== this
}
if (sweeper != null && whoDie.messageCards.run { count(Red) <= 1 && count(Blue) <= 1 }) {
if (sweeper === this && whoseTurn !== stealer) notSave = true
if (stealer === this && whoseTurn === this) notSave = true
save = save || sweeper !== this
}
return !notSave && save
}

当然了,记得排除以下特殊情况:

@CuteReimu CuteReimu added the AI AI相关 label Dec 28, 2024
@CuteReimu CuteReimu added the good first issue 适合新贡献者尝试的问题 label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI AI相关 good first issue 适合新贡献者尝试的问题
Projects
None yet
Development

No branches or pull requests

2 participants