fix GameEvent:searchEvents
This commit is contained in:
xxyheaven 2023-06-10 20:54:48 +08:00 committed by GitHub
parent 19052f501c
commit d3aed7242a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -121,7 +121,7 @@ end
---@return GameEvent[] @ 找到的符合条件的所有事件最多n个但不保证有n个
function GameEvent:searchEvents(eventType, n, func, endEvent)
local logic = self.room.logic
local events = logic.event_recorder[eventType]
local events = logic.event_recorder[eventType] or Util.DummyTable
local from = self.id
local to = endEvent and endEvent.id or self.end_id
if to == -1 then to = #logic.all_game_events end

View File

@ -473,11 +473,11 @@ function GameLogic:getEventsOfScope(eventType, n, func, scope)
if scope == Player.HistoryGame then
start_event = self.all_game_events[1]
elseif scope == Player.HistoryRound then
start_event = event:findParent(GameEvent.Round)
start_event = event:findParent(GameEvent.Round, true)
elseif scope == Player.HistoryTurn then
start_event = event:findParent(GameEvent.Turn)
start_event = event:findParent(GameEvent.Turn, true)
elseif scope == Player.HistoryPhase then
start_event = event:findParent(GameEvent.Phase)
start_event = event:findParent(GameEvent.Phase, true)
end
return start_event:searchEvents(eventType, n, func)