1、回合事件优化 
2、修正askForChooseCardAndPlayers在无牌可选的情况下会自动跳过的问题
3、补充拼点reason
This commit is contained in:
xxyheaven 2023-08-12 19:19:03 +08:00 committed by GitHub
parent 00578c2ad3
commit f0fcc6183b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 29 deletions

View File

@ -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)

View File

@ -93,6 +93,7 @@ GameEvent.functions[GameEvent.Pindian] = function(self)
fromCard = pindianData.fromCard,
toCard = result.toCard,
winner = result.winner,
reason = pindianData.reason,
}
room:sendLog{

View File

@ -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,