2023-04-09 05:35:35 +00:00
|
|
|
-- SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-09-15 03:17:13 +00:00
|
|
|
local discardSkill = fk.CreateActiveSkill{
|
|
|
|
name = "discard_skill",
|
|
|
|
card_filter = function(self, to_select, selected)
|
|
|
|
if #selected >= self.num then
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
2023-08-03 12:34:43 +00:00
|
|
|
if Fk:currentRoom():getCardArea(to_select) == Card.PlayerSpecial then
|
|
|
|
local pile = ""
|
|
|
|
for p, t in pairs(Self.special_cards) do
|
|
|
|
if table.contains(t, to_select) then
|
|
|
|
pile = p
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if not string.find(self.pattern or "", pile) then return false end
|
2023-08-02 13:50:47 +00:00
|
|
|
end
|
|
|
|
|
2023-03-20 12:15:24 +00:00
|
|
|
local checkpoint = true
|
2023-04-10 07:55:06 +00:00
|
|
|
local card = Fk:getCardById(to_select)
|
|
|
|
|
2023-06-11 08:22:11 +00:00
|
|
|
local status_skills = Fk:currentRoom().status_skills[ProhibitSkill] or Util.DummyTable
|
2023-04-10 07:55:06 +00:00
|
|
|
for _, skill in ipairs(status_skills) do
|
|
|
|
if skill:prohibitDiscard(Self, card) then
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
2023-06-04 11:39:20 +00:00
|
|
|
if Fk.currentResponseReason == "game_rule" then
|
2023-06-11 08:22:11 +00:00
|
|
|
status_skills = Fk:currentRoom().status_skills[MaxCardsSkill] or Util.DummyTable
|
2023-06-04 11:39:20 +00:00
|
|
|
for _, skill in ipairs(status_skills) do
|
|
|
|
if skill:excludeFrom(Self, card) then
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2023-04-10 07:55:06 +00:00
|
|
|
|
2023-01-29 10:11:41 +00:00
|
|
|
if not self.include_equip then
|
2023-03-20 12:15:24 +00:00
|
|
|
checkpoint = checkpoint and (Fk:currentRoom():getCardArea(to_select) ~= Player.Equip)
|
2023-01-29 10:11:41 +00:00
|
|
|
end
|
|
|
|
|
2023-04-12 14:28:19 +00:00
|
|
|
if self.pattern and self.pattern ~= "" then
|
2023-04-10 07:55:06 +00:00
|
|
|
checkpoint = checkpoint and (Exppattern:Parse(self.pattern):match(card))
|
2023-03-20 12:15:24 +00:00
|
|
|
end
|
|
|
|
return checkpoint
|
2022-09-15 03:17:13 +00:00
|
|
|
end,
|
2023-02-26 07:01:14 +00:00
|
|
|
min_card_num = function(self) return self.min_num end,
|
|
|
|
max_card_num = function(self) return self.num end,
|
2022-09-15 03:17:13 +00:00
|
|
|
}
|
|
|
|
|
2023-03-14 12:48:08 +00:00
|
|
|
local chooseCardsSkill = fk.CreateActiveSkill{
|
|
|
|
name = "choose_cards_skill",
|
2023-04-04 08:25:37 +00:00
|
|
|
expand_pile = function(self) return self.expand_pile end,
|
2023-04-12 14:28:19 +00:00
|
|
|
card_filter = function(self, to_select, selected)
|
|
|
|
if #selected >= self.num then
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
2023-08-03 12:34:43 +00:00
|
|
|
if Fk:currentRoom():getCardArea(to_select) == Card.PlayerSpecial then
|
|
|
|
if not string.find(self.pattern or "", self.expand_pile or "") then return false end
|
2023-08-02 13:50:47 +00:00
|
|
|
end
|
|
|
|
|
2023-04-12 14:28:19 +00:00
|
|
|
local checkpoint = true
|
|
|
|
local card = Fk:getCardById(to_select)
|
|
|
|
|
|
|
|
if not self.include_equip then
|
|
|
|
checkpoint = checkpoint and (Fk:currentRoom():getCardArea(to_select) ~= Player.Equip)
|
|
|
|
end
|
|
|
|
|
|
|
|
if self.pattern and self.pattern ~= "" then
|
|
|
|
checkpoint = checkpoint and (Exppattern:Parse(self.pattern):match(card))
|
|
|
|
end
|
|
|
|
return checkpoint
|
|
|
|
end,
|
2023-03-14 12:48:08 +00:00
|
|
|
min_card_num = function(self) return self.min_num end,
|
|
|
|
max_card_num = function(self) return self.num end,
|
|
|
|
}
|
|
|
|
|
2022-09-15 03:17:13 +00:00
|
|
|
local choosePlayersSkill = fk.CreateActiveSkill{
|
|
|
|
name = "choose_players_skill",
|
2023-02-26 07:01:14 +00:00
|
|
|
card_filter = function(self, to_select)
|
|
|
|
return self.pattern ~= "" and Exppattern:Parse(self.pattern):match(Fk:getCardById(to_select))
|
2022-09-15 03:17:13 +00:00
|
|
|
end,
|
2023-02-26 07:01:14 +00:00
|
|
|
target_filter = function(self, to_select, selected, cards)
|
|
|
|
if self.pattern ~= "" and #cards == 0 then return end
|
2022-09-15 03:17:13 +00:00
|
|
|
if #selected < self.num then
|
2023-01-29 10:11:41 +00:00
|
|
|
return table.contains(self.targets, to_select)
|
2022-09-15 03:17:13 +00:00
|
|
|
end
|
|
|
|
end,
|
2023-02-26 07:01:14 +00:00
|
|
|
card_num = function(self) return self.pattern ~= "" and 1 or 0 end,
|
|
|
|
min_target_num = function(self) return self.min_num end,
|
|
|
|
max_target_num = function(self) return self.num end,
|
2022-09-15 03:17:13 +00:00
|
|
|
}
|
|
|
|
|
2023-05-13 06:16:09 +00:00
|
|
|
local maxCardsSkill = fk.CreateMaxCardsSkill{
|
|
|
|
name = "max_cards_skill",
|
|
|
|
global = true,
|
|
|
|
correct_func = function(self, player)
|
2023-05-28 10:45:54 +00:00
|
|
|
return
|
|
|
|
player:getMark(MarkEnum.AddMaxCards) +
|
|
|
|
player:getMark(MarkEnum.AddMaxCardsInTurn) -
|
|
|
|
player:getMark(MarkEnum.MinusMaxCards) -
|
|
|
|
player:getMark(MarkEnum.MinusMaxCardsInTurn)
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
|
|
|
|
local choosePlayersToMoveCardInBoardSkill = fk.CreateActiveSkill{
|
|
|
|
name = "choose_players_to_move_card_in_board",
|
|
|
|
target_num = 2,
|
|
|
|
card_filter = function(self, to_select)
|
|
|
|
return false
|
|
|
|
end,
|
|
|
|
target_filter = function(self, to_select, selected, cards)
|
|
|
|
local target = Fk:currentRoom():getPlayerById(to_select)
|
|
|
|
if #selected > 0 then
|
2023-07-16 11:18:43 +00:00
|
|
|
return Fk:currentRoom():getPlayerById(selected[1]):canMoveCardsInBoardTo(target, self.flag, self.excludeIds)
|
2023-05-28 10:45:54 +00:00
|
|
|
end
|
|
|
|
|
2023-07-16 11:18:43 +00:00
|
|
|
local fromAreas = { Player.Equip, Player.Judge }
|
|
|
|
if self.flag == "e" then
|
|
|
|
fromAreas = { Player.Equip }
|
|
|
|
elseif self.flag == "j" then
|
|
|
|
fromAreas = { Player.Judge }
|
|
|
|
end
|
|
|
|
|
|
|
|
return #table.filter(target:getCardIds(fromAreas), function(id)
|
|
|
|
return not table.contains((type(self.excludeIds) == "table" and self.excludeIds or {}), id)
|
|
|
|
end) > 0
|
2023-05-13 06:16:09 +00:00
|
|
|
end,
|
|
|
|
}
|
|
|
|
|
2023-06-11 04:45:12 +00:00
|
|
|
local uncompulsoryInvalidity = fk.CreateInvaliditySkill {
|
|
|
|
name = "uncompulsory_invalidity",
|
|
|
|
global = true,
|
|
|
|
invalidity_func = function(self, from, skill)
|
|
|
|
return
|
|
|
|
(skill.frequency ~= Skill.Compulsory and skill.frequency ~= Skill.Wake) and
|
|
|
|
not (skill:isEquipmentSkill() or skill.name:endsWith("&")) and
|
|
|
|
(
|
|
|
|
from:getMark(MarkEnum.UncompulsoryInvalidity) ~= 0 or
|
2023-06-14 05:40:50 +00:00
|
|
|
table.find(MarkEnum.TempMarkSuffix, function(s)
|
2023-06-11 04:45:12 +00:00
|
|
|
return from:getMark(MarkEnum.UncompulsoryInvalidity .. s) ~= 0
|
|
|
|
end)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
2022-09-15 03:17:13 +00:00
|
|
|
AuxSkills = {
|
|
|
|
discardSkill,
|
2023-03-14 12:48:08 +00:00
|
|
|
chooseCardsSkill,
|
2022-09-15 03:17:13 +00:00
|
|
|
choosePlayersSkill,
|
2023-05-13 06:16:09 +00:00
|
|
|
maxCardsSkill,
|
2023-05-28 10:45:54 +00:00
|
|
|
choosePlayersToMoveCardInBoardSkill,
|
2023-06-11 04:45:12 +00:00
|
|
|
uncompulsoryInvalidity,
|
2022-09-15 03:17:13 +00:00
|
|
|
}
|