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

秦无命AI优化,现在阵营方仍然会贴死自己 #311

Open
CuteReimu opened this issue Dec 16, 2024 · 0 comments
Open

秦无命AI优化,现在阵营方仍然会贴死自己 #311

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

Comments

@CuteReimu
Copy link
Owner

CuteReimu commented Dec 16, 2024

fun ai(e: MainPhaseIdle, skill: ActiveSkill): Boolean {
val p = e.whoseTurn
p.getSkillUseCount(SkillId.PIN_MING_SAN_LANG) == 0 || return false
val card = p.cards.run {
// 已经有2黑
if (p.messageCards.count(Black) == 2) {
if (p.identity == Black) {
// 如果是镇压者、先行者、清道夫,且自身达到任务条件,可以不考虑澄清
if ((p.secretTask == Killer && p.messageCards.countTrueCard() < 2) ||
(p.secretTask == Pioneer && p.messageCards.countTrueCard() < 1) ||
(p.secretTask == Sweeper && p.messageCards.run { count(Red) > 1 || count(Blue) > 1 })) {
filter { it.isPureBlack() }.ifEmpty { return false }.bestCard(p.identity, true)
}
// 其他神秘人不能自杀
else {
p.cards.filter { it.isPureBlack() }.ifEmpty { return false }
.run {
// 只有一张纯黑色手牌且是澄清
if (this.size == 1 && this[0].type == Cheng_Qing) {
// 没有其他澄清,不能自杀
if (p.cards.filter { it.type == Cheng_Qing }.size == 1) {
return false
}
// 有其他澄清,可以用这张澄清自杀
else {
this[0]
}
}
// 其他情况,手里有澄清才能自杀
else {
if (p.cards.filter { it.type == Cheng_Qing }.isEmpty()) {
return false
} else {
this.bestCard(p.identity, true)
}
}
}
}
}
// 阵营角色不能自杀
else {
p.cards.filter { it.isPureBlack() }.ifEmpty { return false }
.run {
if (this.size == 1 && this[0].type == Cheng_Qing) {
if (p.cards.filter { it.type == Cheng_Qing }.size == 1) {
return false
} else {
this[0]
}
} else {
if (p.cards.filter { it.type == Cheng_Qing }.isEmpty()) {
return false
} else {
this.bestCard(p.identity, true)
}
}
}
}
}
// 还没到2黑,可以随便选纯黑色牌
else {
filter { it.isPureBlack() }.ifEmpty { return false }.bestCard(p.identity, true)
}
}

@CuteReimu CuteReimu added the AI AI相关 label Dec 16, 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