fix bugs (#246)
1、回合事件优化 2、修正askForChooseCardAndPlayers在无牌可选的情况下会自动跳过的问题 3、补充拼点reason
This commit is contained in:
parent
00578c2ad3
commit
f0fcc6183b
|
@ -187,30 +187,24 @@ GameEvent.prepare_funcs[GameEvent.Turn] = function(self)
|
||||||
local logic = room.logic
|
local logic = room.logic
|
||||||
local player = room.current
|
local player = room.current
|
||||||
|
|
||||||
local ret
|
if player.dead then return true end
|
||||||
|
|
||||||
if player.faceup then
|
room:sendLog{ type = "$AppendSeparator" }
|
||||||
ret = logic:trigger(fk.BeforeTurnStart, player)
|
|
||||||
|
if not player.faceup then
|
||||||
|
player:turnOver()
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
return ret
|
return logic:trigger(fk.BeforeTurnStart, player)
|
||||||
end
|
end
|
||||||
|
|
||||||
GameEvent.functions[GameEvent.Turn] = function(self)
|
GameEvent.functions[GameEvent.Turn] = function(self)
|
||||||
local room = self.room
|
local room = self.room
|
||||||
local logic = room.logic
|
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)
|
logic:trigger(fk.TurnStart, room.current)
|
||||||
player:play()
|
room.current:play()
|
||||||
logic:trigger(fk.TurnEnd, room.current)
|
|
||||||
logic:trigger(fk.AfterTurnEnd, room.current, nil, true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
GameEvent.cleaners[GameEvent.Turn] = function(self)
|
GameEvent.cleaners[GameEvent.Turn] = function(self)
|
||||||
|
@ -230,11 +224,11 @@ GameEvent.cleaners[GameEvent.Turn] = function(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
current.skipped_phases = {}
|
current.skipped_phases = {}
|
||||||
|
|
||||||
logic:trigger(fk.TurnEnd, current, nil, true)
|
|
||||||
logic:trigger(fk.AfterTurnEnd, room.current, nil, true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
logic:trigger(fk.TurnEnd, current, nil, self.interrupted)
|
||||||
|
logic:trigger(fk.AfterTurnEnd, current, nil, self.interrupted)
|
||||||
|
|
||||||
for _, p in ipairs(room.players) do
|
for _, p in ipairs(room.players) do
|
||||||
p:setCardUseHistory("", 0, Player.HistoryTurn)
|
p:setCardUseHistory("", 0, Player.HistoryTurn)
|
||||||
p:setSkillUseHistory("", 0, Player.HistoryTurn)
|
p:setSkillUseHistory("", 0, Player.HistoryTurn)
|
||||||
|
@ -340,23 +334,19 @@ GameEvent.functions[GameEvent.Phase] = function(self)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if player.phase ~= Player.NotActive then
|
|
||||||
logic:trigger(fk.EventPhaseEnd, player)
|
|
||||||
else
|
|
||||||
player.skipped_phases = {}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
GameEvent.cleaners[GameEvent.Phase] = function(self)
|
GameEvent.cleaners[GameEvent.Phase] = function(self)
|
||||||
local room = self.room
|
local room = self.room
|
||||||
local player = self.data[1]
|
local player = self.data[1]
|
||||||
|
local logic = room.logic
|
||||||
|
|
||||||
--[[
|
if player.phase ~= Player.NotActive then
|
||||||
if self.interrupted then
|
logic:trigger(fk.EventPhaseEnd, player, nil, self.interrupted)
|
||||||
room.logic:trigger(fk.EventPhaseEnd, player, nil, true)
|
logic:trigger(fk.AfterPhaseEnd, player, nil, self.interrupted)
|
||||||
|
else
|
||||||
|
player.skipped_phases = {}
|
||||||
end
|
end
|
||||||
--]]
|
|
||||||
|
|
||||||
for _, p in ipairs(room.players) do
|
for _, p in ipairs(room.players) do
|
||||||
p:setCardUseHistory("", 0, Player.HistoryPhase)
|
p:setCardUseHistory("", 0, Player.HistoryPhase)
|
||||||
|
|
|
@ -93,6 +93,7 @@ GameEvent.functions[GameEvent.Pindian] = function(self)
|
||||||
fromCard = pindianData.fromCard,
|
fromCard = pindianData.fromCard,
|
||||||
toCard = result.toCard,
|
toCard = result.toCard,
|
||||||
winner = result.winner,
|
winner = result.winner,
|
||||||
|
reason = pindianData.reason,
|
||||||
}
|
}
|
||||||
|
|
||||||
room:sendLog{
|
room:sendLog{
|
||||||
|
|
|
@ -1245,7 +1245,7 @@ function Room:askForChooseCardAndPlayers(player, targets, minNum, maxNum, patter
|
||||||
local c = Fk:getCardById(id)
|
local c = Fk:getCardById(id)
|
||||||
return c:matchPattern(pattern)
|
return c:matchPattern(pattern)
|
||||||
end)
|
end)
|
||||||
if #pcards == 0 then return {} end
|
if #pcards == 0 and not cancelable then return {} end
|
||||||
|
|
||||||
local data = {
|
local data = {
|
||||||
targets = targets,
|
targets = targets,
|
||||||
|
|
Loading…
Reference in New Issue