2022-04-01 12:51:01 +00:00
|
|
|
GameRule = fk.CreateTriggerSkill{
|
|
|
|
name = "game_rule",
|
|
|
|
events = {
|
|
|
|
fk.GameStart, fk.TurnStart,
|
|
|
|
fk.EventPhaseProceeding, fk.EventPhaseEnd, fk.EventPhaseChanging,
|
|
|
|
},
|
|
|
|
priority = 0,
|
|
|
|
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
|
|
|
return (target == player) or (target == nil)
|
|
|
|
end,
|
|
|
|
|
2022-04-02 07:11:13 +00:00
|
|
|
on_trigger = function(self, event, target, player, data)
|
2022-04-02 13:39:44 +00:00
|
|
|
if RoomInstance.tag["SkipGameRule"] then
|
|
|
|
RoomInstance.tag["SkipGameRule"] = false
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
if target == nil then
|
|
|
|
if event == fk.GameStart then
|
|
|
|
print("Game started")
|
|
|
|
RoomInstance.tag["FirstRound"] = true
|
|
|
|
end
|
|
|
|
return false
|
2022-04-02 07:11:13 +00:00
|
|
|
end
|
2022-04-02 13:39:44 +00:00
|
|
|
|
|
|
|
local room = player.room
|
|
|
|
switch(event, {
|
|
|
|
[fk.TurnStart] = function()
|
|
|
|
player = room.current
|
|
|
|
if room.tag["FirstRound"] == true then
|
|
|
|
room.tag["FirstRound"] = false
|
|
|
|
player:setFlag("Global_FirstRound")
|
|
|
|
end
|
|
|
|
|
|
|
|
-- TODO: send log
|
|
|
|
|
|
|
|
player:addMark("Global_TurnCount")
|
|
|
|
player:setMark("damage_point_round", 0)
|
|
|
|
if not player.faceup then
|
|
|
|
player:setFlag("-Global_FirstRound")
|
|
|
|
player:turnOver()
|
|
|
|
elseif not player.dead then
|
|
|
|
--player:play()
|
|
|
|
room:askForSkillInvoke(player, "rule")
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
2022-04-02 07:11:13 +00:00
|
|
|
return false
|
|
|
|
end,
|
|
|
|
|
2022-04-01 12:51:01 +00:00
|
|
|
}
|