2023-04-09 05:35:35 +00:00
|
|
|
-- SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-02-28 17:43:44 +00:00
|
|
|
GameEvent.functions[GameEvent.Judge] = function(self)
|
|
|
|
local data = table.unpack(self.data)
|
|
|
|
local self = self.room
|
|
|
|
local who = data.who
|
|
|
|
self.logic:trigger(fk.StartJudge, who, data)
|
2023-03-14 12:48:08 +00:00
|
|
|
data.card = data.card or Fk:getCardById(self:getNCards(1)[1])
|
2023-02-28 17:43:44 +00:00
|
|
|
|
|
|
|
if data.reason ~= "" then
|
|
|
|
self:sendLog{
|
|
|
|
type = "#StartJudgeReason",
|
|
|
|
from = who.id,
|
|
|
|
arg = data.reason,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
self:sendLog{
|
|
|
|
type = "#InitialJudge",
|
|
|
|
from = who.id,
|
|
|
|
card = {data.card.id},
|
|
|
|
}
|
2023-06-04 11:40:14 +00:00
|
|
|
self:moveCardTo(data.card, Card.Processing, nil, fk.ReasonJudge)
|
2023-06-09 18:18:51 +00:00
|
|
|
self:sendFootnote({ data.card.id }, {
|
|
|
|
type = "##JudgeCard",
|
|
|
|
arg = data.reason,
|
|
|
|
})
|
2023-02-28 17:43:44 +00:00
|
|
|
|
|
|
|
self.logic:trigger(fk.AskForRetrial, who, data)
|
|
|
|
self.logic:trigger(fk.FinishRetrial, who, data)
|
|
|
|
Fk:filterCard(data.card.id, who, data)
|
|
|
|
self:sendLog{
|
|
|
|
type = "#JudgeResult",
|
|
|
|
from = who.id,
|
|
|
|
card = {data.card.id},
|
|
|
|
}
|
2023-06-09 18:18:51 +00:00
|
|
|
self:sendFootnote({ data.card.id }, {
|
|
|
|
type = "##JudgeCard",
|
|
|
|
arg = data.reason,
|
|
|
|
})
|
2023-02-28 17:43:44 +00:00
|
|
|
|
|
|
|
if data.pattern then
|
|
|
|
self:delay(400);
|
|
|
|
self:setCardEmotion(data.card.id, data.card:matchPattern(data.pattern) and "judgegood" or "judgebad")
|
|
|
|
self:delay(900);
|
|
|
|
end
|
|
|
|
|
|
|
|
if self.logic:trigger(fk.FinishJudge, who, data) then
|
|
|
|
self.logic:breakEvent()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
GameEvent.cleaners[GameEvent.Judge] = function(self)
|
|
|
|
local data = table.unpack(self.data)
|
|
|
|
local self = self.room
|
2023-05-13 06:20:34 +00:00
|
|
|
if (self.interrupted or not data.skipDrop) and self:getCardArea(data.card.id) == Card.Processing then
|
2023-06-04 11:40:14 +00:00
|
|
|
self:moveCardTo(data.card, Card.DiscardPile, nil, fk.ReasonJudge)
|
2023-02-28 17:43:44 +00:00
|
|
|
end
|
2023-03-07 06:55:28 +00:00
|
|
|
if not self.interrupted then return end
|
2023-02-28 17:43:44 +00:00
|
|
|
|
|
|
|
-- prohibit access to judge.card
|
|
|
|
setmetatable(data, {
|
|
|
|
__index = function(self, key)
|
|
|
|
if key == "card" then
|
|
|
|
error("__manuallyBreak")
|
|
|
|
end
|
|
|
|
return rawget(self, key)
|
|
|
|
end
|
|
|
|
})
|
|
|
|
end
|