Skip to content

Commit

Permalink
机器人优先选商玉,调整AI商玉强度
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteReimu committed Nov 20, 2023
1 parent e729bad commit 186aae9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/main/kotlin/phase/WaitForSelectRole.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ data class WaitForSelectRole(val game: Game, val options: List<List<RoleSkillsDa
} else {
selected[player!!.location] = options[player.location].run {
if (Config.IsGmEnable) return@run firstOrNull()
maxByOrNull { it.role.number % 1000 + it.role.number / 1000 * 30 }
find { it.role == role.shang_yu }
?: maxByOrNull { it.role.number % 1000 + it.role.number / 1000 * 30 }
} ?: RoleSkillsData()
player.roleSkillsData = selected[player.location]!!
player.originRole = selected[player.location]!!.role
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/skill/JieDaoShaRen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.fengsheng.protos.Role.*
import com.google.protobuf.GeneratedMessageV3
import org.apache.log4j.Logger
import java.util.concurrent.TimeUnit
import kotlin.random.Random

/**
* 商玉技能【借刀杀人】:争夺阶段,你可以翻开此角色牌,然后抽取另一名角色的一张手牌并展示之。若展示的牌是:**黑色**,则你可以将其置入一名角色的情报区,并将你的角色牌翻至面朝下。**非黑色**,则你摸一张牌。
Expand Down Expand Up @@ -185,7 +186,7 @@ class JieDaoShaRen : InitialSkill, ActiveSkill {
fun ai(e: FightPhaseIdle, skill: ActiveSkill): Boolean {
val player = e.whoseFightTurn
!player.roleFaceUp || return false
player.getSkillUseCount(SkillId.JIE_DAO_SHA_REN) < 2 || return false
player.getSkillUseCount(SkillId.JIE_DAO_SHA_REN) == 0 || Random.nextBoolean() || return false
val target = player.game!!.players.filter {
it !== player && it!!.alive && it.cards.isNotEmpty() &&
it.cards.all { card -> card.colors.contains(color.Black) }
Expand Down

0 comments on commit 186aae9

Please sign in to comment.