修复 获胜逻辑顺序错误问题

This commit is contained in:
2022-01-17 13:51:55 +08:00
parent 8c448602e1
commit 462fb4d3ba

View File

@ -136,10 +136,8 @@ object JHorseRacing : KotlinPlugin(
delay(Random.nextLong(5000, 7000))
// 所有马前进
for ((i, horse) in rank.horses.withIndex()) {
if (++horse.position >= lapLength) {
winners.add(i + 1)
}
for (horse in rank.horses) {
++horse.position
}
// 比赛事件触发
@ -154,6 +152,14 @@ object JHorseRacing : KotlinPlugin(
JHRPluginConfig.badEvents[Random.nextInt(JHRPluginConfig.badEvents.size)]
}
// 计算获胜者
for ((i, horse) in rank.horses.withIndex()) {
if (horse.position >= lapLength) {
winners.add(i + 1)
}
}
val number = (eventHorseIndex + 1).toString()
subject.sendMessage(eventMsg.replace("?", number))
delay(Random.nextLong(100, 200))