1 Star 0 Fork 1

该账号已注销/xiaobai

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
xiaobai_sgs48.lua 45.52 KB
一键复制 编辑 原始数据 按行查看 历史
RalphR 提交于 2024-11-01 12:11 . !6修改
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111
local extension=Package("xiaobai_sgs48")
extension.extensionName="xiaobai"
Fk:loadTranslationTable{
["xiaobai_sgs48"] = "SGS48",
}
local U = require "packages/utility/utility"
local zhaoyu = General(extension, "xiaobai__zhaoyu", "qun", 3, 3, General.Female)
local huihao = fk.CreateTriggerSkill{
name = "xiaobai__huihao",
anim_type = "control",
events = {fk.EventPhaseStart},
can_trigger = function(self, event, target, player, data)
return target == player and player:hasSkill(self) and player.phase == Player.Start
end,
on_cost = function(self, event, target, player, data)
local use = U.askForPlayCard(player.room, player, nil, nil, self.name,
"#xiaobai__huihao-use", {bypass_times = true, extraUse = true}, true)
if use then
self.cost_data = use
return true
end
end,
on_use = function (self, event, target, player, data)
local room = player.room
local color = self.cost_data.card:getColorString()
room:useCard(self.cost_data)
if player.dead or color == "nocolor" then return end
room:doIndicate(player.id, table.map(room.alive_players, Util.IdMapper))
local pattern = color == "red" and ".|.|heart,diamond" or ".|.|spade,club"
local color2 = color == "red" and "black" or "red"
for _, p in ipairs(room:getAlivePlayers()) do
if player.dead then return end
if not p.dead and not p:isKongcheng() then
if p == player then
local card = room:askForCard(player, 1, 1, false, self.name, true, pattern, "#xiaobai__huihao1-ask:::"..color)
if #card > 0 then
room:setCardMark(Fk:getCardById(card[1]), "@@xiaobai__huihao-inhand-turn", 1)
player:showCards(card)
end
else
local choice = room:askForChoice(p, {
"xiaobai__huihao_give:"..player.id.."::"..color,
"xiaobai__huihao_slash:"..player.id.."::"..color2,
}, self.name)
if choice[17] == "g" then
local card = room:askForCard(p, 1, 1, false, self.name, true, pattern, "#xiaobai__huihao2-ask:"..player.id.."::"..color)
if #card > 0 then
room:moveCardTo(card, Card.PlayerHand, player, fk.ReasonGive, self.name, nil, true, p.id, "@@xiaobai__huihao-inhand-turn")
end
else
room:setPlayerMark(p, "xiaobai__huihao-tmp", color2)
local success, dat = room:askForUseActiveSkill(p, "xiaobai__huihao_viewas",
"#xiaobai__huihao-slash:"..player.id.."::"..color2, false,
{
bypass_distances = true,
bypass_times = true,
extraUse = true,
must_targets = {player.id},
})
room:setPlayerMark(p, "xiaobai__huihao-tmp", 0)
if success then
local card = Fk.skills["xiaobai__huihao_viewas"]:viewAs(dat.cards)
room:useCard{
from = p.id,
tos = table.map(dat.targets, function(id) return {id} end),
card = card,
extraUse = true,
}
end
end
end
end
end
player:filterHandcards()
end,
}
local huihao_filter = fk.CreateFilterSkill{
name = "#xiaobai__huihao_filter",
card_filter = function(self, card, player)
return card:getMark("@@xiaobai__huihao-inhand-turn") > 0 and table.contains(player.player_cards[Player.Hand], card.id)
end,
view_as = function(self, card)
local c = Fk:cloneCard("slash", card.suit, card.number)
c.skillName = "xiaobai__huihao"
return c
end,
}
local huihao_targetmod = fk.CreateTargetModSkill{
name = "#xiaobai__huihao_targetmod",
bypass_times = function(self, player, skill, scope, card, to)
return card and table.contains(card.skillNames, "xiaobai__huihao")
end,
}
local huihao_viewas = fk.CreateViewAsSkill{
name = "xiaobai__huihao_viewas",
card_filter = function(self, to_select, selected)
return #selected == 0 and Fk:getCardById(to_select):getColorString() == Self:getMark("xiaobai__huihao-tmp")
end,
view_as = function(self, cards)
if #cards ~= 1 then return end
local card = Fk:cloneCard("slash")
card:addSubcard(cards[1])
card.skillName = "xiaobai__huihao"
return card
end,
}
local weilv = fk.CreateActiveSkill{
name = "xiaobai__weilv",
anim_type = "drawcard",
min_card_num = 1,
max_card_num = 2,
target_num = 0,
prompt = function (self, selected_cards)
if #selected_cards == 0 then
return "#xiaobai__weilv0"
elseif #selected_cards == 1 then
return "#xiaobai__weilv-"..Fk:getCardById(selected_cards[1]).trueName
elseif #selected_cards == 2 then
return "#xiaobai__weilv2"
end
end,
can_use = Util.TrueFunc,
card_filter = function(self, to_select, selected)
local card = Fk:getCardById(to_select)
if card.trueName == "slash" or card.trueName == "jink" then
if #selected == 0 then
return true
elseif #selected == 1 then
return card.trueName ~= Fk:getCardById(selected[1]).trueName
end
end
end,
on_use = function(self, room, effect)
local player = room:getPlayerById(effect.from)
local name = Fk:getCardById(effect.cards[1]).trueName
room:recastCard(effect.cards, player, self.name)
if player.dead then return end
if #effect.cards == 2 then
U.askForUseVirtualCard(room, player, "duel", nil, self.name, "#xiaobai__weilv-duel", false)
player._phase_end = true
else
if name == "slash" then
room:addPlayerMark(player, "@@xiaobai__weilv_jink", 1)
elseif name == "jink" then
room:addPlayerMark(player, "@@xiaobai__weilv_slash", 1)
end
end
end,
}
local weilv_trigger = fk.CreateTriggerSkill{
name = "#xiaobai__weilv_trigger",
mute = true,
events = {fk.PreCardEffect},
can_trigger = function(self, event, target, player, data)
return player:getMark("@@xiaobai__weilv_"..data.card.trueName) > 0
end,
on_cost = Util.TrueFunc,
on_use = function(self, event, target, player, data)
local room = player.room
player:broadcastSkillInvoke("xiaobai__weilv")
room:notifySkillInvoked(player, "xiaobai__weilv", "control")
room:doIndicate(player.id, {target.id})
room:setPlayerMark(player, "@@xiaobai__weilv_"..data.card.trueName, 0)
return true
end,
}
huihao:addRelatedSkill(huihao_filter)
huihao:addRelatedSkill(huihao_targetmod)
Fk:addSkill(huihao_viewas)
weilv:addRelatedSkill(weilv_trigger)
zhaoyu:addSkill(huihao)
zhaoyu:addSkill(weilv)
Fk:loadTranslationTable{
["xiaobai__zhaoyu"] = "赵妪",
["#xiaobai__zhaoyu"] = "踅驳高秋",
["illustrator:xiaobai__zhaoyu"] = "丞惡浪",
["designer:xiaobai__zhaoyu"] = "柠檬",
["xiaobai__huihao"] = "麾号",
[":xiaobai__huihao"] = "准备阶段,你可以使用一张牌,然后令所有角色可以依次选择一项:1.正面向上交给你一张颜色相同的手牌,此牌本回合视为"..
"无次数限制的【杀】;2.将一张颜色不同的手牌当无距离限制的【杀】对你使用。",
["xiaobai__weilv"] = "威旅",
[":xiaobai__weilv"] = "出牌阶段,你可以重铸:一张【杀】,令下一张被使用的【闪】无效;一张【闪】,令下一张被使用的【杀】无效;"..
"上述牌各一张,视为使用【决斗】,然后结束此阶段。",
["#xiaobai__huihao-use"] = "麾号:你可以使用一张牌,然后所有角色依次选择交给你牌或对你使用【杀】",
["#xiaobai__huihao1-ask"] = "麾号:请展示一张%arg手牌,此牌本回合视为无次数限制的【杀】",
["#xiaobai__huihao2-ask"] = "麾号:请交给 %src 一张%arg手牌,此牌本回合视为无次数限制的【杀】",
["@@xiaobai__huihao-inhand-turn"] = "麾号",
["#xiaobai__huihao_filter"] = "麾号",
["xiaobai__huihao_give"] = "交给%src一张%arg手牌,此牌本回合视为【杀】",
["xiaobai__huihao_slash"] = "将一张%arg手牌当【杀】对%src使用",
["xiaobai__huihao_viewas"] = "麾号",
["#xiaobai__huihao-slash"] = "麾号:请将一张%arg手牌当【杀】对 %src 使用",
["#xiaobai__weilv0"] = "威旅:重铸【杀】或【闪】,根据牌名执行效果",
["#xiaobai__weilv-slash"] = "威旅:重铸一张【杀】,下一张被使用的【闪】无效",
["#xiaobai__weilv-jink"] = "威旅:重铸一张【闪】,下一张被使用的【杀】无效",
["#xiaobai__weilv2"] = "威旅:重铸【杀】【闪】各一张,然后视为使用【决斗】!",
["#xiaobai__weilv-duel"] = "威旅:请视为使用【决斗】",
["@@xiaobai__weilv_slash"] = "威旅 杀无效",
["@@xiaobai__weilv_jink"] = "威旅 闪无效",
["#xiaobai__weilv_trigger"] = "威旅",
}
local xiyingxi = General(extension, "xiaobai__xiyingxi", "wu", 3, 3, General.Female)
--[[local duanhuo = fk.CreateViewAsSkill{
name = "xiaobai__duanhuo",
anim_type = "control",
prompt = "#xiaobai__duanhuo",
card_filter = Util.FalseFunc,
view_as = function(self, cards)
local card = Fk:cloneCard("sincere_treat")
card.skillName = self.name
return card
end,
after_use = function (self, player, use)
local room = player.room
for _, id in ipairs(TargetGroup:getRealTargets(use.tos)) do
local p = room:getPlayerById(id)
if not p.dead and not p.chained and room:askForSkillInvoke(p, self.name, nil, "#xiaobai__duanhuo-ask") then
p:setChainState(true)
end
end
end,
enabled_at_play = function (self, player)
return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
end,
}
local duanhuo_targetmod = fk.CreateTargetModSkill{
name = "#xiaobai__duanhuo_targetmod",
bypass_distances = function(self, player, skill, card)
return card and table.contains(card.skillNames, "xiaobai__duanhuo")
end,
}]]--
local duanhuo = fk.CreateActiveSkill{
name = "xiaobai__duanhuo",
anim_type = "control",
prompt = "#xiaobai__duanhuo",
card_num = 0,
target_num = 1,
times = function (self)
return Self.phase == Player.Play and 1 - Self:usedSkillTimes(self.name, Player.HistoryPhase) or -1
end,
can_use = function(self, player)
return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
end,
card_filter = Util.FalseFunc,
target_filter = function (self, to_select, selected)
return #selected == 0 and to_select ~= Self.id and not Fk:currentRoom():getPlayerById(to_select):isKongcheng()
end,
on_use = function(self, room, effect)
local player = room:getPlayerById(effect.from)
local target = room:getPlayerById(effect.tos[1])
local n = target:getHandcardNum()
room:moveCardTo(target:getCardIds("h"), Card.PlayerHand, player, fk.ReasonPrey, self.name, nil, false, player.id)
if player.dead or target.dead or player:isKongcheng() then return end
local cards = room:askForCard(player, n, n, false, self.name, false, nil, "#xiaobai__duanhuo-give::"..target.id..":"..n)
room:moveCardTo(cards, Card.PlayerHand, target, fk.ReasonGive, self.name, nil, false, player.id)
if not target.dead and not target.chained and room:askForSkillInvoke(target, self.name, nil, "#xiaobai__duanhuo-ask") then
target:setChainState(true)
end
end
}
local nirao = fk.CreateTriggerSkill{
name = "xiaobai__nirao",
anim_type = "support",
events = {fk.AfterCardsMove},
can_trigger = function(self, event, target, player, data)
if player:hasSkill(self) and player:usedSkillTimes(self.name, Player.HistoryTurn) == 0 then
for _, move in ipairs(data) do
if move.from and player.room:getPlayerById(move.from).chained and
not table.contains({fk.ReasonUse, fk.ReasonResonpse}, move.moveReason) then
for _, info in ipairs(move.moveInfo) do
if info.fromArea == Card.PlayerHand or info.fromArea == Card.PlayerEquip then
return true
end
end
end
end
end
end,
on_trigger = function(self, event, target, player, data)
local room = player.room
local targets = {}
for _, move in ipairs(data) do
if move.from and room:getPlayerById(move.from).chained and
not table.contains({fk.ReasonUse, fk.ReasonResonpse}, move.moveReason) then
for _, info in ipairs(move.moveInfo) do
if info.fromArea == Card.PlayerHand or info.fromArea == Card.PlayerEquip then
table.insertIfNeed(targets, move.from)
end
end
end
end
room:sortPlayersByAction(targets)
for _, id in ipairs(targets) do
if player:usedSkillTimes(self.name, Player.HistoryTurn) > 0 or not player:hasSkill(self) then break end
local p = room:getPlayerById(id)
if not p.dead then
self:doCost(event, p, player, data)
end
end
end,
on_cost = function(self, event, target, player, data)
return player.room:askForSkillInvoke(player, self.name, nil, "#xiaobai__nirao-invoke::"..target.id)
end,
on_use = function(self, event, target, player, data)
local room = player.room
room:doIndicate(player.id, {target.id})
target:drawCards(2, self.name)
if target:getHandcardNum() > target.maxHp and not target.dead and target.chained then
target:setChainState(false)
end
end,
}
--duanhuo:addRelatedSkill(duanhuo_targetmod)
xiyingxi:addSkill(duanhuo)
xiyingxi:addSkill(nirao)
Fk:loadTranslationTable{
["xiaobai__xiyingxi"] = "习英习",
["#xiaobai__xiyingxi"] = "贵而能贫",
["illustrator:xiaobai__xiyingxi"] = "NOVART",
["designer:xiaobai__xiyingxi"] = "胖即是胖",
["xiaobai__duanhuo"] = "断祸",
--[":xiaobai__duanhuo"] = "出牌阶段限一次,你可以视为使用一张无距离限制的【推心置腹】,然后目标角色需选择是否横置自己。",
[":xiaobai__duanhuo"] = "出牌阶段限一次,你可以获得一名其他角色所有手牌并交给其等量手牌,然后其可以横置自己。",
["xiaobai__nirao"] = "逆饶",
[":xiaobai__nirao"] = "每名角色的回合限一次,一名角色不因使用或打出失去牌后,若其已横置,你可以令其摸两张牌,然后若其手牌数大于体力上限,"..
"重置其武将牌。",
--["#xiaobai__duanhuo"] = "断祸:视为使用一张无距离限制的【推心置腹】,然后目标选择是否横置武将牌",
["#xiaobai__duanhuo"] = "断祸:获得一名其他角色所有手牌并交给其等量手牌,然后其可以横置武将牌",
["#xiaobai__duanhuo-give"] = "断祸:请交给 %dest %arg张手牌",
["#xiaobai__duanhuo-ask"] = "断祸:是否横置你的武将牌?",
["#xiaobai__nirao-invoke"] = "逆饶:是否令 %dest 摸两张牌?",
}
local cuifu = General(extension, "xiaobai__cuifu", "wei", 3, 3, General.Female)
local nichang = fk.CreateViewAsSkill{
name = "xiaobai__nichang",
pattern = ".|.|.|.|.|basic",
prompt = "#xiaobai__nichang",
interaction = function(self)
local all_names = U.getAllCardNames("b")
local names = U.getViewAsCardNames(Self, self.name, all_names, {}, Self:getTableMark("xiaobai__nichang-round"))
if #names > 0 then
return U.CardNameBox { choices = names, all_choices = all_names }
end
end,
card_filter = Util.FalseFunc,
view_as = function(self, cards)
if not self.interaction.data then return end
local card = Fk:cloneCard(self.interaction.data)
card.skillName = self.name
return card
end,
before_use = function(self, player, use)
local room = player.room
room:addTableMark(player, "xiaobai__nichang-round", use.card.trueName)
for i = 1, 4, 1 do
if player.dead or player:isAllNude() then
return self.name
end
local suit = player:getTableMark("@xiaobai__nichang")[1]
local pattern = ".|.|"..U.ConvertSuit(suit, "sym", "str")
local card = room:askForCard(player, 1, 1, true, self.name, true, pattern,
"#xiaobai__nichang-ask:::"..suit..":"..(5 - i), player:getCardIds("j"))
if #card > 0 then
local mark = player:getTableMark("@xiaobai__nichang")
table.remove(mark, 1)
table.insert(mark, suit)
room:setPlayerMark(player, "@xiaobai__nichang", mark)
room:recastCard(card, player, self.name)
else
return self.name
end
end
end,
enabled_at_play = function (self, player)
return player:getMark("@xiaobai__nichang") ~= 0
end,
enabled_at_response = function(self, player, response)
return not response and player:getMark("@xiaobai__nichang") ~= 0
end,
}
local nichang_trigger = fk.CreateTriggerSkill{
name = "#xiaobai__nichang_trigger",
anim_type = "control",
events = {fk.CardUsing},
can_trigger = function (self, event, target, player, data)
return target == player and #player:getTableMark("xiaobai__nichang-round") == 4 and
table.contains(data.card.skillNames, "xiaobai__nichang") and
#player.room:getOtherPlayers(player) > 0
end,
on_cost = Util.TrueFunc,
on_use = function (self, event, target, player, data)
local room = player.room
room:doIndicate(player.id, table.map(room:getOtherPlayers(player), Util.IdMapper))
for _, p in ipairs(room:getOtherPlayers(player)) do
p:turnOver()
end
end,
refresh_events = {fk.EventLoseSkill, fk.EventAcquireSkill},
can_refresh = function(self, event, target, player, data)
return target == player and data == self
end,
on_refresh = function(self, event, target, player, data)
local room = player.room
if event == fk.EventAcquireSkill then
room:setPlayerMark(player, "@xiaobai__nichang", {"log_heart", "log_spade", "log_club", "log_diamond"})
else
room:setPlayerMark(player, "@xiaobai__nichang", 0)
end
end,
}
local diaodie = fk.CreateTriggerSkill{
name = "xiaobai__diaodie",
anim_type = "defensive",
frequency = Skill.Compulsory,
events = {fk.PreCardEffect},
can_trigger = function(self, event, target, player, data)
return player:hasSkill(self) and data.to == player.id and data.from ~= player.id and data.card.is_damage_card and
#player:getTableMark("@xiaobai__nichang") > 0 and data.card:getSuitString(true) == player:getMark("@xiaobai__nichang")[1]
end,
on_use = function (self, event, target, player, data)
local room = player.room
local choice = room:askForChoice(player, {"xiaobai__diaodie1:::"..data.card:getSuitString(true), "loseHp"}, self.name)
if choice == "loseHp" then
room:loseHp(player, 1, self.name)
else
local mark = player:getTableMark("@xiaobai__nichang")
table.removeOne(mark, data.card:getSuitString(true))
if #mark == 0 then
room:setPlayerMark(player, "@xiaobai__nichang", 0)
else
local new_mark = {}
for _, suit in ipairs({"log_heart", "log_spade", "log_club", "log_diamond"}) do
if table.contains(mark, suit) then
table.insert(new_mark, suit)
end
end
room:setPlayerMark(player, "@xiaobai__nichang", new_mark)
end
end
return true
end,
}
nichang:addRelatedSkill(nichang_trigger)
cuifu:addSkill(nichang)
cuifu:addSkill(diaodie)
Fk:loadTranslationTable{
["xiaobai__cuifu"] = "崔芣",
["#xiaobai__cuifu"] = "绫蝶枝折",
["illustrator:xiaobai__cuifu"] = "久梓",
["designer:xiaobai__cuifu"] = "左小白",
["xiaobai__nichang"] = "霓裳",
[":xiaobai__nichang"] = "转换技,当你需使用本轮未声明过的基本牌时,你可以声明之,然后重铸你区域内的一张①<font color='red'>♥</font>②♠③♣"..
"④<font color='red'>♦</font>牌,且可以执行至多四次此流程,以此法重铸四张牌后你视为使用之;当你本轮第四次以此法使用牌时,你令所有其他角色翻面。",
["xiaobai__diaodie"] = "凋蝶",
[":xiaobai__diaodie"] = "锁定技,其他角色对你使用的与〖霓裳〗当前转换项相同花色的伤害类牌对你生效前,改为令你选择一项:<br>"..
"1.删去该转换项并重置〖霓裳〗花色顺序;<br>2.失去1点体力。",
["#xiaobai__nichang"] = "霓裳:声明你要使用的牌和目标,然后重铸四次对应花色的牌以视为使用之",
["#xiaobai__nichang-ask"] = "霓裳:请重铸一张%arg牌(再重铸%arg2张则视为使用!)",
["@xiaobai__nichang"] = "霓裳",
["#xiaobai__nichang_trigger"] = "霓裳",
["xiaobai__diaodie1"] = "删去%arg项并重置〖霓裳〗花色顺序",
}
local hushi = General(extension, "xiaobai__hushi", "shu", 3, 3, General.Female)
local huoyan = fk.CreateViewAsSkill{
name = "xiaobai__huoyan",
pattern = ".|.|.|.|.|basic",
prompt = "#xiaobai__huoyan",
interaction = function(self)
local all_names = U.getAllCardNames("b")
local names = U.getViewAsCardNames(Self, self.name, all_names)
if #names > 0 then
return U.CardNameBox { choices = names, all_choices = all_names }
end
end,
card_filter = Util.FalseFunc,
view_as = function(self, cards)
if not self.interaction.data then return end
local card = Fk:cloneCard(self.interaction.data)
card.skillName = self.name
return card
end,
before_use = function(self, player)
local room = player.room
local targets = table.filter(room:getOtherPlayers(player), function(p)
return p:canMoveCardsInBoardTo(player)
end)
local to = room:askForChoosePlayers(player, table.map(targets, Util.IdMapper), 1, 1, "#xiaobai__huoyan-choose", self.name, false)
to = room:getPlayerById(to[1])
local result = room:askForMoveCardInBoard(player, to, player, self.name, nil, to)
if result.card.type == Card.TypeEquip and not player.dead and player:hasSkill(self.name, true) then
room:setPlayerMark(player, "@@xiaobai__huoyan", 1)
end
end,
enabled_at_play = function(self, player)
return player:getMark("@@xiaobai__huoyan") == 0 and table.find(Fk:currentRoom().alive_players, function(p)
return p:canMoveCardsInBoardTo(player)
end)
end,
enabled_at_response = function(self, player, response)
return not response and player:getMark("@@xiaobai__huoyan") == 0 and
table.find(Fk:currentRoom().alive_players, function(p)
return p:canMoveCardsInBoardTo(player)
end)
end,
}
local huoyan_delay = fk.CreateTriggerSkill{
name = "#xiaobai__huoyan_delay",
refresh_events = {fk.AfterCardsMove, fk.EventLoseSkill},
can_refresh = function(self, event, target, player, data)
if player:getMark("@@xiaobai__huoyan") > 0 then
if event == fk.AfterCardsMove then
for _, move in ipairs(data) do
if move.from == player.id then
for _, info in ipairs(move.moveInfo) do
if Fk:getCardById(info.cardId).type == Card.TypeEquip then
return true
end
end
end
end
elseif event == fk.EventLoseSkill then
return target == player and data == self
end
end
end,
on_refresh = function(self, event, target, player, data)
player.room:setPlayerMark(player, "@@xiaobai__huoyan", 0)
end,
}
local yanzai = fk.CreateTriggerSkill{
name = "xiaobai__yanzai",
switch_skill_name = "xiaobai__yanzai",
anim_type = "negative",
events = {fk.CardUseFinished},
can_trigger = function(self, event, target, player, data)
if player:hasSkill(self) and target ~= player and data.card.type == Card.TypeEquip and not target.dead and
not table.find(player.room.alive_players, function (p)
return p.dying
end) then
if player:getSwitchSkillState(self.name, false) == fk.SwitchYang then
return target:canUseTo(Fk:cloneCard("dismantlement"), player)
elseif player:getSwitchSkillState(self.name, false) == fk.SwitchYin then
return target:canUseTo(Fk:cloneCard("collateral"), player)
end
end
end,
on_cost = function (self, event, target, player, data)
local name = "dismantlement"
if player:getSwitchSkillState(self.name, false) == fk.SwitchYin then
name = "collateral"
end
local use = U.askForUseVirtualCard(player.room, target, name, nil, self.name,
"#xiaobai__yanzai-use:"..player.id.."::"..name, true, false, false, false, {must_targets = {player.id}}, true)
if use then
self.cost_data = use
return true
end
end,
on_use = function(self, event, target, player, data)
local room = player.room
room:setPlayerMark(player, "xiaobai__yanzai-turn", 1)
room:useCard(self.cost_data)
end,
}
local yanzai_delay = fk.CreateTriggerSkill{
name = "#xiaobai__yanzai_delay",
mute = true,
events = {fk.BeforeCardsMove},
can_trigger = function(self, event, target, player, data)
if player:getMark("xiaobai__yanzai-turn") > 0 then
for _, move in ipairs(data) do
if move.from == player.id then
for _, info in ipairs(move.moveInfo) do
if table.contains({Card.PlayerHand, Card.PlayerEquip, Card.PlayerJudge}, info.fromArea) then
return true
end
end
end
end
end
end,
on_cost = Util.TrueFunc,
on_use = function(self, event, target, player, data)
local room = player.room
room:setPlayerMark(player, "xiaobai__yanzai-turn", 0)
local targets = room:getOtherPlayers(player)
if #targets == 0 then return end
local ids = {}
for _, move in ipairs(data) do
if move.from == player.id then
for _, info in ipairs(move.moveInfo) do
if table.contains({Card.PlayerHand, Card.PlayerEquip, Card.PlayerJudge}, info.fromArea) then
table.insertIfNeed(ids, info.cardId)
end
end
end
end
local to
if #ids > 0 then
local choice = U.askforViewCardsAndChoice(player, ids, {"OK", "Cancel"}, "xiaobai__yanzai", "#xiaobai__yanzai-invoke")
if choice == "OK" then
to = room:askForChoosePlayers(player, table.map(targets, Util.IdMapper), 1, 1,
"#xiaobai__yanzai-give", "xiaobai__yanzai", false)
to = room:getPlayerById(to[1])
else
return
end
end
for _, move in ipairs(data) do
if move.from == player.id then
local new_info = {}
for _, info in ipairs(move.moveInfo) do
if table.contains(ids, info.cardId) then
--continue
else
table.insert(new_info, info)
end
move.moveInfo = new_info
end
end
end
room:moveCardTo(ids, Card.PlayerHand, to, fk.ReasonGive, "xiaobai__yanzai", nil, true, player.id)
end,
}
huoyan:addRelatedSkill(huoyan_delay)
yanzai:addRelatedSkill(yanzai_delay)
hushi:addSkill(huoyan)
hushi:addSkill(yanzai)
Fk:loadTranslationTable{
["xiaobai__hushi"] = "胡氏",
["#xiaobai__hushi"] = "暗月炎花",
["illustrator:xiaobai__hushi"] = "隈研吾",
["designer:xiaobai__hushi"] = "虎鲸",
["xiaobai__huoyan"] = "火宴",
[":xiaobai__huoyan"] = "你可以将其他角色场上一张牌移至你的场上,视为使用一张基本牌;若以此法移动装备牌,此技能失效直到你失去装备牌。",
["xiaobai__yanzai"] = "妟灾",
[":xiaobai__yanzai"] = "转换技,其他角色使用装备牌后,若没有角色处于濒死状态,其可以视为对你使用①【过河拆桥】②【借刀杀人】,本回合下次有牌"..
"离开你区域时,你可以将之交给一名其他角色。",
["#xiaobai__huoyan"] = "火宴:选择要使用的牌名和目标,然后将其他角色场上一张牌移至你场上以视为使用",
["#xiaobai__huoyan-choose"] = "火宴:选择一名角色将其场上的牌移至你场上,若为装备牌则此技能失效!",
["@@xiaobai__huoyan"] = "火宴失效",
["#xiaobai__yanzai-use"] = "妟灾:你可以视为对 %src 使用【%arg】",
["#xiaobai__yanzai_delay"] = "妟灾",
["#xiaobai__yanzai-invoke"] = "妟灾:是否将你即将失去的这些牌交给一名其他角色?",
["#xiaobai__yanzai-give"] = "妟灾:选择获得这些牌的角色",
}
local zhangyu = General(extension, "xiaobai__zhangyu", "shu", 3)
local xiongchen = fk.CreateTriggerSkill{
name = "xiaobai__xiongchen",
anim_type = "drawcard",
frequency = Skill.Compulsory,
events = {fk.StartJudge, fk.AfterDrawPileShuffle},
can_trigger = function(self, event, target, player, data)
if event == fk.StartJudge then
return target == player and player:hasSkill(self)
elseif event == fk.AfterDrawPileShuffle then
local skill_event = player.room.logic:getCurrentEvent():findParent(GameEvent.SkillEffect, true)
return skill_event and skill_event.data[3] == self and skill_event.data[2] == player
end
end,
on_use = function(self, event, target, player, data)
local room = player.room
if event == fk.StartJudge then
if data.card then --防止被咒缚等技能截胡
room:moveCardTo(data.card, Card.DiscardPile, nil, fk.ReasonJustMove)
end
local cards = {}
while true do
local id = room:getNCards(1)[1]
room:moveCardTo(id, Card.Processing, nil, fk.ReasonJustMove, self.name, nil, true, player.id)
room:delay(1000)
local card = Fk:getCardById(id)
data.card = card --防止二效果炸事件后clear中data.card为空报错
if card.trueName == "slash" then
break
else
table.insert(cards, id)
room:setPlayerMark(player, self.name, cards) --偷懒,用于二效果炸事件后清理处理区
end
end
if #cards > 0 and not player.dead then
room:moveCardTo(cards, Card.PlayerHand, player, fk.ReasonJustMove, self.name, nil, true, player.id)
end
else
local e = room.logic:getCurrentEvent().parent
while e do
if e.event == GameEvent.SkillEffect and e.data[3] ~= self then
room.logic:getCurrentEvent():addExitFunc(function()
e:shutdown()
end)
local parent = e.parent
if parent and parent.event == GameEvent.CardEffect then
local effect = parent.data[1]
if effect.card.sub_type == Card.SubtypeDelayedTrick and
room:getCardArea(effect.card:getEffectiveId()) == Card.Processing and
not target.dead and not target:hasDelayedTrick(effect.card.name) and
not table.contains(target.sealedSlots, Player.JudgeSlot) then
local card = effect.card
if card:isVirtual() then
card = Fk:cloneCard(card.name)
card:addSubcards(effect.card.subcards)
card.skillNames = effect.card.skillNames
target:addVirtualEquip(card)
end
room:moveCardTo(card, Player.Judge, target, fk.ReasonJustMove, self.name)
end
end
break
end
e = e.parent
end
local cards = table.filter(player:getTableMark(self.name), function (id)
return room:getCardArea(id) == Card.Processing
end)
if #cards > 0 then
room:moveCardTo(cards, Card.DiscardPile, nil, fk.ReasonJustMove)
end
local total = 3
while total > 0 do
room:setPlayerMark(player, "xiaobai__xiongchen-tmp", total)
local _, dat = room:askForUseActiveSkill(player, "xiaobai__xiongchen_active",
"#xiaobai__xiongchen-num:::"..total, false)
local to = room:getPlayerById(dat.targets[1])
room:addPlayerMark(to, "@xiaobai__xiongchen_count", dat.interaction)
total = total - dat.interaction
end
for _, p in ipairs(room:getAlivePlayers()) do
if p:getMark("@xiaobai__xiongchen_count") > 0 then
room:damage{
from = player,
to = p,
damage = p:getMark("@xiaobai__xiongchen_count"),
damageType = fk.ThunderDamage,
skillName = self.name,
}
room:setPlayerMark(p, "@xiaobai__xiongchen_count", 0)
end
end
end
end,
}
local xiongchen_active = fk.CreateActiveSkill{
name = "xiaobai__xiongchen_active",
card_num = 0,
target_num = 1,
interaction = function()
return UI.Spin {
from = 1,
to = Self:getMark("xiaobai__xiongchen-tmp"),
}
end,
card_filter = Util.FalseFunc,
target_filter = function (self, to_select, selected)
return #selected == 0
end,
}
local yanhuo = fk.CreateTriggerSkill{
name = "xiaobai__yanhuo",
switch_skill_name = "xiaobai__yanhuo",
anim_type = "control",
events = {fk.EventPhaseStart},
can_trigger = function(self, event, target, player, data)
if player:hasSkill(self) then
if target == player and player.phase == Player.Start then
return player:getMark(self.name) > 0 or player:getSwitchSkillState(self.name, false) == fk.SwitchYang
elseif target ~= player and target.phase == Player.Finish then
return not target.dead and (player:getMark(self.name) > 0 or player:getSwitchSkillState(self.name, false) == fk.SwitchYin)
end
end
end,
on_cost = function(self, event, target, player, data)
if target == player then
return player.room:askForSkillInvoke(player, self.name, nil, "#xiaobai__yanhuo-yang")
else
return player.room:askForSkillInvoke(target, self.name, nil, "#xiaobai__yanhuo-yin:"..player.id)
end
end,
on_use = function(self, event, target, player, data)
local room = player.room
if target ~= player then
room:doIndicate(target.id, {player.id})
end
local judge = {
who = player,
reason = "lightning",
pattern = ".|2~9|spade",
}
room:judge(judge)
if judge.card.suit == Card.Spade and judge.card.number > 1 and judge.card.number < 10 then
local damage = {
to = player,
damage = 3,
damageType = fk.ThunderDamage,
skillName = self.name,
}
damage.extra_data = damage.extra_data or {}
damage.extra_data.xiaobai__yanhuo = player.id
room:damage(damage)
end
if player.dead then return end
if player:getMark("xiaobai__yanhuo-tmp") > 0 then
room:setPlayerMark(player, "xiaobai__yanhuo-tmp", 0)
room:setPlayerMark(player, self.name, 1)
else
local cards = room:getNCards(5, "bottom")
room:moveCardTo(cards, Card.Processing, nil, fk.ReasonJustMove, self.name, nil, true, player.id)
for i = 1, 2, 1 do
if player.dead then break end
if not U.askForUseRealCard(room, player, cards, nil, self.name, "#xiaobai__yanhuo-use",
{
bypass_times = true,
extraUse = true,
expand_pile = cards,
}) then
break
end
cards = table.filter(cards, function (id)
return room:getCardArea(id) == Card.Processing
end)
if #cards == 0 then break end
end
if #cards > 0 and not player.dead then
local result = room:askForGuanxing(player, cards, {0, 3}, nil, self.name, true, {"Top", "processing_area"})
if #result.top > 0 then
room:moveCards{
ids = result.top,
toArea = Card.DrawPile,
moveReason = fk.ReasonJustMove,
skillName = self.name,
drawPilePosition = 1,
moveVisible = true,
}
end
end
U.clearRemainCards(room, cards, self.name)
end
end,
refresh_events = {fk.EnterDying},
can_refresh = function(self, event, target, player, data)
return data.damage and data.damage.skillName == self.name and
data.damage.extra_data and data.damage.extra_data.xiaobai__yanhuo == player.id
end,
on_refresh = function(self, event, target, player, data)
player.room:setPlayerMark(player, "xiaobai__yanhuo-tmp", 1)
end,
}
Fk:addSkill(xiongchen_active)
zhangyu:addSkill(xiongchen)
zhangyu:addSkill(yanhuo)
Fk:loadTranslationTable{
["xiaobai__zhangyu"] = "张裕",
["#xiaobai__zhangyu"] = "天祸降人",
["illustrator:xiaobai__zhangyu"] = "NOVART",
["designer:xiaobai__zhangyu"] = "Mushi",
["xiaobai__xiongchen"] = "凶谶",
[":xiaobai__xiongchen"] = "锁定技,你的判定流程改为依次亮出牌堆顶牌直到出现【杀】,你令该【杀】作为你的判定牌,然后获得其余亮出的牌;"..
"若牌堆在此流程中洗牌,你分配3点雷电伤害并终止此次判定。",
["xiaobai__yanhuo"] = "言祸",
[":xiaobai__yanhuo"] = "转换技,①准备阶段,你可以进行一次【闪电】判定,若你未因此进入濒死状态,你展示牌堆底五张牌,并使用其中至多两张牌,"..
"然后将其余至多三张牌置于牌堆顶;②其他角色的结束阶段,其可以令你执行①项,若你因此进入濒死状态,删去“言祸”转换技标签。",
["xiaobai__xiongchen_active"] = "凶谶",
["#xiaobai__xiongchen-num"] = "凶谶:分配3点雷电伤害(还剩%arg点!)",
["@xiaobai__xiongchen_count"] = "伤害值",
["#xiaobai__yanhuo-yang"] = "言祸:是否进行一次【闪电】判定?",
["#xiaobai__yanhuo-yin"] = "言祸:是否令 %src 进行一次【闪电】判定?",
["#xiaobai__yanhuo-use"] = "言祸:你可以使用其中至多两张牌",
}
local lishu = General(extension, "xiaobai__lishu", "qun", 4)
local xiongju = fk.CreateTriggerSkill{
name = "xiaobai__xiongju",
mute = true,
frequency = Skill.Compulsory,
events = {fk.AfterCardsMove, fk.TargetConfirming},
can_trigger = function(self, event, target, player, data)
if player:hasSkill(self) then
if event == fk.AfterCardsMove then
local cards = {}
for _, move in ipairs(data) do
if move.toArea == Card.DiscardPile then
if move.from and move.from ~= player.id then
for _, info in ipairs(move.moveInfo) do
if Fk:getCardById(info.cardId).is_damage_card and info.fromArea == Card.PlayerHand then
table.insertIfNeed(cards, info.cardId)
end
end
elseif move.from == nil and
table.contains({fk.ReasonUse, fk.ReasonResonpse, fk.ReasonPutIntoDiscardPile}, move.moveReason) then
local parent_event = player.room.logic:getCurrentEvent().parent
if parent_event ~= nil then
local card_ids = {}
if parent_event.event == GameEvent.UseCard or parent_event.event == GameEvent.RespondCard then
local use = parent_event.data[1]
if use.from ~= player.id and not use.damageDealt then
parent_event:searchEvents(GameEvent.MoveCards, 1, function(e2)
if e2.parent and e2.parent.id == parent_event.id then
for _, move2 in ipairs(e2.data) do
if (move2.moveReason == fk.ReasonUse or move2.moveReason == fk.ReasonResonpse) then
for _, info in ipairs(move2.moveInfo) do
if Fk:getCardById(info.cardId).is_damage_card and info.fromArea == Card.PlayerHand then
table.insertIfNeed(card_ids, info.cardId)
end
end
end
end
end
end)
end
elseif parent_event.event == GameEvent.Pindian then
local pindian = parent_event.data[1]
if pindian.from ~= player then
card_ids = player.room:getSubcardsByRule(pindian.fromCard)
end
for id, dat in pairs(pindian.results) do
if id ~= player.id then
card_ids = player.room:getSubcardsByRule(dat.toCard)
end
end
end
if #card_ids > 0 then
for _, info in ipairs(move.moveInfo) do
if Fk:getCardById(info.cardId).is_damage_card and table.contains(card_ids, info.cardId) and
info.fromArea == Card.Processing then
table.insertIfNeed(cards, info.cardId)
end
end
end
end
end
end
end
cards = table.filter(cards, function (id)
return table.contains(player.room.discard_pile, id)
end)
cards = U.moveCardsHoldingAreaCheck(player.room, cards)
if #cards > 0 then
self.cost_data = cards
return true
end
elseif event == fk.TargetConfirming then
if target == player and data.from ~= player.id and not player:isNude() then
local from = player.room:getPlayerById(data.from)
return from:getHandcardNum() < player:getHandcardNum() and from:inMyAttackRange(player)
end
end
end
end,
on_use = function(self, event, target, player, data)
local room = player.room
player:broadcastSkillInvoke(self.name)
if event == fk.AfterCardsMove then
room:notifySkillInvoked(player, self.name, "drawcard")
room:moveCardTo(self.cost_data, Card.PlayerHand, player, fk.ReasonJustMove, self.name, nil, true, player.id)
elseif event == fk.TargetConfirming then
room:notifySkillInvoked(player, self.name, "negative")
room:askForDiscard(player, 1, 1, true, self.name, false)
end
end,
}
local xiongju_attackrange = fk.CreateAttackRangeSkill{
name = "#xiaobai__xiongju_attackrange",
main_skill = xiongju,
correct_func = function(self, from, to)
for _, p in ipairs(Fk:currentRoom().alive_players) do
if p ~= from and p:hasSkill(xiongju) and from:getHandcardNum() < p:getHandcardNum() and
not (from:isRemoved() or p:isRemoved()) then
local baseValue = 1
local weapons = from:getEquipments(Card.SubtypeWeapon)
if #weapons > 0 then
baseValue = 0
for _, id in ipairs(weapons) do
local weapon = Fk:getCardById(id)
baseValue = math.max(baseValue, weapon:getAttackRange(from) or 1)
end
end
local status_skills = Fk:currentRoom().status_skills[AttackRangeSkill] or Util.DummyTable
local max_fixed, correct = nil, 0
for _, skill in ipairs(status_skills) do
if skill ~= self then
if skill:withoutAttackRange(from, p) then
return 0
end
local f = skill:getFixed(from)
if f ~= nil then
max_fixed = max_fixed and math.max(max_fixed, f) or f
end
local c = skill:getCorrect(from)
correct = correct + (c or 0)
end
end
local n = math.max(math.max(baseValue, (max_fixed or 0)) + correct, 0)
if from:distanceTo(p) < n then
return from:distanceTo(p) - n
end
end
end
end,
}
local sige = fk.CreateActiveSkill{
name = "xiaobai__sige",
anim_type = "drawcard",
card_num = 4,
target_num = 0,
prompt = "#xiaobai__sige",
card_filter = function(self, to_select, selected)
return #selected < 4
end,
can_use = function(self, player)
return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
end,
on_use = function(self, room, effect)
local player = room:getPlayerById(effect.from)
room:recastCard(effect.cards, player, self.name)
if player.dead then return end
local targets = table.filter(room:getOtherPlayers(player), function (p)
return player:inMyAttackRange(p)
end)
if #targets == 0 then return end
local cards = table.filter(room.discard_pile, function (id)
return Fk:getCardById(id).trueName == "slash"
end)
if #cards == 0 then return end
local target = room:askForChoosePlayers(player, table.map(targets, Util.IdMapper), 1, 1,
"#xiaobai__sige-choose", self.name, false)
target = room:getPlayerById(target[1])
local from, to = player, target
local yes1, yes2, tag, nums = false, false, {}, {}
while not player.dead and not target.dead do
cards = table.filter(room.discard_pile, function (id)
local card = Fk:getCardById(id)
return card.trueName == "slash" and not table.contains(nums, card.number)
end)
if #cards == 0 then break end
if table.find(cards, function (id)
local card = Fk:getCardById(id)
return from:canUseTo(card, to, {bypass_distances = true, bypass_times = true})
end) then
local use = U.askForUseRealCard(room, from, cards, "slash", self.name, "#xiaobai__sige-use", {
bypass_distances = true,
bypass_times = true,
extraUse = true,
expand_pile = cards,
must_targets = {to.id},
}, false, false)
if use then
table.insert(nums, use.card.number)
if use.damageDealt then
if use.damageDealt[player.id] then
yes1 = true
end
if use.damageDealt[target.id] then
yes2 = true
end
if yes1 and yes2 then
break
end
end
end
else
tag[from.id] = true
end
if tag[from.id] and tag[to.id] then
break
end
if from == player then
from, to = target, player
else
from, to = player, target
end
end
end,
}
xiongju:addRelatedSkill(xiongju_attackrange)
lishu:addSkill(xiongju)
lishu:addSkill(sige)
Fk:loadTranslationTable{
["xiaobai__lishu"] = "李术",
["#xiaobai__lishu"] = "鲸鲵栖江",
["illustrator:xiaobai__lishu"] = "孙启鑫",
["designer:xiaobai__lishu"] = "左小白",
["xiaobai__xiongju"] = "凶聚",
[":xiaobai__xiongju"] = "锁定技,其他角色未造成过伤害的伤害类牌进入弃牌堆后,你获得之;其他角色手牌数小于你且你在其的攻击范围内时,其攻击范围"..
"改为其与你的距离,且其使用【杀】或普通锦囊牌指定你为目标时,你须弃置一张牌。",
["xiaobai__sige"] = "肆戈",
[":xiaobai__sige"] = "出牌阶段限一次,你可以重铸四张牌,然后指定一名攻击范围内的其他角色,你与其依次对对方使用弃牌堆中的一张【杀】,"..
"直至你与其均因此受到伤害(每个点数的【杀】限一次)。",
["#xiaobai__sige"] = "肆戈:重铸四张牌,然后指定攻击范围内一名角色,你与其对对方使用弃牌堆中的【杀】!",
["#xiaobai__sige-choose"] = "肆戈:指定一名角色,你与其对对方使用弃牌堆中的【杀】!",
["#xiaobai__sige-use"] = "肆戈:对对方使用其中一张【杀】!",
}
return extension
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ssrzzy/xiaobai.git
git@gitee.com:ssrzzy/xiaobai.git
ssrzzy
xiaobai
xiaobai
master

搜索帮助