Skip to content

Commit

Permalink
修复机器人进行风云变幻选牌的情况下,在某些打牌风格的情况下会乱选的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteReimu committed Nov 15, 2024
1 parent bde8c63 commit 4491175
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/Player.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import org.apache.logging.log4j.kotlin.logger
import kotlin.random.Random

abstract class Player protected constructor() {
val coefficientA = Random.nextDouble(0.8, 1.2)
val coefficientB = Random.nextInt(-15, 15)
var coefficientA = Random.nextDouble(0.8, 1.2)
var coefficientB = Random.nextInt(-15, 15)

@Volatile
var game: Game? = null
Expand Down
7 changes: 7 additions & 0 deletions src/main/kotlin/card/FengYunBianHuan.kt
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ class FengYunBianHuan : Card {
} else {
var value = 0
var card: Card? = null
// 风云变幻选牌的情况下,因为都是明牌,不应该进行机器人打牌风格的波动
val coefficientA = r.coefficientA
val coefficientB = r.coefficientB
r.coefficientA = 0.0
r.coefficientB = 0
for (c in drawCards) {
!r.messageCards.any { it.hasSameColor(c) } || continue
val result = r.calculateMessageCardValue(mainPhaseIdle.whoseTurn, r, c)
Expand All @@ -189,6 +194,8 @@ class FengYunBianHuan : Card {
card = c
}
}
r.coefficientA = coefficientA
r.coefficientB = coefficientB
r.game!!.tryContinueResolveProtocol(r, fengYunBianHuanChooseCardTos {
if (card != null) {
cardId = card.id
Expand Down

0 comments on commit 4491175

Please sign in to comment.