Skip to content

Commit 752c223

Browse files
committed
fix issue 42
1 parent 26ae4f5 commit 752c223

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

src/main/kotlin/RoomTypeLink.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ object RoomTypeLink : RoomType {
2727
val st = room.spellStatus!![idx]
2828
if (status == SpellStatus.BANNED)
2929
throw HandlerException("不支持的操作")
30-
SpellLog.logSpellOperate(status, room.spells!![idx], token, gameType = SpellLog.GameType.LINK)
31-
return when (token) {
30+
31+
val result = when (token) {
3232
room.host -> status
3333

3434
room.players[0] -> {
@@ -111,6 +111,8 @@ object RoomTypeLink : RoomType {
111111

112112
else -> throw HandlerException("内部错误")
113113
}
114+
SpellLog.logSpellOperate(status, room.spells!![idx], token, gameType = SpellLog.GameType.LINK)
115+
return result
114116
}
115117

116118
private infix fun Int.near(other: Int): Boolean {

src/main/kotlin/RoomTypeNormal.kt

+15-12
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,8 @@ object RoomTypeNormal : RoomType {
2626
if (room.startMs > now - room.countDown.toLong() * 1000L) {
2727
if (!status.isSelectStatus() && !(status == NONE && st.isSelectStatus()))
2828
throw HandlerException("倒计时还没结束")
29-
// 倒计时没结束,需要按照倒计时已经结束的时间点计算开始收卡的时间
30-
SpellLog.logSpellOperate(
31-
status,
32-
room.spells!![idx],
33-
token,
34-
room.startMs + room.countDown.toLong() * 1000L,
35-
SpellLog.GameType.NORMAL
36-
)
37-
} else {
38-
SpellLog.logSpellOperate(status, room.spells!![idx], token, gameType = SpellLog.GameType.NORMAL)
3929
}
40-
41-
return when (token) {
30+
val result = when (token) {
4231
room.host ->
4332
status
4433

@@ -97,6 +86,20 @@ object RoomTypeNormal : RoomType {
9786
else ->
9887
throw HandlerException("内部错误")
9988
}
89+
// 等操作结束后再记录
90+
if (room.startMs > now - room.countDown.toLong() * 1000L) {
91+
// 倒计时没结束,需要按照倒计时已经结束的时间点计算开始收卡的时间
92+
SpellLog.logSpellOperate(
93+
status,
94+
room.spells!![idx],
95+
token,
96+
room.startMs + room.countDown.toLong() * 1000L,
97+
SpellLog.GameType.NORMAL
98+
)
99+
} else {
100+
SpellLog.logSpellOperate(status, room.spells!![idx], token, gameType = SpellLog.GameType.NORMAL)
101+
}
102+
return result
100103
}
101104

102105
private fun Room.scoreDraw(): Boolean {

0 commit comments

Comments
 (0)