diff --git a/lua/server/events/gameflow.lua b/lua/server/events/gameflow.lua index 1ff12dbb..18c7410f 100644 --- a/lua/server/events/gameflow.lua +++ b/lua/server/events/gameflow.lua @@ -187,30 +187,24 @@ GameEvent.prepare_funcs[GameEvent.Turn] = function(self) local logic = room.logic local player = room.current - local ret + if player.dead then return true end - if player.faceup then - ret = logic:trigger(fk.BeforeTurnStart, player) + room:sendLog{ type = "$AppendSeparator" } + + if not player.faceup then + player:turnOver() + return true end - return ret + return logic:trigger(fk.BeforeTurnStart, player) end GameEvent.functions[GameEvent.Turn] = function(self) local room = self.room local logic = room.logic - room:sendLog{ type = "$AppendSeparator" } - - local player = room.current - if not player.faceup then - player:turnOver() - elseif not player.dead then - logic:trigger(fk.TurnStart, room.current) - player:play() - logic:trigger(fk.TurnEnd, room.current) - logic:trigger(fk.AfterTurnEnd, room.current, nil, true) - end + logic:trigger(fk.TurnStart, room.current) + room.current:play() end GameEvent.cleaners[GameEvent.Turn] = function(self) @@ -230,11 +224,11 @@ GameEvent.cleaners[GameEvent.Turn] = function(self) end current.skipped_phases = {} - - logic:trigger(fk.TurnEnd, current, nil, true) - logic:trigger(fk.AfterTurnEnd, room.current, nil, true) end + logic:trigger(fk.TurnEnd, current, nil, self.interrupted) + logic:trigger(fk.AfterTurnEnd, current, nil, self.interrupted) + for _, p in ipairs(room.players) do p:setCardUseHistory("", 0, Player.HistoryTurn) p:setSkillUseHistory("", 0, Player.HistoryTurn) @@ -340,23 +334,19 @@ GameEvent.functions[GameEvent.Phase] = function(self) }) end end - - if player.phase ~= Player.NotActive then - logic:trigger(fk.EventPhaseEnd, player) - else - player.skipped_phases = {} - end end GameEvent.cleaners[GameEvent.Phase] = function(self) local room = self.room local player = self.data[1] + local logic = room.logic - --[[ - if self.interrupted then - room.logic:trigger(fk.EventPhaseEnd, player, nil, true) + if player.phase ~= Player.NotActive then + logic:trigger(fk.EventPhaseEnd, player, nil, self.interrupted) + logic:trigger(fk.AfterPhaseEnd, player, nil, self.interrupted) + else + player.skipped_phases = {} end - --]] for _, p in ipairs(room.players) do p:setCardUseHistory("", 0, Player.HistoryPhase) diff --git a/lua/server/events/pindian.lua b/lua/server/events/pindian.lua index 2c9d4680..fb7419f9 100644 --- a/lua/server/events/pindian.lua +++ b/lua/server/events/pindian.lua @@ -93,6 +93,7 @@ GameEvent.functions[GameEvent.Pindian] = function(self) fromCard = pindianData.fromCard, toCard = result.toCard, winner = result.winner, + reason = pindianData.reason, } room:sendLog{ diff --git a/lua/server/room.lua b/lua/server/room.lua index 6e2c10c2..171ac5d0 100644 --- a/lua/server/room.lua +++ b/lua/server/room.lua @@ -1245,7 +1245,7 @@ function Room:askForChooseCardAndPlayers(player, targets, minNum, maxNum, patter local c = Fk:getCardById(id) return c:matchPattern(pattern) end) - if #pcards == 0 then return {} end + if #pcards == 0 and not cancelable then return {} end local data = { targets = targets,