FreeKill/lua/server/events/judge.lua
YoumuKon 520523bcc1
bug fix x2 ! (#291)
![devbugfix_ba-style@nulla
top](https://github.com/Qsgs-Fans/FreeKill/assets/38815081/9879a2bd-3edc-4f09-b4e5-06f600823659)
- 修复了铁索传导的伤害仍然觉得自己是伤害起点的bug
- 修复了转化牌前后同名仍然显示转化小白框的bug
- 修复了黑色花色不是黑色的bug
- 重写了改判流程,支持判定虚拟牌

---------

Co-authored-by: notify <notify-ctrl@qq.com>
2023-12-10 18:56:50 +08:00

74 lines
1.8 KiB
Lua

-- SPDX-License-Identifier: GPL-3.0-or-later
GameEvent.functions[GameEvent.Judge] = function(self)
local data = table.unpack(self.data)
local room = self.room
local logic = room.logic
local who = data.who
data.isJudgeEvent = true
logic:trigger(fk.StartJudge, who, data)
data.card = data.card or Fk:getCardById(room:getNCards(1)[1])
if data.reason ~= "" then
room:sendLog{
type = "#StartJudgeReason",
from = who.id,
arg = data.reason,
}
end
Fk:filterCard(data.card.id, who, data)
room:sendLog{
type = "#InitialJudge",
from = who.id,
arg = data.card:toLogString(),
}
room:moveCardTo(data.card, Card.Processing, nil, fk.ReasonJudge)
room:sendFootnote({ data.card.id }, {
type = "##JudgeCard",
arg = data.reason,
})
logic:trigger(fk.AskForRetrial, who, data)
logic:trigger(fk.FinishRetrial, who, data)
room:sendLog{
type = "#JudgeResult",
from = who.id,
arg = data.card:toLogString(),
}
room:sendFootnote({ data.card.id }, {
type = "##JudgeCard",
arg = data.reason,
})
if data.pattern then
room:delay(400);
room:setCardEmotion(data.card.id, data.card:matchPattern(data.pattern) and "judgegood" or "judgebad")
room:delay(900);
end
if logic:trigger(fk.FinishJudge, who, data) then
logic:breakEvent()
end
end
GameEvent.cleaners[GameEvent.Judge] = function(self)
local data = table.unpack(self.data)
local room = self.room
if (self.interrupted or not data.skipDrop) and room:getCardArea(data.card.id) == Card.Processing then
room:moveCardTo(data.card, Card.DiscardPile, nil, fk.ReasonJudge)
end
if not self.interrupted then return end
-- prohibit access to judge.card
setmetatable(data, {
__index = function(s, key)
if key == "card" then
error("__manuallyBreak")
end
return rawget(s, key)
end
})
end