mirror of
https://github.com/jie65535/mirai-console-jhr-plugin.git
synced 2025-06-02 17:39:16 +08:00
增加梭哈指令
若获胜时下注积分为所有剩余积分,则奖励翻倍 修复 允许下注0分的问题
This commit is contained in:
parent
c848e4c408
commit
65a31c18a6
@ -194,8 +194,8 @@ object JHorseRacing : KotlinPlugin(
|
||||
val income = if (winners.indexOf(bet.number) != -1) {
|
||||
// 胜场计数累积
|
||||
stat.winCount += 1
|
||||
// 收益积分
|
||||
(bet.score * 1.5).toInt()
|
||||
// 收益积分 若梭哈,则奖励翻倍
|
||||
(bet.score * (if (bet.score == score) 3 else 1.5)).toInt()
|
||||
} else {
|
||||
// 亏损积分
|
||||
-bet.score
|
||||
@ -326,7 +326,7 @@ object JHorseRacing : KotlinPlugin(
|
||||
subject.sendMessage("没有这个编号的选手")
|
||||
return@subscribeAlways
|
||||
}
|
||||
if (coin == null || coin < 0) {
|
||||
if (coin == null || coin <= 0) {
|
||||
subject.sendMessage("胡乱下分不可取")
|
||||
return@subscribeAlways
|
||||
}
|
||||
@ -341,6 +341,20 @@ object JHorseRacing : KotlinPlugin(
|
||||
pool.add(Bet(sender.id, no, coin))
|
||||
subject.sendMessage(JHRPluginConfig.betMessage[Random.nextInt(JHRPluginConfig.betMessage.size)].replace("?", no.toString()))
|
||||
}
|
||||
msg.startsWith("梭哈") -> {
|
||||
val no = msg.removePrefix("梭哈").trim().toIntOrNull()
|
||||
if (no == null || no < 1 || no > horseCount) {
|
||||
subject.sendMessage("没有这个编号的选手")
|
||||
return@subscribeAlways
|
||||
}
|
||||
val score = JHRPluginData.Scores[sender.id]
|
||||
if (score == null || score <= 0) {
|
||||
subject.sendMessage("没分还来捣什么乱,快走开")
|
||||
return@subscribeAlways
|
||||
}
|
||||
pool.add(Bet(sender.id, no, score))
|
||||
subject.sendMessage(JHRPluginConfig.betMessage[Random.nextInt(JHRPluginConfig.betMessage.size)].replace("?", no.toString()))
|
||||
}
|
||||
msg.startsWith("增加好事") -> {
|
||||
val event = msg.removePrefix("增加好事").trim()
|
||||
if (event.isBlank()) {
|
||||
|
Loading…
Reference in New Issue
Block a user