From 83e704f43e326a981a289ee310de74b6f716d60f Mon Sep 17 00:00:00 2001 From: jie65535 Date: Mon, 24 Jan 2022 10:07:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E8=B5=9B=E9=A9=AC?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/JHorseRacing.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/kotlin/JHorseRacing.kt b/src/main/kotlin/JHorseRacing.kt index 8599ce7..d57664a 100644 --- a/src/main/kotlin/JHorseRacing.kt +++ b/src/main/kotlin/JHorseRacing.kt @@ -141,8 +141,11 @@ object JHorseRacing : KotlinPlugin( // 比赛事件触发 val steps = (1..3).random() //事件触发前进或后退随机大小 + // 事件赛马下标 val eventHorseIndex = Random.nextInt(rank.horses.size) + // 事件赛马 val eventHorse = rank.horses[eventHorseIndex] + // 触发事件 val eventMsg = if (Random.nextInt(77) > 32) { eventHorse.position += steps JHRPluginConfig.goodEvents[Random.nextInt(JHRPluginConfig.goodEvents.size)] @@ -159,9 +162,11 @@ object JHorseRacing : KotlinPlugin( } } + // 发送事件消息 val number = (eventHorseIndex + 1).toString() subject.sendMessage(eventMsg.replace("?", number)) delay(Random.nextLong(100, 200)) + // 渲染赛马 subject.sendMessage(drawHorse(rank.horses)) } delay(Random.nextLong(100, 200)) @@ -174,28 +179,38 @@ object JHorseRacing : KotlinPlugin( } // 增加总赛马场次 JHRPluginData.totalRankCount += 1 + // 移除比赛 ranks.remove(subject.id) + // 奖池结算 val pool = pools.remove(subject.id) if (pool != null && pool.size > 0) { for (bet in pool) { val score = JHRPluginData.Scores[bet.id]!! val stat = getPlayerStat(bet.id) + // 下注计数 stat.betCount += 1 + // 下注积分累积 stat.totalBetScore += bet.score val income = if (winners.indexOf(bet.number) != -1) { + // 胜场计数累积 stat.winCount += 1 + // 收益积分 (bet.score * 1.5).toInt() } else { + // 亏损积分 -bet.score } + // 计算积分 JHRPluginData.Scores[bet.id] = score + income mb.add("\n") mb.add(At(bet.id)) if (income > 0) { mb.add(" +$income") + // 累计收益 stat.totalWinScore += income } else { mb.add(" $income") + // 累计亏损 stat.totalLossScore += income } }