Skip to content

Commit

Permalink
王响、白小年、鬼脚、玛利亚AI优化
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteReimu committed Sep 12, 2024
1 parent 0b62064 commit ab38fad
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
14 changes: 14 additions & 0 deletions src/main/kotlin/MessageCardValue.kt
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,20 @@ fun Player.calculateMessageCardValue(
addScore(inFrontOfWhom, 10)
}
}
if (colors.any { it != Black } && inFrontOfWhom.skills.any { it is WorkersAreKnowledgable }) {
// 王响【咱们工人有知识】
addScore(inFrontOfWhom, 9)
}
if (Black !in colors && inFrontOfWhom.skills.any { it is ZhuanJiao || it is JiSong }) {
// 白小年【转交】、鬼脚【急送】
addScore(inFrontOfWhom, 11)
}
if (sender.skills.any { it is CangShenJiaoTang }) {
// 玛利亚【藏身教堂】
if (sender.isPartnerOrSelf(inFrontOfWhom) && !inFrontOfWhom.isPublicRole && inFrontOfWhom.roleFaceUp) {
addScore(inFrontOfWhom, 80)
}
}
if (Black in colors && inFrontOfWhom.roleFaceUp &&
inFrontOfWhom.skills.any { it is YiXin } && inFrontOfWhom.messageCards.count(Black) == 2) {
// 李宁玉【遗信】
Expand Down
12 changes: 3 additions & 9 deletions src/main/kotlin/RobotPlayer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.fengsheng.protos.Common.color.Black
import com.fengsheng.protos.Common.direction
import com.fengsheng.protos.Common.direction.Left
import com.fengsheng.protos.Common.direction.Right
import com.fengsheng.protos.Common.role.*
import com.fengsheng.protos.Common.role.zhang_yi_ting
import com.fengsheng.protos.Common.secret_task.*
import com.fengsheng.protos.endReceivePhaseTos
import com.fengsheng.protos.notifyDieGiveCardToc
Expand Down Expand Up @@ -150,14 +150,8 @@ class RobotPlayer : Player() {
if (myValue >= 0 || nextNextValue >= 0) {
if (myValue > myNextValue) return@run true // 自己比下家收益高就接
if (myValue == myNextValue && myValue >= 0) {
// 下家和自己是队友,且下家是张一挺,王响,白小年就不接
if (isPartner(nextPlayer) && (
nextPlayer.role == zhang_yi_ting ||
nextPlayer.role == huo_che_si_ji ||
nextPlayer.role == bai_xiao_nian)) {
return@run false
}
return@run true // 相等的情况下,收益不为负就接
// 相等的情况下,下家和自己是队友,且下家是张一挺就不接,否则接
return@run !(isPartner(nextPlayer) && nextPlayer.role == zhang_yi_ting)
}
}
val lockPlayer = fsm.lockedPlayers.ifEmpty { listOf(fsm.sender) }.first()
Expand Down
9 changes: 8 additions & 1 deletion src/main/kotlin/phase/WaitForSelectRole.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package com.fengsheng.phase

import com.fengsheng.*
import com.fengsheng.protos.*
import com.fengsheng.protos.Common.color.Black
import com.fengsheng.protos.Common.role.*
import com.fengsheng.protos.Common.secret_task.Collector
import com.fengsheng.protos.Common.secret_task.Disturber
import com.fengsheng.protos.Fengsheng.select_role_tos
import com.fengsheng.protos.gameStartToc
import com.fengsheng.protos.selectRoleToc
import com.fengsheng.protos.selectRoleTos
import com.fengsheng.protos.waitForSelectRoleToc
import com.fengsheng.skill.RoleCache
import com.fengsheng.skill.RoleSkillsData
import com.google.protobuf.GeneratedMessage
Expand Down Expand Up @@ -45,6 +49,9 @@ data class WaitForSelectRole(val game: Game, val options: List<List<RoleSkillsDa
if (player.secretTask == Collector) {
aiPreferRole -= bai_xiao_nian
}
if (player.secretTask == Disturber) {
aiPreferRole -= huo_che_si_ji
}
}
filter { it.role in aiPreferRole }.ifEmpty {
RoleCache.filterForbidRoles(aiPreferRole).filter {
Expand Down

0 comments on commit ab38fad

Please sign in to comment.