2 Star 0 Fork 0

该账号已注销/sashiko

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
weiwu.lua 43.33 KB
一键复制 编辑 原始数据 按行查看 历史
该账号已注销 提交于 2025-04-20 09:27 +08:00 . new郭循
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157
local extension=Package("sashiko_weiwu")
extension.extensionName="sashiko"
Fk:loadTranslationTable{
["sashiko_weiwu"]="魏武霸业S1",
}
local U = require "packages/utility/utility"
local DIY = require "packages/diy_utility/diy_utility"
local dingsw = General(extension, "sa__dingsshangwan", "wei", 3)
--三张牌来自不同角色才行,即to_select所属的角色不能在selected中
local fudao_filter = function(to_select, selected, players)
local pls=players
local sel=table.clone(selected)
if #sel==0 then
return table.contains(pls[1]:getCardIds("h"), to_select) or table.contains(pls[2]:getCardIds("h"), to_select) or
table.contains(pls[3]:getCardIds("h"), to_select)
end
local intlist={}
for i,p in ipairs(pls) do
local cids= p:getCardIds("h")
for j,s in ipairs(sel) do
if table.contains(cids, s) then
table.insert(intlist,p)
table.removeOne(sel, s)
break
--goto continue
end
end
end
for _,p in ipairs(intlist) do
table.removeOne(pls, p)
end
if #pls==0 then
return false end
for _,p in ipairs(pls) do
local cids= p:getCardIds("h")
if table.contains(cids, to_select) then
return true
end
end
return false
end
-- 抚悼技能
local fudao = fk.CreateViewAsSkill{
name = "weiwu__fudao",
anim_type = "support",
pattern = "peach,iron_chain",
interaction = function()
local all_names = {"peach","iron_chain"}
local names = U.getViewAsCardNames(Self, "weiwu__fudao", all_names)
if #names > 0 then
return U.CardNameBox { choices = names, all_choices = all_names }
end
end,
expand_pile=function(self)
local room=Fk:currentRoom()
local targets_hp = table.filter(
room.alive_players, function(p)
return table.every(room.alive_players, function(p2)
return p.hp <= p2.hp
end)
end) or {}
local targets_cards = table.filter(
room.alive_players, function(p)
return table.every(room.alive_players, function(p2)
return #p:getCardIds("h") <= #p2:getCardIds("h")
end)
end) or {}
local t1=targets_hp[1]
local t2=targets_cards[1]
local ret={}
for _,t in ipairs({t1,t2}) do
for _,cid in ipairs(t:getCardIds("h")) do
table.insertIfNeed(ret, cid)
end
end
return ret
end,
card_filter = function(self, to_select, selected)
-- TODO: 检查是否是合法的牌
local room=Fk:currentRoom()
local targets_hp = table.filter(
room.alive_players, function(p)
return table.every(room.alive_players, function(p2)
return p.hp <= p2.hp
end)
end) or {}
local targets_cards = table.filter(
room.alive_players, function(p)
return table.every(room.alive_players, function(p2)
return #p:getCardIds("h") <= #p2:getCardIds("h")
end)
end) or {}
local t1=targets_hp[1]
local t2=targets_cards[1]
return #selected<3 and fudao_filter(to_select, selected, {Self,t1,t2})
end,
view_as = function(self, cards)
if #cards ~= 3 then return nil end
local card = Fk:cloneCard(self.interaction.data)
-- TODO: 让玩家选择当桃还是铁索
card:addSubcards(cards)
card.skillName = self.name
return card
end,
after_use = function(self, player, use)
local room = player.room
for _,to in ipairs(use.tos) do
local p=room:getPlayerById(to[1])
room:setPlayerMark(p, "@@weiwu__fudao", 1)
end
end,
enabled_at_play = function(self, player)
local room=Fk:currentRoom()
local targets_hp = table.filter(
room.alive_players, function(p)
return table.every(room.alive_players, function(p2)
return p.hp <= p2.hp
end)
end) or {}
local targets_cards = table.filter(
room.alive_players, function(p)
return table.every(room.alive_players, function(p2)
return #p:getCardIds("h") <= #p2:getCardIds("h")
end)
end) or {}
return not player:isKongcheng() and #targets_hp == 1 and #targets_cards == 1
end,
}
local fengdao_trigger = fk.CreateTriggerSkill{
name = "#weiwu_wudao_trigger",
anim_type = "offensive",
events = {fk.AfterCardsMove},
can_trigger = function(self, event, target, player, data)
if player:getMark("@@weiwu__fudao")>0 then
local n = 0
for _, move in ipairs(data) do
if move.from == player.id and move.moveReason ~= fk.ReasonUse then
for _, info in ipairs(move.moveInfo) do
if info.fromArea == Card.PlayerHand then
n = n + 1
end
end
end
end
if n == 0 then return false end
return true
end
end,
on_cost=Util.TrueFunc,
on_use = function(self, event, target, player, data)
local room = player.room
room:setPlayerMark(player, "@@weiwu__fudao", 0)
player:reset()
end,
}
local fengyan = fk.CreateTriggerSkill{
name = "weiwu__fengyan",
anim_type = "offensive",
events = {fk.Damage, fk.Damaged},
can_trigger = function(self, event, target, player, data)
-- 检查是否是因为抚悼造成的伤害
if data.card and data.card.skillName and data.card.skillName == "weiwu__fengyan" then return false end
return target == player and player:hasSkill(self)
end,
on_cost = function(self, event, target, player, data)
local room = player.room
-- 找出手牌数和体力值唯一最大的角色
local targets_hp = table.filter(
room.alive_players, function(p)
return table.every(room.alive_players, function(p2)
return p.hp >= p2.hp
end)
end) or {}
local targets_cards = table.filter(
room.alive_players, function(p)
return table.every(room.alive_players, function(p2)
return #p:getCardIds("h") >= #p2:getCardIds("h")
end)
end) or {}
if #targets_hp ~= 1 or #targets_cards ~= 1 then return false end
local t1 = targets_hp[1]
local t2 = targets_cards[1]
self.cost_data = {}
table.insertIfNeed(self.cost_data, t1)
table.insertIfNeed(self.cost_data, t2)
return true
end,
on_use = function(self, event, target, player, data)
local room = player.room
local targets = self.cost_data
local req = Request:new(targets, "AskForChoice")--AskForChoice不能decode(因为返回的就是字符串)
req.focus_text = self.name
req.receive_decode = false
for _, p in ipairs(targets) do
local ch={"weiwu__fengyan_exchange", "Cancel"}
local data = { ch, ch, self.name, "#weiwu__fengyan-exchange",true}
req:setData(p,data)
req:setDefaultReply(p,"Cancel")
end
local x=0
--处理内容
for _, p in ipairs(targets) do
local choices = req:getResult(p)
if choices=="Cancel" then return end
if choices=="weiwu__fengyan_exchange" then
x=x+1
if p~=player then
U.swapHandCards(room,player, p, player, self.name)
end
end
end
if x==0 or x==#targets then
local targetsid=table.map(targets,function(p) return p.id end)
local to = room:askForChoosePlayers(player, targetsid, 1, 1, "#weiwu__fengyan-slash", self.name, false)
if #to > 0 then
local slash = Fk:cloneCard("ice__slash")
local use = {
from = player.id,
tos = {{to[1]}},
card = slash,
skillName = self.name,
}
room:useCard(use)
end
end
end,
}
fudao:addRelatedSkill(fengdao_trigger)
dingsw:addSkill(fudao)
dingsw:addSkill(fengyan)
Fk:loadTranslationTable{
["sa__dingsshangwan"] = "丁尚涴",
["#sa__dingsshangwan"] = "与君不载",
["designer:sa__dingsshangwan"] = "BCG_Dylattechses",
["weiwu__fudao"] = "抚悼",
["#weiwu_wudao_trigger"] = "抚悼",
["@@weiwu__fudao"] = "抚悼",
[":weiwu__fudao"] = "你可将你、手牌数、体力值唯一最少的角色场上各一张牌当【桃】或【铁索连环】使用;目标角色下次不因使用而失去手牌后,复原武将牌。",
["weiwu__fengyan"] = "讽言",
[":weiwu__fengyan"] = "你不因此造成或受到伤害后,手牌数、体力值唯一最大的角色同时可与你交换手牌;若均或均未交换,你视为对其中一者使用一张冰【杀】。",
}
Fk:loadTranslationTable{
["#weiwu__fengyan-exchange"] = "讽言:你可以与丁尚涴交换手牌",
["#weiwu__fengyan-slash"] = "讽言:你可以选择一名角色视为对其使用一张冰【杀】",
[":weiwu__fengyan_exchange"] = "与丁尚涴交换手牌",
["weiwu__fengyan_exchange"] = "讽言",
}
local dianwei = General(extension, "sa__dianwei", "wei", 4, 5)
Fk:loadTranslationTable{
["sa__dianwei"] = "典韦",
["#sa__dianwei"] = "狂战怒莽",
["designer:sa__dianwei"] = "屑&Sachiko",
}
local wujiu = fk.CreateTriggerSkill{
name = "weiwu__wujiu",
anim_type = "drawcard",
events = {fk.BeforeDrawCard},
can_trigger = function(self, event, target, player, data)
return target == player and player:hasSkill(self) and data.num > 0
end,
on_cost = function(self, event, target, player, data)
local room = player.room
local n = data.num * 2
if not room:askForSkillInvoke(player, self.name, data, "#weiwu__wujiu_draw:::"..n) then return false end
local choice = room:askForChoice(player, {"weiwu__wujiu_one","weiwu__wujiu_two", "weiwu__wujiu_bs", "weiwu__wujiu_no"}, self.name)
if choice=="Cancel" then return false end
self.cost_data =choice
return true
end,
on_use = function(self, event, target, player, data)
local room = player.room
local n = math.min(data.num , 5)*2
local choice = self.cost_data
local IFyiji = false
local IFslash = choice == "weiwu__wujiu_bs"
if choice == "weiwu__wujiu_one" or choice == "weiwu__wujiu_bs" then
room:loseHp(player, 1, self.name)
if player.dead then return end
n=n*2
end
if choice == "weiwu__wujiu_two" or choice == "weiwu__wujiu_bs" then
room:loseHp(player, 1, self.name)
if player.dead then return end
IFyiji = true
end
local cids = room:getNCards(n)
room:moveCardTo(cids, Card.Processing, nil, fk.ReasonJustMove, self.name, nil, true, player.id)
room:delay(400)
if not player.dead and player.hp < player.maxHp then
local get = table.filter(cids, function(cid)
local card = Fk:getCardById(cid)
if IFslash then
return card.trueName == "slash"
else
return card.is_damage_card
end
end)
if #get > 0 then
local x = player.maxHp - player.hp
if x < #get then
get = room:askForCardsChosen(player, player, x, x, { card_data = { { self.name, get } } }, self.name, "#weiwu__wujiu-get")
end
room:obtainCard(player, get, true, fk.ReasonJustMove, player.id,self.name)
end
end
if IFyiji and not player.dead then
local yiji = table.filter(cids, function(cid)
local card = Fk:getCardById(cid)
return not card.is_damage_card and room:getCardArea(cid) == Card.Processing
end)
if #yiji > 0 then
local others = room:getOtherPlayers(player, false)
if #others > 0 then
room:askForYiji(player, yiji, others, self.name, #yiji, #yiji, "#weiwu__wujiu-yiji", yiji)
end
end
end
room:cleanProcessingArea(cids, self.name)
return true
end,
}
dianwei:addSkill(wujiu)
Fk:loadTranslationTable{
["weiwu__wujiu"] = "无救",
[":weiwu__wujiu"] = "你摸牌时可改为亮出牌堆顶两倍张牌,然后获得其中X张伤害牌(X为你已损失体力值)。且你可先抉择:1.失去1点体力,此次亮出牌数翻倍;2.失去1点体力,须分配其余亮出的非伤害牌给其他角色。背水:你此次发动仅获得【杀】。",
["#weiwu__wujiu_draw"] = "无救:你可改为亮出%arg张牌,然后获得其中X张伤害牌(X为已损失体力值)",
["weiwu__wujiu_one"] = "失去1体力,令亮出的牌数再翻倍",
["weiwu__wujiu_two"] = "失去1体力,分配非伤害牌给别人",
["weiwu__wujiu_bs"] = "背水:获得伤害牌改为获得【杀】",
["weiwu__wujiu_no"] = "不做任何选择",
["#weiwu__wujiu-yiji"] ="无救:你须分配其余亮出的非伤害牌给其他角色",
["#weiwu__wujiu-get"] = "无救:请选择你获得的牌!",
}
local liewei = fk.CreateTriggerSkill{
name = "weiwu__liewei",
anim_type = "defensive",
frequency = Skill.Compulsory,
events = {fk.BeforeHpChanged, fk.RoundEnd, fk.Damage, fk.Damaged},
can_trigger = function(self, event, target, player, data)
if not player:hasSkill(self) then return false end
if event == fk.BeforeHpChanged then
return target == player and data.num < 0 and player.hp + data.num < 1
and player:getMark("weiwu__liewei_dying-round") == 0
elseif event == fk.RoundEnd then
return player.hp < 1
else
return target == player and player:getMark("weiwu__liewei_damage") > 1
end
end,
on_use = function(self, event, target, player, data)
local room = player.room
if event == fk.BeforeHpChanged then
data.preventDying = true
elseif event == fk.RoundEnd then
room:setPlayerMark(player, "weiwu__liewei_dying-round", 1)
room:enterDying({who = player.id})
else
room:setPlayerMark(player, "weiwu__liewei_damage", 0)
player:drawCards(1, self.name)
end
end,
refresh_events = {fk.Damage, fk.Damaged},
can_refresh = function(self, event, target, player, data)
return target == player and player:hasSkill(self, true)
end,
on_refresh = function(self, event, target, player, data)
player.room:addPlayerMark(player, "weiwu__liewei_damage")
end,
}
local liewei_buff = fk.CreateTargetModSkill{
name = "#weiwu_liewei_buff",
frequency = Skill.Compulsory,
residue_func = function(self, player, skill, scope)
if player:hasSkill(liewei) and skill.trueName == "slash_skill" and skill
and scope == Player.HistoryPhase then
return player.maxHp - player.hp
end
end,
}
Fk:loadTranslationTable{
["weiwu__liewei"] = "烈威",
[":weiwu__liewei"] = "锁定技,你的濒死状态结算改为于轮次结束时执行;你使用【杀】的次数+X(X为你脱离受伤状态需要的回复值);当你第偶数次{造成或受到伤害后},你摸一张牌。",
}
liewei:addRelatedSkill(liewei_buff)
dianwei:addSkill(liewei)
-- 不进行同名替换
local caoanmin = General(extension, "sa_caoanmin", "wei", 4)
Fk:loadTranslationTable{
["sa_caoanmin"] = "曹安民",
["#sa_caoanmin"] = "履薄临深",
["designer:sa_caoanmin"] = "静谦",
["~sa_caoanmin"] = "常居险境,偶有失蹄之时。",
}
local xunhua = fk.CreateActiveSkill{
name = "sa__xunhua",
anim_type = "control",
prompt = "#sa__xunhua",
attached_skill_name = "sa__xunhua&",
card_num = 0,
target_num = 1,
card_filter = Util.FalseFunc,
target_filter = function(self, to_select, selected, selected_cards)
return #selected == 0 and Self.id ~= to_select --and not Fk:currentRoom():getPlayerById(to_select):isNude()
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)
local to = room:getPlayerById(effect.tos[1])
local result = U.askForJointCard({player, to}, 1, 1, true, self.name, false, ".", "#sa__xunhua-discard", nil, true)
local my_cards, other_cards = result[player.id], result[to.id]
local my_recover, other_recover, moveInfos = false, false, {}
if #my_cards > 0 then
table.insert(moveInfos, {
from = player.id,
ids = my_cards,
toArea = Card.DiscardPile,
moveReason = fk.ReasonDiscard,
skillName = self.name,
moveVisible = true,
proposer = player.id,
})
if Fk:getCardById(my_cards[1]).type == Card.TypeEquip then
my_recover = true
end
end
if #other_cards > 0 then
table.insert(moveInfos, {
from = to.id,
ids = other_cards,
toArea = Card.DiscardPile,
moveReason = fk.ReasonDiscard,
skillName = self.name,
moveVisible = true,
proposer = to.id,
})
if Fk:getCardById(other_cards[1]).type == Card.TypeEquip then
other_recover = true
end
end
if #moveInfos > 0 then
room:moveCards(table.unpack(moveInfos))
end
if my_recover and not player.dead then
my_recover = room:recover { num = 1, skillName = self.name, who = player, recoverBy = player }
end
if other_recover and not to.dead then
other_recover = room:recover { num = 1, skillName = self.name, who = to, recoverBy = player }
end
if my_recover and other_recover then
if not player.dead then
player:turnOver()
end
if not to.dead then
to:turnOver()
end
end
end,
}
local xunhua_other = fk.CreateActiveSkill{
name = "sa__xunhua&",
anim_type = "control",
card_num = 0,
target_num = 1,
prompt = "#sa__xunhua-other",
can_use = function(self, player)
return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0 and #Fk:currentRoom().alive_players > 2
end,
card_filter = Util.FalseFunc,
target_filter = function(self, to_select, selected)
return #selected == 0 and Self.id ~= to_select and Fk:currentRoom():getPlayerById(to_select):hasSkill(xunhua)
end,
on_use = function(self, room, effect)
local player = room:getPlayerById(effect.from)
local owner = room:getPlayerById(effect.tos[1])
owner:broadcastSkillInvoke("sa__xunhua")
local others = room:getOtherPlayers(player, false)
table.removeOne(others, owner)
if #others == 0 then return end
local tos = room:askForChoosePlayers(owner, table.map(others, Util.IdMapper), 1, 1, "#sa__xunhua-choose:"..player.id, self.name, false)
local victim = room:getPlayerById(tos[1])
xunhua:onUse(room, { from = player.id, tos = { victim.id }, cards = {} })
end,
}
Fk:addSkill(xunhua_other)
caoanmin:addSkill(xunhua)
Fk:loadTranslationTable{
["sa__xunhua"] = "寻花",
[":sa__xunhua"] = "每名角色的出牌阶段限一次,该角色可以请你选择另一名角色,然后二者同时弃置一张牌,以此法弃置装备牌的角色回复1点体力,若均回复体力则二者翻面。",
["#sa__xunhua"] = "寻花:令一名角色与你同时弃置一张牌,弃置装备则回复1点体力,若你与其均回复体力则均翻面",
["#sa__xunhua-discard"] = "寻花:请弃置一张牌,若弃置装备牌你回复1点体力",
["#sa__xunhua-other"] = "邀请有“寻花”的角色选择另一名角色,你与被选择的角色同时弃牌,弃装备则回血",
["#sa__xunhua-choose"] = "寻花:你须选择一名角色,令其与 %src 同时弃牌",
["sa__xunhua&"] = "寻花",
[":sa__xunhua&"] = "出牌阶段限一次,你可以邀请有“寻花”的角色选择另一名角色,然后你与被选择的角色同时弃置一张牌,以此法弃置装备牌的角色回复1点体力,若均回复体力则二者翻面。",
["$sa__xunhua1"] = "不临危境,功业何来?",
["$sa__xunhua2"] = "以身犯险,以命相搏。",
}
local kaikang = fk.CreateTriggerSkill{
name = "sa__kaikang",
anim_type = "support",
events = {fk.TargetConfirmed},
can_trigger = function(self, event, target, player, data)
local from = player.room:getPlayerById(data.from)
if player:hasSkill(self) and not target.dead and from and not from.dead and data.card.trueName == "slash" and
not target:isRemoved() and player:distanceTo(target) <= 1 and AimGroup:isOnlyTarget(target, data) then
return not table.every({player, target, from}, function (p)
return p:isNude()
end)
end
end,
on_cost = function (self, event, target, player, data)
return player.room:askForSkillInvoke(player, self.name, nil, "#sa__kaikang-invoke:"..data.from..":"..target.id)
end,
on_use = function(self, event, target, player, data)
local room = player.room
local from = room:getPlayerById(data.from)
local cards = {}
for _, to in ipairs({from, target, player}) do
if not to:isNude() then
local cid = room:askForCardChosen(player, to, "he", self.name)
room:throwCard(cid, self.name, to, player)
table.insertIfNeed(cards, cid)
end
end
cards = table.filter(cards, function(id) return room:getCardArea(id) == Card.DiscardPile end)
if #cards == 0 then return end
for _, to in ipairs({player, target, from}) do
if not to.dead then
local cid = room:askForCardChosen(to, to, { card_data = { { self.name, cards } } }, self.name, "#sa__kaikang-get")
room:obtainCard(to, cid, true, fk.ReasonJustMove, to.id, self.name)
cards = table.filter(cards, function(id) return room:getCardArea(id) == Card.DiscardPile end)
if #cards == 0 then break end
end
end
end,
}
caoanmin:addSkill(kaikang)
Fk:loadTranslationTable{
["sa__kaikang"] = "慨抗",
[":sa__kaikang"] = "当你距离1以内的角色成为【杀】的唯一目标后,你可以依次弃置使用者、该角色、你的各一张牌,然后你、该角色、使用者依次获得一张以此法被弃置的牌。",
["#sa__kaikang-invoke"] = "慨抗:你可依次弃置%src、%dest、你各一张牌,然后你、%dest、%src依次获得其中一张牌",
["#sa__kaikang-get"] = "慨抗:选择一张牌获得",
["$sa__kaikang1"] = "曹家儿郎,何惧一死!",
["$sa__kaikang2"] = "此役当战,有死无生!",
}
-- 不进行同名替换
local huban = General(extension, "sa_huban", "wei", 4)
Fk:loadTranslationTable{
["sa_huban"] = "胡班",
["#sa_huban"] = "血火照路",
["designer:sa_huban"] = "yyuaN",
["~sa_huban"] = "无耻鼠辈,吾耻与为伍。",
}
local shiyan = fk.CreateTriggerSkill{
name = "sa__shiyan",
mute = true,
events = {fk.EventPhaseStart, fk.EventPhaseEnd, fk.CardUsing},
can_trigger = function(self, event, target, player, data)
if not player:hasSkill(self) then return end
if event == fk.EventPhaseStart then
return target == player and player.phase == Player.Finish
elseif event == fk.EventPhaseEnd then
return target.phase == Player.Play and player:getMark("sa__shiyan_to") == target.id
elseif event == fk.CardUsing then
if player:getMark("sa__shiyan_to") == target.id then
return table.find(DIY.GetShownCards(player), function (id)
return Fk:getCardById(id).suit == data.card.suit
end) ~= nil
end
end
end,
on_cost = function (self, event, target, player, data)
if event == fk.EventPhaseStart then
return player.room:askForSkillInvoke(player, self.name)
end
return true
end,
on_use = function(self, event, target, player, data)
local room = player.room
if event == fk.EventPhaseStart then
player:broadcastSkillInvoke(self.name, math.random(1, 2))
room:notifySkillInvoked(player, self.name, "drawcard")
player:drawCards(3, self.name)
if player.dead or player:isKongcheng() then return end
local cards = player:getCardIds("h")
if #cards > 3 then
cards = room:askForCard(player, 3, 3, false, self.name, false, nil, "#sa__shiyan-show")
end
DIY.ShowCards(player, cards)
local targets = room:getOtherPlayers(player, false)
if #targets == 0 then return false end
local tos = room:askForChoosePlayers(player, table.map(targets, Util.IdMapper), 1, 1, "#sa__shiyan-choose", self.name, false)
if #tos > 0 then
local to = room:getPlayerById(tos[1])
room:setPlayerMark(player, "@sa__shiyan", to.general)
room:setPlayerMark(player, "sa__shiyan_to", to.id)
end
elseif event == fk.EventPhaseEnd then
player:broadcastSkillInvoke(self.name, math.random(1, 2))
room:notifySkillInvoked(player, self.name, "offensive")
room:setPlayerMark(player, "@sa__shiyan", 0)
room:setPlayerMark(player, "sa__shiyan_to", 0)
local cards = DIY.GetShownCards(player)
while #cards > 0 and not target.dead do
local canUseIds = table.filter(cards, function(id)
local slash = Fk:cloneCard("fire__slash")
slash.skillName = self.name
slash:addSubcard(id)
return not player:isProhibited(target, slash) and not player:prohibitUse(slash)
end)
if #canUseIds == 0 then break end
local cid = table.random(canUseIds)
table.removeOne(cards, cid)
room:useVirtualCard("fire__slash", {cid}, player, target, self.name, true)
cards = table.filter(cards, function(id) return table.contains(player:getCardIds("h"), id) end)
end
elseif event == fk.CardUsing then
room:notifySkillInvoked(player, self.name, "support")
local ids = table.filter(DIY.GetShownCards(player), function (id)
return Fk:getCardById(id).suit == data.card.suit
end)
if #ids == 0 then return end
if #ids > 1 then
ids = room:askForCard(player, 1, 1, false, self.name, false, tostring(Exppattern{ id = ids }), "#sa__shiyan-recast")
end
room:recastCard(ids, player, self.name)
local cid = ids[1]
if cid and room:getCardArea(cid) == Card.DiscardPile and not player.dead and not target.dead and
room:askForSkillInvoke(player, self.name, nil, "#sa__shiyan-give::"..target.id..":"..Fk:getCardById(cid):toLogString()) then
player:broadcastSkillInvoke(self.name, math.random(3, 4))
room:doIndicate(player.id, {target.id})
room:obtainCard(target, cid, true, fk.ReasonGive, player.id, self.name)
end
end
end,
on_lose = function (self, player)
player.room:setPlayerMark(player, "@sa__shiyan", 0)
end,
}
huban:addSkill(shiyan)
Fk:loadTranslationTable{
["sa__shiyan"] = "释焰",
[":sa__shiyan"] = "结束阶段,你可以摸三张牌并明置三张牌,然后指定一名其他角色,于其下个出牌阶段结束时依次将明置牌当火【杀】对其使用;此前,其使用你明置花色的牌时,你须重铸一张明置牌,且可以令其获得此牌。",
["@sa__shiyan"] = "释焰",
["#sa__shiyan-show"] = "释焰:请明置三张牌",
["#sa__shiyan-choose"] = "释焰:指定一名其他角色,你于其下个出牌阶段结束时依次将明置牌当火【杀】对其使用",
["#sa__shiyan-recast"] = "释焰:你须重铸一张明置牌",
["#sa__shiyan-give"] = "释焰:你可以将%arg交给%dest",
["$sa__shiyan1"] = "义士今犹在,青笺气千云。",
["$sa__shiyan2"] = "舍身饲离火,不负万古名。",
["$sa__shiyan3"] = "班虽卑微,亦知何为大义。", -- 确认给牌1
["$sa__shiyan4"] = "大义当头,且助君一臂之力。",-- 确认给牌2
}
-- 不进行同名替换
local guanyu = General(extension, "sa_guanyu", "wei", 4)
Fk:loadTranslationTable{
["sa_guanyu"] = "关羽",
["#sa_guanyu"] = "荆王",
["designer:sa_guanyu"] = "屑",
["~sa_guanyu"] = "玉碎不改白,竹焚不毁节。",
}
local sa__qiebei = fk.CreateTriggerSkill{
name = "sa__qiebei",
anim_type = "drawcard",
frequency = Skill.Compulsory,
events = {fk.GameStart},
can_trigger = function(self, event, target, player, data)
return player:hasSkill(self)
end,
on_use = function (self, event, target, player, data)
local room = player.room
player:throwAllCards("h", self.name)
if player.dead then return end
local get = {room:printCard("god_salvation", Card.Heart, 1).id}
local anal_info = {{Card.Spade, 3}, {Card.Spade, 9}, {Card.Club, 3}, {Card.Club, 9}, {Card.Diamond, 9}}--军争5张
for _, info in ipairs(table.random(anal_info, 3)) do
table.insert(get, room:printCard("analeptic", info[1], info[2]).id)
end
local slash_info = {}
for _, id in ipairs(Fk:getAllCardIds()) do
local c = Fk:getCardById(id)
if c.name == "slash" then
table.insert(slash_info, {c.suit, c.number})
end
end
for _, info in ipairs(table.random(slash_info, 2)) do
table.insert(get, room:printCard("slash", info[1], info[2]).id)
end
for _, id in ipairs(get) do
room:setCardMark(Fk:getCardById(id), "@@sa__qiebei", player.id)
end
room:obtainCard(player, get, true, fk.ReasonJustMove, player.id, self.name)
end,
-- 初始手牌数设置为0,优先级太高,有可能被其他技能干扰
refresh_events = {fk.DrawInitialCards},
can_refresh = function (self, event, target, player, data)
return player:hasSkill(self) and target == player
end,
on_refresh = function (self, event, target, player, data)
data.num = 0
end,
}
-- 防止移动触发任何技能
local sa__qiebei_move = fk.CreateTriggerSkill{
name = "#sa__qiebei_move",
mute = true,
priority = 10,
frequency = Skill.Compulsory,
events = {fk.AfterCardsMove},
can_trigger = function(self, event, target, player, data)
for _, move in ipairs(data) do
if move.skillName == "sa__qiebei" then
return true
end
end
end,
on_use = Util.TrueFunc,
}
sa__qiebei:addRelatedSkill(sa__qiebei_move)
local sa__qiebei_lose = fk.CreateTriggerSkill{
name = "#sa__qiebei_lose",
anim_type = "control",
frequency = Skill.Compulsory,
main_skill = sa__qiebei,
events = {fk.AfterCardsMove},
can_trigger = function(self, event, target, player, data)
if not player:hasSkill(sa__qiebei) then return end
return data.extra_data and data.extra_data.sa__qiebei_info and data.extra_data.sa__qiebei_info[player.id]
end,
on_use = function (self, event, target, player, data)
local room = player.room
local num = data.extra_data.sa__qiebei_info[player.id]
for i = 1, num do
local maxcard, attack, qiezhan = player:getMaxCards(), player:getAttackRange(), (player:getMark("sa__qiebei_qiezhan") + 1)
local minNum = math.min(maxcard, attack, qiezhan)
local all_choices = {"sa__qiebei_maxcard", "sa__qiebei_attack", "sa__qiebei_qiezhan"}
local choices = {}
if minNum == maxcard then table.insert(choices, all_choices[1]) end
if minNum == attack then table.insert(choices, all_choices[2]) end
if minNum == qiezhan then table.insert(choices, all_choices[3]) end
local choice = room:askForChoice(player, choices, self.name, "#sa__qiebei-choice", nil, all_choices)
room:addPlayerMark(player, choice)
end
end,
refresh_events = {fk.AfterCardsMove},
can_refresh = function (self, event, target, player, data)
for _, move in ipairs(data) do
if move.from == player.id then
for _, info in ipairs(move.moveInfo) do
if Fk:getCardById(info.cardId):getMark("@@sa__qiebei") == player.id then
return true
end
end
end
end
end,
on_refresh = function (self, event, target, player, data)
data.extra_data = data.extra_data or {}
data.extra_data.sa__qiebei_info = data.extra_data.sa__qiebei_info or {}
for _, move in ipairs(data) do
if move.from == player.id then
for _, info in ipairs(move.moveInfo) do
if Fk:getCardById(info.cardId):getMark("@@sa__qiebei") == player.id then
player.room:setCardMark(Fk:getCardById(info.cardId), "@@sa__qiebei", 0)
if move.moveReason ~= fk.ReasonUse then
data.extra_data.sa__qiebei_info[player.id] = (data.extra_data.sa__qiebei_info[player.id] or 0) + 1
end
end
end
end
end
end,
}
sa__qiebei:addRelatedSkill(sa__qiebei_lose)
local sa__qiebei_maxcards = fk.CreateMaxCardsSkill{
name = "#sa__qiebei_maxcards",
correct_func = function(self, player)
if player:hasSkill(sa__qiebei) then
return player:getMark("sa__qiebei_maxcard")
end
end,
}
sa__qiebei:addRelatedSkill(sa__qiebei_maxcards)
local sa__qiebei_attackrange = fk.CreateAttackRangeSkill{
name = "#sa__qiebei_attackrange",
correct_func = function (self, player)
if player:hasSkill(sa__qiebei) then
return player:getMark("sa__qiebei_attack")
end
end,
}
sa__qiebei:addRelatedSkill(sa__qiebei_attackrange)
guanyu:addSkill(sa__qiebei)
Fk:loadTranslationTable{
["sa__qiebei"] = "且背",
[":sa__qiebei"] = "锁定技,你的初始手牌改为:三张【酒】、两张【杀】、一张【桃园结义】。且不因使用而失去后,你令以下中最小的一项值+1:①手牌上限;②攻击范围;③〖且斩〗的发动次数。",
["#sa__qiebei_lose"] = "且背",
["#sa__qiebei_move"] = "且背",
["@@sa__qiebei"] = "且背",
["#sa__qiebei-choice"] = "且背:令一个数值+1",
["sa__qiebei_maxcard"] = "手牌上限",
["sa__qiebei_attack"] = "攻击范围",
["sa__qiebei_qiezhan"] = "〖且斩〗每回合发动次数",
["$sa__qiebei1"] = "长刀偃月,誓诛奸贼,以报桃园之义。",
["$sa__qiebei2"] = "忠义为本,所向披靡,赤胆可昭日月。",
}
local sa__qiezhan = fk.CreateViewAsSkill{
name = "sa__qiezhan",
anim_type = "offensive",
pattern = ".|.|.|.|.|trick,basic",
prompt = "#sa__qiezhan",
times = function (self)
return 1 + Self:getMark("sa__qiebei_qiezhan") - Self:usedSkillTimes(self.name)
end,
interaction = function(self)
local all_choices = table.filter(U.getAllCardNames("bt"), function(name)
local card = Fk:cloneCard(name)
return not card.multiple_targets and card.is_damage_card
end)
local choices = U.getViewAsCardNames(Self, self.name, all_choices)
if #choices > 0 then
return UI.ComboBox { choices = choices, all_choices = all_choices }
end
end,
card_filter = function(self, to_select, selected)
return #selected < 2 and Fk:getCardById(to_select).color == Card.Red
end,
view_as = function(self, cards)
local name = self.interaction.data
if #cards ~= 2 or not name then return nil end
local c = Fk:cloneCard(name)
local basic = c.type == Card.TypeBasic and 1 or 0
basic = basic + #table.filter(cards, function(id) return Fk:getCardById(id).type == Card.TypeBasic end)
if basic < 2 then return nil end
c.skillName = self.name
c:setMark(self.name, cards)
return c
end,
before_use = function(self, player, use)
local room = player.room
local ids = use.card:getMark(self.name)
if type(ids) ~= "table" then return "" end
local allSlash = use.card.trueName == "slash"
and table.every(ids, function(id) return Fk:getCardById(id).trueName == "slash" end)
player.room:recastCard(ids, player, self.name)
if allSlash then
use.additionalEffect = 3
use.extra_data = use.extra_data or {}
use.extra_data.sa__qiezhan_filter = true
end
end,
enabled_at_play = function(self, player)
return player:usedSkillTimes(self.name) < (1 + player:getMark("sa__qiebei_qiezhan"))
end,
enabled_at_response = function (self, player, response)
if player:usedSkillTimes(self.name) < (1 + player:getMark("sa__qiebei_qiezhan")) then
if not response and Fk.currentResponsePattern then
for _, name in ipairs(U.getAllCardNames("bt")) do
local card = Fk:cloneCard(name)
if not card.multiple_targets and card.is_damage_card and Exppattern:Parse(Fk.currentResponsePattern):matchExp(name) then
return true
end
end
end
end
end,
}
local sa__qiezhan_trigger = fk.CreateTriggerSkill{
name = "#sa__qiezhan_trigger",
refresh_events = {fk.CardUsing, fk.CardUseFinished},
can_refresh = function(self, event, target, player, data)
if target == player and data.extra_data and data.extra_data.sa__qiezhan_filter then
return true
end
end,
on_refresh = function (self, event, target, player, data)
local room = player.room
-- 未考虑插结
if event == fk.CardUsing then
for _, pid in ipairs(TargetGroup:getRealTargets(data.tos)) do
local p = room:getPlayerById(pid)
local ids = table.filter(p:getCardIds("h"), function (id)
return Fk:getCardById(id).color == Card.Red
end)
room:setPlayerMark(p, "@@sa__qiezhan", ids)
p:filterHandcards()
end
else
for _, p in ipairs(room.alive_players) do
if p:getMark("@@sa__qiezhan") ~= 0 then
room:setPlayerMark(p, "@@sa__qiezhan", 0)
p:filterHandcards()
end
end
end
end,
}
sa__qiezhan:addRelatedSkill(sa__qiezhan_trigger)
local sa__qiezhan_filter = fk.CreateFilterSkill{
name = "#sa__qiezhan_filter",
card_filter = function(self, card, player)
return table.contains(player:getTableMark("@@sa__qiezhan"), card.id) and table.contains(player.player_cards[Player.Hand], card.id)
end,
view_as = function(self, card)
local c = Fk:cloneCard("jink", card.suit, card.number)
c.skillName = "sa__qiezhan"
return c
end,
}
sa__qiezhan:addRelatedSkill(sa__qiezhan_filter)
guanyu:addSkill(sa__qiezhan)
Fk:loadTranslationTable{
["sa__qiezhan"] = "且斩",
[":sa__qiezhan"] = "每回合限一次,你可以重铸两张红色牌,视为使用一张单体伤害牌,且前者与后者中至少两张为基本牌。若均为【杀】,此牌结算四次,目标当前红色手牌均视为【闪】。",
["#sa__qiezhan"] = "且斩:重铸两张红色牌,视为使用单体伤害牌,这三张牌中至少两张为基本牌",
["#sa__qiezhan_filter"] = "且斩",
["@@sa__qiezhan"] = "被且斩",
["$sa__qiezhan1"] = "赤兔倚东风,挽袖抚髯,问挡我者何人?",
["$sa__qiezhan2"] = "霜刃偃皓月,青龙啸野,竖子可识关公?",
}
local xizhicai = General(extension, "sa_xizhicai", "wei", 3)
Fk:loadTranslationTable{
["sa_xizhicai"] = "戏志才",
["#sa_xizhicai"] = "负俗的天才",
["designer:sa_xizhicai"] = "訾灵",
["~sa_xizhicai"] = "有生之年图万世之疆,幸哉。",
}
local chuaichou = fk.CreateViewAsSkill{
name = "sa__chuaichou",
switch_skill_name = "sa__chuaichou",
pattern = "nullification,dismantlement,collateral,fire_attack",
prompt = function (self)
local name = Self:getMark("@sa__chuaichou")
if name == 0 then name = "nullification" end
local color = Self:getSwitchSkillState(self.name) == fk.SwitchYang and "black" or "red"
return "#sa__chuaichou:::"..color..":"..name
end,
card_filter = function(self, to_select, selected)
return #selected == 0 and Fk:getCardById(to_select).color ==
(Self:getSwitchSkillState(self.name) == fk.SwitchYang and Card.Black or Card.Red)
end,
before_use = function (self, player, use)
--防止自动切换阴阳状态
player.room:setPlayerMark(
player,
MarkEnum.SwithSkillPreName .. self.name,
player:getSwitchSkillState(self.name, true)
)
player:addSkillUseHistory(self.name)
end,
view_as = function(self, cards)
local name = Self:getMark("@sa__chuaichou")
if name == 0 then name = "nullification" end
if #cards ~= 1 then return nil end
local c = Fk:cloneCard(name)
c.skillName = self.name
c:addSubcard(cards[1])
return c
end,
enabled_at_play = function(self, player)
return true
end,
enabled_at_response = function (self, player, response)
if not response and Fk.currentResponsePattern then
local name = player:getMark("@sa__chuaichou")
if name == 0 then name = "nullification" end
return Exppattern:Parse(Fk.currentResponsePattern):matchExp(name)
end
end,
on_lose = function (self, player)
player.room:setPlayerMark(player, "@sa__chuaichou", 0)
end,
on_acquire = function (self, player)
player.room:setPlayerMark(player, "@sa__chuaichou", "nullification")
end,
}
local chuaichou_trigger = fk.CreateTriggerSkill{
name = "#sa__chuaichou_trigger",
mute = true,
events = {fk.RoundStart, fk.Damaged},
can_trigger = function(self, event, target, player, data)
if player:hasSkill(self) then
return event == fk.RoundStart or target == player
end
end,
on_cost = Util.TrueFunc,
on_use = function (self, event, target, player, data)
local room = player.room
local skillName = chuaichou.name
player:broadcastSkillInvoke(skillName)
room:notifySkillInvoked(player, skillName)
local name = player:getMark("@sa__chuaichou") or "nullification"
local names = player:getMark("sa__qingce_name")
if names == 0 or room:askForChoice(player, {"sa__chuaichou_c1", "sa__chuaichou_c2"}, skillName) == "sa__chuaichou_c2" then
room:shuffleDrawPile()
if not player:hasSkill(chuaichou, true) then return end
room:setPlayerMark(
player,
MarkEnum.SwithSkillPreName .. skillName,
player:getSwitchSkillState(skillName, true)
)
player:addSkillUseHistory(skillName)
else
local choice = room:askForChoice(player, names, skillName, "#sa__chuaichou-exchange:::"..name)
room:setPlayerMark(player, "@sa__chuaichou", choice)
for i, n in ipairs(names) do
if n == choice then
names[i] = name
break
end
end
room:setPlayerMark(player, "sa__qingce_name", names)
end
end,
}
chuaichou:addRelatedSkill(chuaichou_trigger)
xizhicai:addSkill(chuaichou)
Fk:loadTranslationTable{
["sa__chuaichou"] = "揣筹",
[":sa__chuaichou"] = "转机技,你可将①黑色②红色牌当【无懈可击】使用。轮次开始时或当你受到伤害后,你须抉择:1.将〖倾策〗的一个牌名与上句【】内的牌名互换;2.洗牌并转机。",
["@sa__chuaichou"] = "揣筹",
["#sa__chuaichou"] = "揣筹:将 %arg 牌当【%arg2】使用",
["#sa__chuaichou_trigger"] = "揣筹",
["sa__chuaichou_c1"] = "将〖倾策〗的1个牌名与〖揣筹〗的互换",
["sa__chuaichou_c2"] = "洗牌并转机",
["#sa__chuaichou-exchange"] = "揣筹:用【%arg】替换〖倾策〗的一个牌名",
["$sa__chuaichou1"] = "睚眦厌伤,敢逆上者,必教尔灰飞烟灭。",
["$sa__chuaichou2"] = "卫道护主,隆君威于天下,赤诚苍天可鉴。",
}
local qingce = fk.CreateActiveSkill{
name = "sa__qingce",
anim_type = "big",
card_num = 0,
target_num = 1,
prompt = function ()
local names = Self:getMark("sa__qingce_name")
if names == 0 then names = {"dismantlement", "collateral", "fire_attack"} end
return "#sa__qingce:::"..table.concat(names, ":")
end,
can_use = function(self, player)
return player:getMark("@@rfenghou_readying:::"..self.name) == 0
end,
card_filter = Util.FalseFunc,
target_filter = function(self, to_select, selected)
return #selected == 0 and to_select ~= Self.id
end,
on_use = function(self, room, effect)
local player = room:getPlayerById(effect.from)
local to = room:getPlayerById(effect.tos[1])
local names = player:getMark("sa__qingce_name")
if names == 0 then names = {"dismantlement", "collateral", "fire_attack"} end
for _, name in ipairs(names) do
if to.dead then break end
local use = U.askForUseVirtualCard(room, to, name, nil, self.name, nil, false, true, true, true)
if not use then
to:drawCards(2, self.name)
end
end
end,
on_lose = function (self, player)
player.room:setPlayerMark(player, "sa__qingce_name", 0)
end,
on_acquire = function (self, player)
player.room:setPlayerMark(player, "sa__qingce_name", {"dismantlement", "collateral", "fire_attack"})
end,
}
qingce.RfenghouReadySkill = true
xizhicai:addSkill(qingce)
Fk:loadTranslationTable{
["sa__qingce"] = "倾策",
[":sa__qingce"] = "蓄势技,出牌阶段,你可以令一名其他角色视为使用【过河拆桥】、【借刀杀人】、【火攻】,且其中没有合法目标导致不能被使用的牌改为令其摸两张牌。",
["#sa__qingce"] = "倾策:令一名其他角色使用【%arg】、【%arg2】、【%arg3】,每不能使用1张,其摸2张牌",
["@@rfenghou_readying:::sa__qingce"] = "倾策 蓄势中",
["$sa__qingce1"] = "此生既得在世之良主,何惜烛风之残躯。",
["$sa__qingce2"] = "济伊尹之云帆、效管仲之御力、成明公之霸业。",
}
return extension
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ssrzzy/sashiko.git
git@gitee.com:ssrzzy/sashiko.git
ssrzzy
sashiko
sashiko
master

搜索帮助