FreeKill/packages/standard/init.lua

928 lines
28 KiB
Lua
Raw Normal View History

local extension = Package:new("standard")
extension.metadata = require "packages.standard.metadata"
dofile "packages/standard/game_rule.lua"
dofile "packages/standard/aux_skills.lua"
local jianxiong = fk.CreateTriggerSkill{
name = "jianxiong",
anim_type = "masochism",
events = {fk.Damaged},
can_trigger = function(self, event, target, player, data)
local room = target.room
return data.card ~= nil and
target == player and
target:hasSkill(self.name) and
room:getCardArea(data.card) == Card.Processing and
not target.dead
end,
on_use = function(self, event, target, player, data)
local room = player.room
room:obtainCard(player.id, data.card, false)
end,
}
local caocao = General:new(extension, "caocao", "wei", 4)
caocao:addSkill(jianxiong)
local guicai = fk.CreateTriggerSkill{
name = "guicai",
anim_type = "control",
events = {fk.AskForRetrial},
can_trigger = function(self, event, target, player, data)
return player:hasSkill(self.name) and not player:isKongcheng()
end,
on_cost = function(self, event, target, player, data)
local room = player.room
local prompt = "#guicai-ask::" .. target.id
local card = room:askForResponse(player, self.name, ".|.|.|hand", prompt, true)
if card ~= nil then
self.cost_data = card
return true
end
end,
on_use = function(self, event, target, player, data)
local room = player.room
room:retrial(self.cost_data, player, data, self.name)
end,
}
2023-01-07 15:20:44 +08:00
local fankui = fk.CreateTriggerSkill{
name = "fankui",
anim_type = "masochism",
2023-01-07 15:20:44 +08:00
events = {fk.Damaged},
frequency = Skill.NotFrequent,
can_trigger = function(self, event, target, player, data)
2023-01-07 15:34:52 +08:00
local room = target.room
local from = data.from
2023-01-07 15:34:52 +08:00
return from ~= nil and
target == player and
target:hasSkill(self.name) and
(not from:isNude()) and
not target.dead
2023-01-07 15:20:44 +08:00
end,
on_use = function(self, event, target, player, data)
2023-01-07 15:20:44 +08:00
local room = player.room
local from = data.from
local card = room:askForCardChosen(player, from, "he", self.name)
room:obtainCard(player.id, card, false)
2023-01-07 15:20:44 +08:00
end
}
local simayi = General:new(extension, "simayi", "wei", 3)
simayi:addSkill(guicai)
2023-01-07 15:20:44 +08:00
simayi:addSkill(fankui)
local ganglie = fk.CreateTriggerSkill{
name = "ganglie",
anim_type = "masochism",
events = {fk.Damaged},
can_trigger = function(self, event, target, player, data)
local room = target.room
return data.from ~= nil and
target == player and
target:hasSkill(self.name) and
not target.dead
end,
on_use = function(self, event, target, player, data)
local room = player.room
local from = data.from
local judge = {
who = player,
reason = self.name,
pattern = ".|.|spade,club,diamond",
}
room:judge(judge)
if judge.card.suit ~= Card.Heart then
local discards = room:askForDiscard(from, 2, 2, false, self.name, true)
if #discards == 0 then
room:damage{
from = player,
to = from,
damage = 1,
skillName = self.name,
}
end
end
end,
}
local xiahoudun = General:new(extension, "xiahoudun", "wei", 4)
xiahoudun:addSkill(ganglie)
local tuxi = fk.CreateTriggerSkill{
name = "tuxi",
anim_type = "control",
events = {fk.EventPhaseStart},
can_trigger = function(self, event, target, player, data)
local ret = (target == player and player:hasSkill(self.name) and player.phase == Player.Draw)
if ret then
local room = player.room
for _, p in ipairs(room:getOtherPlayers(player)) do
if not p:isKongcheng() then
return true
end
end
end
end,
on_cost = function(self, event, target, player, data)
local room = player.room
local other = room:getOtherPlayers(player)
local targets = {}
for _, p in ipairs(other) do
if not p:isKongcheng() then
table.insert(targets, p.id)
end
end
local result = room:askForChoosePlayers(player, targets, 1, 2, "#tuxi-ask", self.name)
if #result > 0 then
self.cost_data = result
return true
end
end,
on_use = function(self, event, target, player, data)
local room = player.room
for _, id in ipairs(self.cost_data) do
local p = room:getPlayerById(id)
local c = room:askForCardChosen(player, p, "h", self.name)
room:obtainCard(player.id, c, false)
end
return true
end,
}
local zhangliao = General:new(extension, "zhangliao", "wei", 4)
zhangliao:addSkill(tuxi)
local luoyi = fk.CreateTriggerSkill{
name = "luoyi",
anim_type = "offensive",
events = {fk.DrawNCards},
can_trigger = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name) and data.n > 0
end,
on_use = function(self, event, target, player, data)
data.n = data.n - 1
end,
refresh_events = {fk.DamageCaused},
can_refresh = function(self, event, target, player, data)
if not (target == player and player:hasSkill(self.name) and
player:usedSkillTimes(self.name) > 0) then
return
end
local c = data.card
return c and c.name == "slash" or c.name == "duel"
end,
on_refresh = function(self, event, target, player, data)
local room = player.room
room:broadcastSkillInvoke(self.name)
room:notifySkillInvoked(player, self.name)
data.damage = data.damage + 1
end,
}
local xuchu = General:new(extension, "xuchu", "wei", 4)
xuchu:addSkill(luoyi)
local tiandu = fk.CreateTriggerSkill{
name = "tiandu",
events = {fk.FinishJudge},
on_use = function(self, event, target, player, data)
local room = player.room
room:obtainCard(player.id, data.card)
end,
}
local yiji = fk.CreateTriggerSkill{
name = "yiji",
anim_type = "masochism",
events = {fk.Damaged},
on_trigger = function(self, event, target, player, data)
self.cancel_cost = false
for i = 1, data.damage do
if self.cancel_cost then break end
self:doCost(event, target, player, data)
end
end,
on_cost = function(self, event, target, player, data)
local room = player.room
if room:askForSkillInvoke(player, self.name, data) then
return true
end
self.cancel_cost = true
end,
on_use = function(self, event, target, player, data)
-- TODO: yiji logic
player:drawCards(2)
end,
}
local guojia = General:new(extension, "guojia", "wei", 3)
guojia:addSkill(tiandu)
guojia:addSkill(yiji)
local luoshen = fk.CreateTriggerSkill{
name = "luoshen",
anim_type = "drawcard",
events = {fk.EventPhaseStart},
can_trigger = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name) and
player.phase == Player.Start
end,
on_use = function(self, event, target, player, data)
local room = player.room
while true do
local judge = {
who = player,
reason = self.name,
pattern = ".|A~K|spade,club",
}
room:judge(judge)
if judge.card.color ~= Card.Black then
break
end
if not room:askForSkillInvoke(player, self.name) then
break
end
end
end,
refresh_events = {fk.FinishJudge},
can_refresh = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name) and
data.reason == self.name and data.card.color == Card.Black
end,
on_refresh = function(self, event, target, player, data)
local room = player.room
room:obtainCard(player.id, data.card)
end,
}
local qingguo = fk.CreateViewAsSkill{
name = "qingguo",
anim_type = "defensive",
pattern = "jink",
card_filter = function(self, to_select, selected)
if #selected == 1 then return false end
return Fk:getCardById(to_select).color == Card.Black
and Fk:currentRoom():getCardArea(to_select) ~= Player.Equip
end,
view_as = function(self, cards)
if #cards ~= 1 then
return nil
end
local c = Fk:cloneCard("jink")
c:addSubcard(cards[1])
return c
end,
}
2023-01-09 19:15:18 +08:00
local zhenji = General:new(extension, "zhenji", "wei", 3, 3, General.Female)
zhenji:addSkill(luoshen)
zhenji:addSkill(qingguo)
local rendetrig = fk.CreateTriggerSkill{
name = "#rendetrig",
mute = true,
refresh_events = {fk.EventPhaseStart},
can_refresh = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name) and player.phase == Player.NotActive
end,
on_refresh = function(self, event, target, player, data)
local room = player.room
room:setPlayerMark(player, "_rende_cards", 0)
end,
}
local rende = fk.CreateActiveSkill{
name = "rende",
anim_type = "support",
card_filter = function(self, to_select, selected)
return Fk:currentRoom():getCardArea(to_select) ~= Card.PlayerEquip
end,
target_filter = function(self, to_select, selected)
return #selected == 0 and to_select ~= Self.id
end,
target_num = 1,
min_card_num = 1,
on_use = function(self, room, effect)
local target = room:getPlayerById(effect.tos[1])
local player = room:getPlayerById(effect.from)
local cards = effect.cards
local marks = player:getMark("_rende_cards")
local dummy = Fk:cloneCard'slash'
dummy:addSubcards(cards)
room:obtainCard(target.id, dummy, false, fk.ReasonGive)
room:addPlayerMark(player, "_rende_cards", #cards)
if marks < 2 and marks + #cards >= 2 and player:isWounded() then
room:recover{
who = player,
num = 1,
skillName = self.name
}
end
end,
}
rende:addRelatedSkill(rendetrig)
local liubei = General:new(extension, "liubei", "shu", 4)
liubei:addSkill(rende)
local wusheng = fk.CreateViewAsSkill{
name = "wusheng",
anim_type = "offensive",
pattern = "slash",
card_filter = function(self, to_select, selected)
if #selected == 1 then return false end
return Fk:getCardById(to_select).color == Card.Red
end,
view_as = function(self, cards)
if #cards ~= 1 then
return nil
end
local c = Fk:cloneCard("slash")
c:addSubcard(cards[1])
return c
end,
}
local guanyu = General:new(extension, "guanyu", "shu", 4)
guanyu:addSkill(wusheng)
local paoxiaoAudio = fk.CreateTriggerSkill{
name = "#paoxiaoAudio",
refresh_events = {fk.CardUsing},
can_refresh = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name) and
data.card.name == "slash" and
player:usedCardTimes("slash") > 1
end,
on_refresh = function(self, event, target, player, data)
player.room:broadcastSkillInvoke("paoxiao")
player.room:doAnimate("InvokeSkill", {
name = "paoxiao",
player = player.id,
skill_type = "offensive",
})
end,
}
local paoxiao = fk.CreateTargetModSkill{
name = "paoxiao",
residue_func = function(self, player, skill, scope)
if player:hasSkill(self.name) and skill.name == "slash_skill"
and scope == Player.HistoryPhase then
return 999
end
end,
}
paoxiao:addRelatedSkill(paoxiaoAudio)
local zhangfei = General:new(extension, "zhangfei", "shu", 4)
zhangfei:addSkill(paoxiao)
local guanxing = fk.CreateTriggerSkill{
name = "guanxing",
anim_type = "control",
events = {fk.EventPhaseStart},
can_trigger = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name) and
player.phase == Player.Start
end,
on_use = function(self, event, target, player, data)
local room = player.room
room:askForGuanxing(player, room:getNCards(math.min(5, #room.alive_players)))
end,
}
local kongchengAudio = fk.CreateTriggerSkill{
name = "#kongchengAudio",
refresh_events = {fk.AfterCardsMove},
can_refresh = function(self, event, target, player, data)
if not player:hasSkill(self.name) then return end
if not player:isKongcheng() then return end
for _, move in ipairs(data) do
if move.from == player.id then
for _, info in ipairs(move.moveInfo) do
if info.fromArea == Card.PlayerHand then
return true
end
end
end
end
end,
on_refresh = function(self, event, target, player, data)
player.room:broadcastSkillInvoke("kongcheng")
player.room:doAnimate("InvokeSkill", {
name = "kongcheng",
player = player.id,
skill_type = "defensive",
})
end,
}
local kongcheng = fk.CreateProhibitSkill{
name = "kongcheng",
is_prohibited = function(self, from, to, card)
if to:hasSkill(self.name) and to:isKongcheng() then
return card.name == "slash" or card.name == "duel"
end
end,
}
kongcheng:addRelatedSkill(kongchengAudio)
local zhugeliang = General:new(extension, "zhugeliang", "shu", 3)
zhugeliang:addSkill(guanxing)
zhugeliang:addSkill(kongcheng)
local longdan = fk.CreateViewAsSkill{
name = "longdan",
pattern = "slash,jink",
card_filter = function(self, to_select, selected)
if #selected == 1 then return false end
local c = Fk:getCardById(to_select)
return c.name == "slash" or c.name == "jink"
end,
view_as = function(self, cards)
if #cards ~= 1 then
return nil
end
local _c = Fk:getCardById(cards[1])
local c
if _c.name == "slash" then
c = Fk:cloneCard("jink")
elseif _c.name == "jink" then
c = Fk:cloneCard("slash")
end
c:addSubcard(cards[1])
return c
end,
}
local zhaoyun = General:new(extension, "zhaoyun", "shu", 4)
zhaoyun:addSkill(longdan)
local mashu = fk.CreateDistanceSkill{
name = "mashu",
correct_func = function(self, from, to)
if from:hasSkill(self.name) then
return -1
end
end,
}
local tieqi = fk.CreateTriggerSkill{
name = "tieqi",
anim_type = "offensive",
events = {fk.TargetSpecified},
can_trigger = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name) and
data.card.name == "slash"
end,
on_use = function(self, event, target, player, data)
local room = player.room
local judge = {
who = player,
reason = self.name,
pattern = ".|.|heart,diamond",
}
room:judge(judge)
if judge.card.color == Card.Red then
data.disresponsive = true
end
end,
}
local machao = General:new(extension, "machao", "shu", 4)
machao:addSkill(mashu)
machao:addSkill(tieqi)
local jizhi = fk.CreateTriggerSkill{
name = "jizhi",
anim_type = "drawcard",
events = {fk.CardUsing},
can_trigger = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name) and
data.card.type == Card.TypeTrick and
data.card.sub_type ~= Card.SubtypeDelayedTrick
end,
on_use = function(self, event, target, player, data)
player:drawCards(1, self.name)
end,
}
local qicai = fk.CreateTargetModSkill{
name = "qicai",
distance_limit_func = function(self, player, skill)
local card_name = string.sub(skill.name, 1, -7) -- assuming all card skill is named with name_skill
local card = Fk:cloneCard(card_name)
if player:hasSkill(self.name) and card.type == Card.TypeTrick then
return 999
end
end,
}
2023-01-09 19:15:18 +08:00
local huangyueying = General:new(extension, "huangyueying", "shu", 3, 3, General.Female)
huangyueying:addSkill(jizhi)
huangyueying:addSkill(qicai)
local zhiheng = fk.CreateActiveSkill{
name = "zhiheng",
anim_type = "drawcard",
can_use = function(self, player)
return player:usedSkillTimes(self.name) == 0
end,
target_num = 0,
min_card_num = 1,
on_use = function(self, room, effect)
local from = room:getPlayerById(effect.from)
room:throwCard(effect.cards, self.name, from)
room:drawCards(from, #effect.cards, self.name)
end
}
local sunquan = General:new(extension, "sunquan", "wu", 4)
sunquan:addSkill(zhiheng)
local qixi = fk.CreateViewAsSkill{
name = "qixi",
anim_type = "control",
pattern = "dismantlement",
card_filter = function(self, to_select, selected)
if #selected == 1 then return false end
return Fk:getCardById(to_select).color == Card.Black
end,
view_as = function(self, cards)
if #cards ~= 1 then
return nil
end
local c = Fk:cloneCard("dismantlement")
c:addSubcard(cards[1])
return c
end,
}
local ganning = General:new(extension, "ganning", "wu", 4)
ganning:addSkill(qixi)
local keji = fk.CreateTriggerSkill{
name = "keji",
anim_type = "defensive",
events = {fk.EventPhaseChanging},
can_trigger = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name) and
data.to == Player.Discard and
player:usedCardTimes("slash") < 1 and
player:getMark("_keji_played_slash") == 0
end,
on_use = function(self, event, target, player, data)
return true
end,
refresh_events = {fk.CardResponding, fk.EventPhaseStart},
can_refresh = function(self, event, target, player, data)
if not (target == player and player:hasSkill(self.name)) then
return false
2023-02-26 16:51:29 +08:00
end
if event == fk.CardResponding then
return data.card.name == "slash"
elseif event == fk.EventPhaseStart then
return player.phase == player.NotActive
end
end,
on_refresh = function(self, event, target, player, data)
local room = player.room
if event == fk.CardResponding then
room:addPlayerMark(player, "_keji_played_slash", 1)
elseif event == fk.EventPhaseStart then
room:setPlayerMark(player, "_keji_played_slash", 0)
end
end
}
local lvmeng = General:new(extension, "lvmeng", "wu", 4)
lvmeng:addSkill(keji)
2023-01-08 14:57:42 +08:00
local kurou = fk.CreateActiveSkill{
name = "kurou",
anim_type = "drawcard",
2023-01-09 19:15:18 +08:00
card_filter = function(self, to_select, selected, selected_targets)
2023-01-08 14:57:42 +08:00
return false
end,
on_use = function(self, room, effect)
2023-01-08 14:57:42 +08:00
local from = room:getPlayerById(effect.from)
room:loseHp(from, 1, self.name)
2023-01-08 15:05:52 +08:00
if from:isAlive() then
room:drawCards(from, 2, self.name)
end
2023-01-08 14:57:42 +08:00
end
}
local huanggai = General:new(extension, "huanggai", "wu", 4)
2023-01-08 14:57:42 +08:00
huanggai:addSkill(kurou)
local yingzi = fk.CreateTriggerSkill{
name = "yingzi",
anim_type = "drawcard",
events = {fk.DrawNCards},
on_use = function(self, event, target, player, data)
data.n = data.n + 1
end,
}
local fanjian = fk.CreateActiveSkill{
name = "fanjian",
can_use = function(self, player)
return player:usedSkillTimes(self.name) < 1 and not player:isKongcheng()
end,
card_filter = function() return false end,
target_filter = function(self, to_select, selected)
return #selected == 0 and to_select ~= Self.id
end,
target_num = 1,
on_use = function(self, room, effect)
local player = room:getPlayerById(effect.from)
local target = room:getPlayerById(effect.tos[1])
local choice = room:askForChoice(target, {"spade", "heart", "club", "diamond"}, self.name)
local card = room:askForCardChosen(target, player, 'h', self.name)
room:obtainCard(target.id, card, true)
if Fk:getCardById(card):getSuitString() ~= choice then
room:damage{
from = player,
to = target,
damage = 1,
skillName = self.name,
}
end
end,
}
local zhouyu = General:new(extension, "zhouyu", "wu", 3)
zhouyu:addSkill(yingzi)
zhouyu:addSkill(fanjian)
local guose = fk.CreateViewAsSkill{
name = "guose",
anim_type = "control",
pattern = "indulgence",
card_filter = function(self, to_select, selected)
if #selected == 1 then return false end
return Fk:getCardById(to_select).suit == Card.Diamond
end,
view_as = function(self, cards)
if #cards ~= 1 then
return nil
end
local c = Fk:cloneCard("indulgence")
c:addSubcard(cards[1])
return c
end,
}
local liuli = fk.CreateTriggerSkill{
name = "liuli",
anim_type = "defensive",
events = {fk.TargetConfirming},
can_trigger = function(self, event, target, player, data)
local ret = target == player and player:hasSkill(self.name) and
data.card.name == "slash"
if ret then
self.target_list = {}
local room = player.room
for _, p in ipairs(room:getOtherPlayers(player)) do
if p.id ~= data.from and player:inMyAttackRange(p) then
table.insert(self.target_list, p.id)
end
end
return #self.target_list > 0
end
end,
on_cost = function(self, event, target, player, data)
local room = player.room
local prompt = "#liuli-target"
local plist, cid = room:askForChooseCardAndPlayers(player, self.target_list, 1, 1, nil, prompt, self.name)
if #plist > 0 then
self.cost_data = {plist[1], cid}
return true
end
end,
on_use = function(self, event, target, player, data)
local room = player.room
local to = self.cost_data[1]
room:doIndicate(player.id, { to })
room:throwCard(self.cost_data[2], self.name, player, player)
TargetGroup:removeTarget(data.targetGroup, player.id)
TargetGroup:pushTargets(data.targetGroup, to)
end,
}
2023-01-09 19:15:18 +08:00
local daqiao = General:new(extension, "daqiao", "wu", 3, 3, General.Female)
daqiao:addSkill(guose)
daqiao:addSkill(liuli)
local qianxun = fk.CreateProhibitSkill{
name = "qianxun",
is_prohibited = function(self, from, to, card)
if to:hasSkill(self.name) then
return card.name == "indulgence" or card.name == "snatch"
end
end,
}
local lianying = fk.CreateTriggerSkill{
name = "lianying",
anim_type = "drawcard",
events = {fk.AfterCardsMove},
can_trigger = function(self, event, target, player, data)
if not player:hasSkill(self.name) then return end
if not player:isKongcheng() then return end
for _, move in ipairs(data) do
if move.from == player.id then
for _, info in ipairs(move.moveInfo) do
if info.fromArea == Card.PlayerHand then
return true
end
end
end
end
end,
on_use = function(self, event, target, player, data)
player:drawCards(1, self.name)
end,
}
local luxun = General:new(extension, "luxun", "wu", 3)
luxun:addSkill(qianxun)
luxun:addSkill(lianying)
local xiaoji = fk.CreateTriggerSkill{
name = "xiaoji",
anim_type = "drawcard",
events = {fk.AfterCardsMove},
can_trigger = function(self, event, target, player, data)
if not player:hasSkill(self.name) then return end
self.trigger_times = 0
for _, move in ipairs(data) do
if move.from == player.id then
for _, info in ipairs(move.moveInfo) do
if info.fromArea == Card.PlayerEquip then
self.trigger_times = self.trigger_times + 1
end
end
end
end
return self.trigger_times > 0
end,
on_trigger = function(self, event, target, player, data)
local ret
for i = 1, self.trigger_times do
ret = self:doCost(event, target, player, data)
if ret then return ret end
end
end,
on_use = function(self, event, target, player, data)
player:drawCards(2, self.name)
end,
}
2023-01-09 19:15:18 +08:00
local jieyin = fk.CreateActiveSkill{
name = "jieyin",
anim_type = "support",
can_use = function(self, player)
return player:usedSkillTimes(self.name) == 0
end,
2023-01-09 19:15:18 +08:00
card_filter = function(self, to_select, selected)
return #selected < 2 and Fk:currentRoom():getCardArea(to_select) ~= Player.Equip
2023-01-09 19:15:18 +08:00
end,
target_filter = function(self, to_select, selected)
local target = Fk:currentRoom():getPlayerById(to_select)
local name = target.general
return target:isWounded() and
target.gender == General.Male
2023-01-09 19:15:18 +08:00
and #selected < 1
end,
target_num = 1,
card_num = 2,
on_use = function(self, room, effect)
2023-01-09 19:15:18 +08:00
local from = room:getPlayerById(effect.from)
room:throwCard(effect.cards, self.name, from)
room:recover({
who = room:getPlayerById(effect.tos[1]),
2023-01-09 19:15:18 +08:00
num = 1,
recoverBy = effect.from,
skillName = self.name
})
if from:isWounded() then
room:recover({
who = room:getPlayerById(effect.from),
2023-01-09 19:15:18 +08:00
num = 1,
recoverBy = effect.from,
skillName = self.name
})
end
end
}
local sunshangxiang = General:new(extension, "sunshangxiang", "wu", 3, 3, General.Female)
sunshangxiang:addSkill(xiaoji)
2023-01-09 19:15:18 +08:00
sunshangxiang:addSkill(jieyin)
local qingnang = fk.CreateActiveSkill{
name = "qingnang",
anim_type = "support",
can_use = function(self, player)
return player:usedSkillTimes(self.name) == 0
end,
card_filter = function(self, to_select, selected, targets)
return #selected == 0 and Fk:currentRoom():getCardArea(to_select) ~= Player.Equip
end,
target_filter = function(self, to_select, selected, cards)
return #selected == 0 and Fk:currentRoom():getPlayerById(to_select):isWounded()
end,
target_num = 1,
card_num = 1,
on_use = function(self, room, effect)
local from = room:getPlayerById(effect.from)
room:throwCard(effect.cards, self.name, from)
room:recover({
who = room:getPlayerById(effect.tos[1]),
num = 1,
recoverBy = effect.from,
skillName = self.name
})
end,
}
local jijiu = fk.CreateViewAsSkill{
name = "jijiu",
anim_type = "support",
pattern = "peach",
card_filter = function(self, to_select, selected)
if #selected == 1 then return false end
return Fk:getCardById(to_select).color == Card.Red
end,
view_as = function(self, cards)
if #cards ~= 1 then
return nil
end
local c = Fk:cloneCard("peach")
c:addSubcard(cards[1])
return c
end,
enabled_at_play = function(self, player)
return false
end,
enabled_at_response = function(self, player)
return player.phase == Player.NotActive
end,
}
local huatuo = General:new(extension, "huatuo", "qun", 3)
huatuo:addSkill(qingnang)
huatuo:addSkill(jijiu)
local wushuang = fk.CreateTriggerSkill{
name = "wushuang",
anim_type = "offensive",
frequency = Skill.Compulsory,
events = {fk.TargetSpecified, fk.TargetConfirmed},
can_trigger = function(self, event, target, player, data)
if not player:hasSkill(self.name) then
return false
end
if event == fk.TargetSpecified then
return target == player and table.contains({ "slash", "duel" }, data.card.name)
else
return data.to == player.id and data.card.name == "duel"
end
end,
on_use = function(self, event, target, player, data)
data.fixedResponseTimes = data.fixedResponseTimes or {}
if data.card.name == "slash" then
data.fixedResponseTimes["jink"] = 2
else
data.fixedResponseTimes["slash"] = 2
data.fixedAddTimesResponsors = data.fixedAddTimesResponsors or {}
table.insert(data.fixedAddTimesResponsors, (event == fk.TargetSpecified and data.to or data.from))
end
end,
}
local lvbu = General:new(extension, "lvbu", "qun", 4)
lvbu:addSkill(wushuang)
local lijian = fk.CreateActiveSkill{
name = "lijian",
anim_type = "offensive",
can_use = function(self, player)
return player:usedSkillTimes(self.name) == 0
end,
card_filter = function(self, to_select, selected)
return #selected == 0
end,
target_filter = function(self, to_select, selected)
return #selected < 2 and to_select ~= Self.id and
Fk:currentRoom():getPlayerById(to_select).gender == General.Male
end,
target_num = 2,
min_card_num = 1,
on_use = function(self, room, use)
room:throwCard(use.cards, self.name, room:getPlayerById(use.from))
local duel = Fk:cloneCard("duel")
local new_use = {} ---@type CardUseStruct
new_use.from = use.tos[2]
new_use.tos = { { use.tos[1] } }
new_use.card = duel
new_use.unoffsetableList = table.map(room:getAlivePlayers(), function(e)
return e.id
end)
room:useCard(new_use)
end,
}
local biyue = fk.CreateTriggerSkill{
name = "biyue",
anim_type = "drawcard",
events = {fk.EventPhaseStart},
can_trigger = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name)
and player.phase == Player.Finish
end,
on_use = function(self, event, target, player, data)
player:drawCards(1)
end,
}
2023-01-09 19:15:18 +08:00
local diaochan = General:new(extension, "diaochan", "qun", 3, 3, General.Female)
diaochan:addSkill(lijian)
diaochan:addSkill(biyue)
-- load translations of this package
dofile "packages/standard/i18n/init.lua"
return extension