2 Star 1 Fork 1

墨樱/MahjongSoul

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
LOLex.lua 59.79 KB
一键复制 编辑 原始数据 按行查看 历史
墨樱 提交于 2024-11-15 19:52 . no message
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436
local extension = Package:new("LOLex")
extension.extensionName = "MahjongSoul"
Fk:loadTranslationTable {
["LOLex"] = "雀魂-模式专属",
["wxhl"] = "无限火力",
}
local H = require "packages/hegemony/util"
local U = require "packages/utility/utility"
local hainiuafu = General(extension, "wxhl__hainiuafu", "qun", 4)
hainiuafu.hidden = true
local sw_jiqiong = fk.CreateTriggerSkill {
name = "sw_jiqiong",
events = { fk.GameStart },
frequency = Skill.Compulsory,
anim_type = "offensive",
can_trigger = function(self, event, target, player, data)
return player:hasSkill(self.name) and player:usedSkillTimes(self.name, Player.HistoryGame) == 0
end,
on_use = function(self, event, target, player, data)
local room = player.room
for _, p in ipairs(room.alive_players) do
local x = 4 - p.maxHp
if p.maxHp < 4 and p.role ~= "lord" then
room:changeMaxHp(p, x)
end
room:recover { num = p.maxHp - p.hp, skillName = self.name, who = p, recoverBy = p }
local skills = {}
for _, s in ipairs(p.player_skills) do
if not (s.attached_equip or s.name[#s.name] == "&") then
table.insertIfNeed(skills, s.name)
table.removeOne(skills, "sw_huoli")
table.removeOne(skills, "sw_jiqiong")
end
end
if room.settings.gameMode == "mj_1v2_mode" and p.role == "lord" then
table.removeOne(skills, "mj_feiyang")
table.removeOne(skills, "mj_bahu")
end
if #skills > 0 then
room:handleAddLoseSkills(p, "-" .. table.concat(skills, "|-"), nil, true, false)
end
local cardIds = {}
for _, ids in pairs(p.special_cards) do
table.insertTable(cardIds, ids)
end
room:moveCards({
from = p.id,
ids = cardIds,
toArea = Card.DiscardPile,
moveReason = fk.ReasonPutIntoDiscardPile,
skillName = self.name,
})
p:throwAllMarks()
end
end,
}
-- local sw_jiqiong_tar = fk.CreateTriggerSkill {
-- name = "#sw_jiqiong_tar",
-- events = { fk.RoundEnd },
-- frequency = Skill.Compulsory,
-- anim_type = "offensive",
-- can_trigger = function(self, event, target, player, data)
-- return player:hasSkill(self.name)
-- end,
-- on_use = function(self, event, target, player, data)
-- local room = player.room
-- for _, p in ipairs(room.alive_players) do
-- local skills = {}
-- for _, s in ipairs(p.player_skills) do
-- if not (s.attached_equip or s.name[#s.name] == "&") then
-- table.insertIfNeed(skills, s.name)
-- table.removeOne(skills, "sw_jiqiong")
-- table.removeOne(skills, "sw_huoli&")
-- table.removeOne(skills, "sw_huoli")
-- end
-- end
-- if room.settings.gameMode == "mj_1v2_mode" and p.role == "lord" then
-- table.removeOne(skills, "mj_feiyang")
-- table.removeOne(skills, "mj_bahu")
-- end
-- if #skills > 0 then
-- room:handleAddLoseSkills(p, "-" .. table.concat(skills, "|-"), nil, true, false)
-- end
-- local cardIds = {}
-- for _, ids in pairs(p.special_cards) do
-- table.insertTable(cardIds, ids)
-- end
-- room:moveCards({
-- from = p.id,
-- ids = cardIds,
-- toArea = Card.DiscardPile,
-- moveReason = fk.ReasonPutIntoDiscardPile,
-- skillName = self.name,
-- })
-- p:throwAllMarks()
-- end
-- end,
-- }
local sw_jiqiong_target = fk.CreateTriggerSkill {
name = "#sw_jiqiong_target",
refresh_events = { fk.GameStart, fk.EventAcquireSkill, fk.EventLoseSkill, fk.Deathed },
can_refresh = function(self, event, target, player, data)
if event == fk.GameStart then
return player:hasSkill(self.name, true)
elseif event == fk.EventAcquireSkill or event == fk.EventLoseSkill then
return data == self and
not table.find(player.room:getOtherPlayers(player), function(p) return p:hasSkill("sw_huoli", true) end)
else
return target == player and player:hasSkill(self.name, true, true) and
not table.find(player.room:getOtherPlayers(player), function(p) return p:hasSkill("sw_huoli", true) end)
end
end,
on_refresh = function(self, event, target, player, data)
local room = player.room
if event == fk.GameStart or event == fk.EventAcquireSkill then
if player:hasSkill(self.name, true) then
for _, p in ipairs(room:getOtherPlayers(player)) do
room:handleAddLoseSkills(p, "sw_huoli&", nil, false, true)
end
end
elseif event == fk.EventLoseSkill or event == fk.Deathed then
for _, p in ipairs(room:getOtherPlayers(player)) do
room:handleAddLoseSkills(p, "-sw_huoli&", nil, false, true)
end
end
end,
}
-- sw_jiqiong:addRelatedSkill(sw_jiqiong_tar)
sw_jiqiong:addRelatedSkill(sw_jiqiong_target)
hainiuafu:addSkill(sw_jiqiong)
Fk:loadTranslationTable {
["sw_jiqiong"] = "技穷",
["#sw_jiqiong_tar"] = "技穷",
[":sw_jiqiong"] = "锁定技,游戏开始,你令所有角色将体力调整至3点,然后失去所有技能;每轮开始时,所有角色随机获得两个技能;每轮结束时,所有角色失去本轮获得的技能",
}
local sw_huoli_acit = fk.CreateTriggerSkill {
name = "sw_huoli&",
frequency = Skill.Compulsory,
mute = true,
events = { fk.RoundStart },
can_trigger = function(self, event, target, player, data)
return player:hasSkill(self.name)
end,
on_use = function(self, event, target, player, data)
local room = player.room
if player.room:getTag("RoundCount") == 1 then
local skills = {}
for _, general in ipairs(Fk:getAllGenerals()) do
for _, skill in ipairs(general.skills) do
local str = Fk:translate(":" .. skill.name)
if not player:hasSkill(skill) and string.find(str, "锁定技") and not string.find(str, "宗族技") and not string.find(str, "觉醒技") and not string.find(str, "体力上限") and not string.find(str, "游戏开始时") and not string.find(str, "使命技") and not string.find(str, "蓄力技") and not string.find(str, "灵能") and not string.find(str, "限定技") and not string.find(str, "主公技") then
table.insertIfNeed(skills, skill.name)
end
end
end
if #skills > 0 then
local skill = table.random(skills, 1)
local skillss = table.concat(skill, "|")
room:handleAddLoseSkills(player, skillss, nil, true, false)
end
local skills2 = {}
for _, general in ipairs(Fk:getAllGenerals()) do
for _, skill2 in ipairs(general.skills) do
local str = Fk:translate(":" .. skill2.name)
if not player:hasSkill(skill2) and string.find(str, "每回合限一次") and not string.find(str, "宗族技") and not string.find(str, "觉醒技") and not string.find(str, "体力上限") and not string.find(str, "游戏开始时") and not string.find(str, "使命技") and not string.find(str, "蓄力技") and not string.find(str, "灵能") and not string.find(str, "限定技") and not string.find(str, "主公技") then
table.insertIfNeed(skills2, skill2.name)
end
end
end
if #skills2 > 0 then
local skill2 = table.random(skills2, 1)
local skillss2 = table.concat(skill2, "|")
room:handleAddLoseSkills(player, skillss2, nil, true, false)
end
elseif player.room:getTag("RoundCount") == 2 or player.room:getTag("RoundCount") == 3 then
local skills = {}
for _, general in ipairs(Fk:getAllGenerals()) do
for _, skill in ipairs(general.skills) do
local str = Fk:translate(":" .. skill.name)
if not player:hasSkill(skill) and string.find(str, "出牌阶段限") and not string.find(str, "宗族技") and not string.find(str, "觉醒技") and not string.find(str, "体力上限") and not string.find(str, "游戏开始时") and not string.find(str, "使命技") and not string.find(str, "蓄力技") and not string.find(str, "灵能") and not string.find(str, "限定技") and not string.find(str, "主公技") then
table.insertIfNeed(skills, skill.name)
end
end
end
if #skills > 0 then
local skill = table.random(skills, 1)
local skillss = table.concat(skill, "|")
room:handleAddLoseSkills(player, skillss, nil, true, false)
end
elseif player.room:getTag("RoundCount") == 4 then
local skills = {}
for _, general in ipairs(Fk:getAllGenerals()) do
for _, skill in ipairs(general.skills) do
local str = Fk:translate(":" .. skill.name)
if not player:hasSkill(skill) and string.find(str, "限定技") and not string.find(str, "宗族技") and not string.find(str, "觉醒技") and not string.find(str, "体力上限") and not string.find(str, "游戏开始时") and not string.find(str, "使命技") and not string.find(str, "蓄力技") and not string.find(str, "灵能") and not string.find(str, "主公技") then
table.insertIfNeed(skills, skill.name)
end
end
end
if #skills > 0 then
local skill = table.random(skills, 1)
local skillss = table.concat(skill, "|")
room:handleAddLoseSkills(player, skillss, nil, true, false)
end
elseif player.room:getTag("RoundCount") > 4 then
local skills = {}
for _, general in ipairs(Fk:getAllGenerals()) do
for _, skill in ipairs(general.skills) do
local str = Fk:translate(":" .. skill.name)
if not player:hasSkill(skill) and not string.find(str, "觉醒技") and not string.find(str, "宗族技") and not string.find(str, "体力上限") and not string.find(str, "游戏开始时") and not string.find(str, "使命技") and not string.find(str, "蓄力技") and not string.find(str, "灵能") and not string.find(str, "限定技") and not string.find(str, "主公技") then
table.insertIfNeed(skills, skill.name)
end
end
end
if #skills > 0 then
local skill = table.random(skills, 1)
local skillss = table.concat(skill, "|")
room:handleAddLoseSkills(player, skillss, nil, true, false)
end
end
end
}
local sw_huoli = fk.CreateTriggerSkill {
name = "sw_huoli",
frequency = Skill.Compulsory,
mute = true,
events = { fk.RoundStart },
can_trigger = function(self, event, target, player, data)
return player:hasSkill(self.name)
end,
on_use = function(self, event, target, player, data)
local room = player.room
if player.room:getTag("RoundCount") == 1 then
local skills = {}
for _, general in ipairs(Fk:getAllGenerals()) do
for _, skill in ipairs(general.skills) do
local str = Fk:translate(":" .. skill.name)
if not player:hasSkill(skill) and string.find(str, "锁定技") and not string.find(str, "宗族技") and not string.find(str, "觉醒技") and not string.find(str, "体力上限") and not string.find(str, "游戏开始时") and not string.find(str, "使命技") and not string.find(str, "蓄力技") and not string.find(str, "灵能") and not string.find(str, "限定技") and not string.find(str, "主公技") then
table.insertIfNeed(skills, skill.name)
end
end
end
if #skills > 0 then
local skill = table.random(skills, 1)
local skillss = table.concat(skill, "|")
room:handleAddLoseSkills(player, skillss, nil, true, false)
end
local skills2 = {}
for _, general in ipairs(Fk:getAllGenerals()) do
for _, skill2 in ipairs(general.skills) do
local str = Fk:translate(":" .. skill2.name)
if not player:hasSkill(skill2) and string.find(str, "每回合限一次") and not string.find(str, "宗族技") and not string.find(str, "觉醒技") and not string.find(str, "体力上限") and not string.find(str, "游戏开始时") and not string.find(str, "使命技") and not string.find(str, "蓄力技") and not string.find(str, "灵能") and not string.find(str, "限定技") and not string.find(str, "主公技") then
table.insertIfNeed(skills2, skill2.name)
end
end
end
if #skills2 > 0 then
local skill2 = table.random(skills2, 1)
local skillss2 = table.concat(skill2, "|")
room:handleAddLoseSkills(player, skillss2, nil, true, false)
end
elseif player.room:getTag("RoundCount") == 2 or player.room:getTag("RoundCount") == 3 then
local skills = {}
for _, general in ipairs(Fk:getAllGenerals()) do
for _, skill in ipairs(general.skills) do
local str = Fk:translate(":" .. skill.name)
if not player:hasSkill(skill) and string.find(str, "出牌阶段限") and not string.find(str, "宗族技") and not string.find(str, "觉醒技") and not string.find(str, "体力上限") and not string.find(str, "游戏开始时") and not string.find(str, "使命技") and not string.find(str, "蓄力技") and not string.find(str, "灵能") and not string.find(str, "限定技") and not string.find(str, "主公技") then
table.insertIfNeed(skills, skill.name)
end
end
end
if #skills > 0 then
local skill = table.random(skills, 1)
local skillss = table.concat(skill, "|")
room:handleAddLoseSkills(player, skillss, nil, true, false)
end
elseif player.room:getTag("RoundCount") == 4 then
local skills = {}
for _, general in ipairs(Fk:getAllGenerals()) do
for _, skill in ipairs(general.skills) do
local str = Fk:translate(":" .. skill.name)
if not player:hasSkill(skill) and string.find(str, "限定技") and not string.find(str, "宗族技") and not string.find(str, "觉醒技") and not string.find(str, "体力上限") and not string.find(str, "游戏开始时") and not string.find(str, "使命技") and not string.find(str, "蓄力技") and not string.find(str, "灵能") and not string.find(str, "主公技") then
table.insertIfNeed(skills, skill.name)
end
end
end
if #skills > 0 then
local skill = table.random(skills, 1)
local skillss = table.concat(skill, "|")
room:handleAddLoseSkills(player, skillss, nil, true, false)
end
elseif player.room:getTag("RoundCount") > 4 then
local skills = {}
for _, general in ipairs(Fk:getAllGenerals()) do
for _, skill in ipairs(general.skills) do
local str = Fk:translate(":" .. skill.name)
if not player:hasSkill(skill) and not string.find(str, "觉醒技") and not string.find(str, "宗族技") and not string.find(str, "体力上限") and not string.find(str, "游戏开始时") and not string.find(str, "使命技") and not string.find(str, "蓄力技") and not string.find(str, "灵能") and not string.find(str, "限定技") and not string.find(str, "主公技") then
table.insertIfNeed(skills, skill.name)
end
end
end
if #skills > 0 then
local skill = table.random(skills, 1)
local skillss = table.concat(skill, "|")
room:handleAddLoseSkills(player, skillss, nil, true, false)
end
end
end
}
Fk:loadTranslationTable {
["sw_huoli"] = "火力",
[":sw_huoli"] = "锁定技,按轮次随机获得技能;首轮开始时,获得一个锁定技和一个每回合限一次的技能;第二/三个轮开始时,获得一个出牌阶段可用的技能;第四轮开始时,获得一个限定技,第五轮后,每轮随机获得一个常规技能",
["sw_huoli&"] = "火力",
[":sw_huoli&"] = "锁定技,按轮次随机获得技能;首轮开始时,获得一个锁定技和一个每回合限一次的技能;第二/三个轮开始时,获得一个出牌阶段可用的技能;第四轮开始时,获得一个限定技,第五轮后,每轮随机获得一个常规技能",
}
hainiuafu:addSkill(sw_huoli)
Fk:addSkill(sw_huoli_acit)
Fk:loadTranslationTable {
["wxhl__hainiuafu"] = "阿福",
}
local sss = fk.CreateTargetModSkill { --场上受伤角色大于2时,出牌阶段额外一张杀
name = "sss",
residue_func = function(self, player, skill, scope, card)
local n = 0
for _, p in ipairs(Fk:currentRoom().alive_players) do
if p:isWounded() then
n = n + 1
end
end
if n > 2 and player:hasSkill(self.name) and card.trueName == "slash" and scope == Player.HistoryPhase then
return 1
else
return 0
end
end
}
-- local daqiao = General(extension, "sww__daqiao", "wu", 3, 3, General.Female)
-- local sw_guose = fk.CreateViewAsSkill {
-- name = "sw_guose",
-- anim_type = "control",
-- pattern = "indulgence",
-- card_filter = function(self, to_select, selected)
-- return #selected == 0 and Fk:getCardById(to_select).color == Card.Red
-- end,
-- view_as = function(self, cards)
-- if #cards ~= 1 then return nil end
-- local c = Fk:cloneCard("indulgence")
-- c.skillName = self.name
-- c:addSubcard(cards[1])
-- return c
-- end,
-- }
-- local sw_guose_trigger = fk.CreateTriggerSkill {
-- name = "#sw_guose_trigger",
-- events = { fk.CardUseFinished, fk.EventPhaseStart },
-- mute = true,
-- can_trigger = function(self, event, target, player, data)
-- if event == fk.CardUseFinished then
-- if player:hasSkill(self) and target == player and table.contains(data.card.skillNames, "sw_guose") then
-- for _, pid in ipairs(TargetGroup:getRealTargets(data.tos)) do
-- local p = player.room:getPlayerById(pid)
-- if not p.dead then
-- return true
-- end
-- end
-- end
-- else
-- return player:hasSkill(self) and target ~= player and target.phase == Player.Judge and
-- #target:getCardIds("j") > 0 and #target:getCardIds("h") > 1
-- end
-- end,
-- on_cost = function(self, event, target, player, data)
-- if event == fk.CardUseFinished then return true end
-- local cards = player.room:askForCard(target, 2, 2, false, self.name, true, ".", "#sw_guose-ask:" .. player.id)
-- if #cards == 2 then
-- self.cost_data = cards
-- return true
-- end
-- end,
-- on_use = function(self, event, target, player, data)
-- local room = player.room
-- if event == fk.CardUseFinished then
-- for _, pid in ipairs(TargetGroup:getRealTargets(data.tos)) do
-- local p = room:getPlayerById(pid)
-- if not p.dead then
-- if data.card.suit == Card.Heart and p:isWounded() then
-- room:recover { num = 1, skillName = sw_guose.name, who = p, recoverBy = player }
-- elseif data.card.suit == Card.Diamond then
-- p:drawCards(2, sw_guose.name)
-- end
-- end
-- end
-- else
-- room:notifySkillInvoked(player, sw_guose.name)
-- player:broadcastSkillInvoke(sw_guose.name)
-- local dummy = Fk:cloneCard("dilu")
-- dummy:addSubcards(self.cost_data)
-- room:obtainCard(player, dummy, false, fk.ReasonGive)
-- if target.dead or #target:getCardIds("j") == 0 then return end
-- local card = room:askForCardChosen(target, target, "j", self.name)
-- room:obtainCard(target, card, true, fk.ReasonPrey)
-- end
-- end,
-- }
-- sw_guose:addRelatedSkill(sw_guose_trigger)
-- daqiao:addSkill(sw_guose)
-- local sw_wanrong = fk.CreateTriggerSkill {
-- name = "sw_wanrong",
-- anim_type = "defensive",
-- events = { fk.TargetConfirming },
-- can_trigger = function(self, event, target, player, data)
-- return target == player and player:hasSkill(self) and data.card.trueName == "slash" and not player:isNude()
-- end,
-- on_cost = function(self, event, target, player, data)
-- local room = player.room
-- local targets = {}
-- local from = room:getPlayerById(data.from)
-- local duel = Fk:cloneCard("duel")
-- for _, p in ipairs(room:getOtherPlayers(player)) do
-- if U.canTransferTarget(p, data) then
-- table.insert(targets, p.id)
-- end
-- end
-- if #targets == 0 then return false end
-- local tos, cid = room:askForChooseCardAndPlayers(player, targets, 1, 1, nil, "#sw_wanrong", self.name, true)
-- if #tos > 0 then
-- self.cost_data = { tos[1], cid }
-- return true
-- end
-- end,
-- on_use = function(self, event, target, player, data)
-- local room = player.room
-- local to = room:getPlayerById(self.cost_data[1])
-- room:obtainCard(to, self.cost_data[2], false, fk.ReasonGive)
-- AimGroup:addTargets(room, data, { to.id })
-- AimGroup:cancelTarget(data, player.id)
-- data.extra_data = data.extra_data or {}
-- data.extra_data.sw_wanrong_dueler = data.extra_data.sw_wanrong_dueler or {}
-- table.insertIfNeed(data.extra_data.sw_wanrong_dueler, to.id)
-- return true
-- end,
-- }
-- local sw_wanrong_delay = fk.CreateTriggerSkill {
-- name = "#sw_wanrong_delay",
-- mute = true,
-- events = { fk.CardUseFinished },
-- can_trigger = function(self, event, target, player, data)
-- if not player.dead and data.extra_data and data.extra_data.sw_wanrong_dueler and table.contains(data.extra_data.sw_wanrong_dueler, player.id) then
-- local room = player.room
-- local from = room:getPlayerById(data.from)
-- return not from.dead and U.canUseCardTo(room, player, from, Fk:cloneCard("duel"))
-- end
-- end,
-- on_cost = function(self, event, target, player, data)
-- local room = player.room
-- return room:askForSkillInvoke(player, "sw_wanrong", nil, "#sw_wanrong-duel:" .. data.from)
-- end,
-- on_use = function(self, event, target, player, data)
-- local room = player.room
-- local from = room:getPlayerById(data.from)
-- room:useVirtualCard("duel", nil, player, from, "sw_wanrong")
-- end,
-- }
-- sw_wanrong:addRelatedSkill(sw_wanrong_delay)
-- daqiao:addSkill(sw_wanrong)
-- local sw_liuli = fk.CreateTriggerSkill {
-- name = "sw_liuli",
-- events = { fk.TurnEnd },
-- anim_type = "control",
-- frequency = Skill.Limited,
-- can_trigger = function(self, event, target, player, data)
-- return player:hasSkill(self) and target:getNextAlive() == player and
-- player:usedSkillTimes(self.name, Player.HistoryGame) == 0 and #player.room.alive_players > 2
-- end,
-- on_cost = function(self, event, target, player, data)
-- local room = player.room
-- local players = table.simpleClone(room:getOtherPlayers(player))
-- table.removeOne(players, target)
-- local tos = room:askForChoosePlayers(player, table.map(players, Util.IdMapper), 1, 1, "#sw_liuli", self.name,
-- true)
-- if #tos > 0 then
-- self.cost_data = tos[1]
-- return true
-- end
-- end,
-- on_use = function(self, event, target, player, data)
-- local room = player.room
-- local to = room:getPlayerById(self.cost_data)
-- to:drawCards(3, self.name)
-- room:swapSeat(player, to)
-- end,
-- }
-- daqiao:addSkill(sw_liuli)
-- Fk:loadTranslationTable {
-- ["sww__daqiao"] = "大乔",
-- ["sw_guose"] = "国色",
-- [":sw_guose"] = "①你可以将一张红色牌当【乐不思蜀】使用,若为♥,令目标回复一点体力;若为♦,目标摸两张牌。②一名其他角色判定阶段开始时,若其判定区有牌,其可以将两张手牌交给你,然后获得判定区一张牌。",
-- ["#sw_guose_trigger"] = "国色",
-- ["#sw_guose-ask"] = "国色:你可以将两张手牌交给 %src,获得你判定区一张牌",
-- ["sw_wanrong"] = "婉容",
-- [":sw_wanrong"] = "每当你成为【杀】的目标时,你可以将一张牌交给一名其他角色(需为合法目标),并将此【杀】目标转移给其。此【杀】结算结束后,该角色可以视为对此【杀】使用者使用一张【决斗】。",
-- ["#sw_wanrong"] = "婉容:将一张牌交给一名其他角色,将此【杀】目标转移给其",
-- ["#sw_wanrong_delay"] = "婉容",
-- ["#sw_wanrong-duel"] = "婉容:你可视为对 %src 使用【决斗】",
-- ["sw_liuli"] = "流离",
-- [":sw_liuli"] = "限定技,你上家的回合结束时,若你已受伤,你可以与除你上家外的一名其他角色交换座位,然后其摸三张牌。",
-- ["#sw_liuli"] = "流离:与一名其他角色交换座位,其摸三张牌",
-- ["$sw_guose1"] = "溪边坐流水,与君共清欢。",
-- ["$sw_guose2"] = "衣带逐水去,绿川盼君留。",
-- ["$sw_wanrong1"] = "吾夫君在此,汝胆敢如此放肆?",
-- ["$sw_wanrong2"] = "邪佞诈妄之人,断无可容之处!",
-- ["$sw_liuli1"] = "此生逢伯符,足以慰平生。",
-- ["$sw_liuli2"] = "所幸遇郎君,流离得良人。",
-- ["~sww__daqiao"] = "忆君如流水,日夜无歇时。",
-- }
Fk:addPoxiMethod {
name = "joy__yanjiao_cutten",
card_filter = function(to_select, selected, data, extra_data) -- 可以接受额外的数据extra_data,从相关技能中传回
local n = Fk:getCardById(to_select).number
for _, id in ipairs(selected) do
n = n + Fk:getCardById(id).number
end
return n <= extra_data
end,
feasible = function(selected)
return #selected > 0
end,
prompt = function()
return Fk:translate("#joy__yanjiao-choose")
end
}
local joy__yanjiao = fk.CreateActiveSkill { --poxi框备用技能存根,模板
name = "joy__yanjiao",
anim_type = "control",
card_num = 0,
target_num = 1,
target_filter = function(self, to_select, selected)
return #selected < 1
end,
can_use = function(self, player)
return player:usedSkillTimes(self.name, Player.HistoryTurn) == 0
end,
on_use = function(self, room, effect)
local player = room:getPlayerById(effect.from)
local target = room:getPlayerById(effect.tos[1])
local ids = room:getNCards(3 + player:getMark("@joy__yanjiao"), "bottom")
room:moveCards({
ids = ids,
toArea = Card.Processing,
moveReason = fk.ReasonPut,
})
local number = (Fk:getCardById(ids[1]).number + Fk:getCardById(ids[2]).number + Fk:getCardById(ids[3]).number) //
2
local get = room:askForPoxi(target, "joy__yanjiao_cutten", {
{ self.name, ids },
}, number, true)
if #get > 0 then
local dummy = Fk:cloneCard("dilu")
dummy:addSubcards(get)
room:obtainCard(target.id, dummy, true, fk.ReasonPrey)
local n = 0
for _, id in ipairs(get) do
if n < number then
n = n + Fk:getCardById(id).number
end
end
end
ids = table.filter(ids, function(id) return room:getCardArea(id) == Card.Processing end)
if #ids > 0 then
if target == player then
room:moveCards({
ids = ids,
toArea = Card.DiscardPile,
moveReason = fk.ReasonPutIntoDiscardPile,
})
else
local dummy = Fk:cloneCard("dilu")
dummy:addSubcards(ids)
room:obtainCard(player.id, dummy, true, fk.ReasonPrey)
end
end
end,
}
local attacktest = fk.CreateAttackRangeSkill { --攻击距离锁定为1的模板
name = "attacktest",
correct_func = function(self, from, to)
if from:hasSkill(self) then
if from:getMark("dda-turn") > 0 then
return -from:getMark("dda-turn")
elseif from:getMark("aad-turn") > 0 then
return from:getMark("aad-turn")
end
end
end,
}
local attackwww = fk.CreateTriggerSkill { --同上,附加效果,用于设置实际标记,标记为距离-1
name = "#attackwww",
mute = true,
refresh_events = { fk.EventPhaseStart, fk.CardUseFinished },
can_refresh = function(self, event, target, player, data)
if player:hasSkill(self) and target == player then
if event == fk.EventPhaseStart then
return player.phase == Player.Start and player:getAttackRange() ~= 1
else
return data.card.sub_type == Card.SubtypeWeapon
end
end
end,
on_refresh = function(self, event, target, player, data)
local room = player.room
if event == fk.EventPhaseStart then
if player:getAttackRange() > 1 then
room:setPlayerMark(player, "dda-turn", player:getAttackRange() - 1)
elseif player:getAttackRange() == 0 then
room:setPlayerMark(player, "aad-turn", 1)
end
else
room:setPlayerMark(player, "dda-turn", 0)
room:setPlayerMark(player, "aad-turn", 0)
if player:getAttackRange() > 1 then
room:setPlayerMark(player, "dda-turn", player:getAttackRange() - 1)
elseif player:getAttackRange() == 0 then
room:setPlayerMark(player, "aad-turn", 1)
end
end
end,
}
Fk:loadTranslationTable {
["attacktest"] = "攻击距离锁定为1",
["#attackwww"] = "攻击距离锁定为1",
[":attacktest"] = "攻击距离锁定为1",
}
local sw_douxun = fk.CreateTriggerSkill { -- 指定目标后的判定加伤模板
name = "sw_douxun",
anim_type = "offensive",
events = { fk.TargetSpecified },
can_trigger = function(self, event, target, player, data)
return target == player and player:hasSkill(self) and data.card.trueName == "slash"
end,
on_cost = function(self, event, target, player, data)
return player.room:askForSkillInvoke(player, self.name, nil, "#sw_douxun-invoke::" .. data.to)
end,
on_use = function(self, event, target, player, data)
local room = player.room
local judge = {
who = player,
reason = self.name,
pattern = ".|.|spade,club",
}
room:judge(judge)
if judge.card.color == Card.Black then
data.additionalDamage = (data.additionalDamage or 0) + 1
data.disresponsive = true
end
end,
}
Fk:loadTranslationTable {
["sw_douxun"] = "斗巡",
["#sw_douxun-invoke"] = "斗巡:是否进行判定,若为黑色,%dest 不能响应此牌且对其造成的伤害+1",
[":sw_douxun"] = "当你使用【杀】指定目标后,你进项判定,若为黑色,此【杀】伤害+1且不可响应",
}
local fenpai = fk.CreateActiveSkill { --主动给其他人牌模板,可用于部分技能
name = "fenpai",
anim_type = "control",
card_num = 0,
min_target_num = 1,
max_target_num = 3,
can_use = function(self, player)
return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
end,
card_filter = function(self, to_select, selected)
return false
end,
target_filter = function(self, to_select, selected)
return #selected < 3 and to_select ~= Self.id
end,
on_use = function(self, room, effect)
local player = room:getPlayerById(effect.from)
local targets = table.clone(effect.tos)
room:sortPlayersByAction(targets)
for _, id in ipairs(targets) do
local target = room:getPlayerById(id)
if not player.dead then
local card = room:askForCard(player, 1, 1, true, self.name, false, ".", "#fenpai-give:" .. target.id)
local dummy = Fk:cloneCard("dilu")
dummy:addSubcards(card)
room:obtainCard(target, dummy, false, fk.ReasonGive)
end
end
end,
}
Fk:loadTranslationTable {
["fenpai"] = "给牌",
["#fenpai-give"] = "给牌:请选择要交给 %src 的一张牌",
[":fenpai"] = "出牌阶段限一次,你选择三名其他角色,然后你交给这些角色各一张牌。",
}
--杀指定目标后判定,黑色横置并造成雷电伤害
local jiaoxue = fk.CreateTriggerSkill {
name = "jiaoxue",
anim_type = "offensive",
frequency = Skill.Compulsory,
events = { fk.TargetSpecified },
can_trigger = function(self, event, target, player, data)
return target == player and player:hasSkill(self) and
data.card.name == "thunder__slash" --判断是否为雷杀,应用name而非trueName
end,
on_use = function(self, event, target, player, data)
local room = player.room
local judge = {
who = player,
reason = self.name,
pattern = ".|.|spade,club",
}
room:judge(judge)
if judge.card.color == Card.Black then
---------------------------------------
local targets = table.map(table.filter(room:getAlivePlayers(), function(p)
return p ~= player
end), function(p) return p.id end)
-------------------------------此区间用于筛选符合要求的角色,room:getAlivePlayers()代表当前存活的所有玩家,return p ~= player 用于返回可选择的目标
if #targets == 0 then return false end -----若没有符合的目标,则返回false,否则继续往下执行
--------------------------------
local tos = room:askForChoosePlayers(player, targets, 1, 2, "#jiaoxue-askchosen", self.name, false)
for _, p in ipairs(tos) do
local id = room:getPlayerById(p)
if not id.chained then
id:setChainState(true)
end
end
---------------------------------此区间用于将targets中已经筛选出的角色,从这些角色中选择,然后遍历选择出来的每个角色,如果没有横置,则横置
-- local tar = room:askForChoosePlayers(player, tos, 1, 1, "#jiaoxue-askdamage", self.name, false)[1]
-- local tgt = room:getPlayerById(tar)
-- if not tgt.dead then
-- room:damage {
-- from = player,
-- to = tgt,
-- damage = 1,
-- skillName = self.name,
-- damageType = fk.ThunderDamage }
-- end
----------------------------------------------
for _, p in ipairs(room:getAlivePlayers()) do
if p.chained then
if not p.dead then
room:damage {
from = player,
to = p,
damage = 1,
skillName = self.name,
damageType = fk.ThunderDamage }
end
end
end
-------------------------------------此区间用于筛选房间内所有存活的角色,若目标符合横置且没有死亡,对这些角色造成一点雷电伤害
end
data.additionalDamage = (data.additionalDamage or 0) + 1
---------------------------伤害+1
local cards = table.filter(player:getCardIds("h"),
function(id) return Fk:getCardById(id).type ~= Card.TypeBasic end) ------------判断手牌中是否有不是基本牌的牌
if #cards > 0 or #player:getCardIds(player.Equip) > 0 then -------同时判断cards是否大于0或装备区是否有牌,毕竟装备也是非基本,若大于0,继续往下执行
room:askForDiscard(player, 1, 1, true, self.name, false, ".|.|.|.|.|trick,equip", "#jiaoxue-choosediscard") ----------询问玩家弃置其中一张,若要
end
end,
}
Fk:loadTranslationTable {
["jiaoxue"] = "教学",
["#jiaoxue-askchosen"] = "教学:请选择要横置的至多两名角色",
["#jiaoxue-choosediscard"] = "教学:弃置一张非基本牌",
[":jiaoxue"] = "锁定技:当你使用雷【杀】指定目标后,你进行一次判定:若为黑色,此【杀】造成的伤害+1,你选择至多两名角色横置,并对所有横置角色各造成一点雷电伤害,结算完成后弃置一张非基本牌",
}
local mingmen = fk.CreateTriggerSkill {
name = "mingmen",
anim_type = "defensive",
frequency = Skill.Compulsory,
events = { fk.DrawNCards },
on_use = function(self, event, target, player, data)
data.n = data.n + 1
end,
}
local mingmen_targetmod = fk.CreateTargetModSkill {
name = "#mingmen_targetmod",
residue_func = function(self, player, skill, scope, card)
if card and player:hasSkill("mingmen") and card.trueName == "slash" and scope == Player.HistoryPhase then
return #player:getPile("mingmen_Pile")
end
end,
}
local mingmen_targetmod1 = fk.CreateTargetModSkill {
name = "#mingmen_targetmod1",
residue_func = function(self, player, skill, scope, card)
if card and player:hasSkill("mingmen") and card.trueName == "slash" and scope == Player.HistoryPhase then
return -1
end
end,
}
local sw_sifeng = fk.CreateTriggerSkill {
name = "sw_sifeng",
events = { fk.EventPhaseStart, fk.CardUsing },
can_trigger = function(self, event, target, player, data)
if (target ~= player or not player:hasSkill(self.name)) then return false end
if event == fk.EventPhaseStart then
return (player.phase == Player.Start) and not player:isNude()
else
local suitsRecorded = type(player:getMark("@mingmen_Pile-putt")) == "table" and
player:getMark("@mingmen_Pile-putt") or {}
local mingmen_Pile = table.map(player:getPile("mingmen_Pile"),
function(cid) return Fk:getCardById(cid):getSuitString() end)
local suit = data.card:getSuitString()
return not table.contains(suitsRecorded, "log_" .. suit) and table.contains(mingmen_Pile, suit) and
player:getMark("sifeng_c-turn") < 2
end
end,
on_cost = function(self, event, target, player, data)
if event == fk.EventPhaseStart then
player.room:drawCards(player, 1, self.name)
local ids = player.room:askForCard(player, 1, 2, true, self.name, true, nil, "#mingmen_Pile-power")
if #ids > 0 then
self.cost_data = ids
return true
end
else
return true
end
end,
on_use = function(self, event, target, player, data)
if event == fk.EventPhaseStart then
player:addToPile("mingmen_Pile", self.cost_data, true, self.name)
else
player:drawCards(1, self.name)
player.room:addPlayerMark(player, "sifeng_c-turn", 1)
end
end,
}
local sw_huangpai = fk.CreateTriggerSkill {
name = "sw_huangpai",
frequency = Skill.Wake,
events = { fk.EventPhaseStart },
can_trigger = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name) and
player.phase == Player.Finish and
player:usedSkillTimes(self.name, Player.HistoryGame) == 0
end,
can_wake = function(self, event, target, player, data)
return #player:getPile("mingmen_Pile") > 3
end,
on_use = function(self, event, target, player, data)
local room = player.room
room:changeMaxHp(player, 1)
local choices = { "draw3" }
if player:isWounded() then
table.insert(choices, "recover")
end
local choice = room:askForChoice(player, choices, self.name)
if choice == "draw3" then
player:drawCards(2)
else
room:recover({
who = player,
num = 1,
recoverBy = player,
skillName = self.name
})
end
room:handleAddLoseSkills(player, "liuman", nil, true, false)
room:handleAddLoseSkills(player, "-mingmen", nil, true, false)
room:handleAddLoseSkills(player, "-sw_sifeng", nil, true, false)
if #player:getPile("mingmen_Pile") > 0 then
local dummy = Fk:cloneCard("dilu")
dummy:addSubcards(player:getPile("mingmen_Pile"))
room:obtainCard(player, dummy, true, fk.ReasonJustMove)
end
end,
}
local liuman = fk.CreateTriggerSkill {
name = "liuman",
anim_type = "offensive",
events = { fk.DamageCaused },
can_trigger = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name) and data.card and
data.card.is_damage_card
end,
on_use = function(self, event, target, player, data)
local room = player.room
room:killPlayer({ who = data.to.id })
end,
}
mingmen:addRelatedSkill(mingmen_targetmod)
mingmen:addRelatedSkill(mingmen_targetmod1)
-- local sw_rende = fk.CreateActiveSkill {
-- name = "sw_rende",
-- anim_type = "offensive",
-- card_num = 0,
-- target_num = 1,
-- prompt = "#sw_rende-active",
-- can_use = function(self, player)
-- return player:getHandcardNum() > 0
-- end,
-- card_filter = Util.FalseFunc,
-- target_filter = function(self, to_select, selected)
-- return #selected == 0 and to_select ~= Self.id and
-- Fk:currentRoom():getPlayerById(to_select):getMark("sw_rende-phase") == 0
-- end,
-- on_use = function(self, room, effect)
-- local player = room:getPlayerById(effect.from)
-- local target = room:getPlayerById(effect.tos[1])
-- room:setPlayerMark(target, "sw_rende-phase", 1)
-- player:drawCards(1, self.name)
-- local mark = player:getTableMark( "sw_rendeex-turn")
-- local cards
-- if #player:getCardIds(Player.Hand) > 2 then
-- cards = room:askForCard(player, 2, #player:getCardIds(Player.Hand), true, self.name, false, nil,
-- "#sw_rende-ask:" .. target.id)
-- elseif #player:getCardIds(Player.Hand) <= 2 then
-- cards = player:getCardIds(Player.Hand)
-- end
-- local dummy = Fk:cloneCard("dilu")
-- dummy:addSubcards(cards)
-- room:obtainCard(target, dummy, false, fk.ReasonGive)
-- local success, data = room:askForUseActiveSkill(player, "swrende_viewas", "#sw_rende-choice", true)
-- if success then
-- local ids = Fk.skills["swrende_viewas"]:viewAs(data.cards)
-- local use = {
-- from = player.id,
-- tos = table.map(data.targets, function(id) return { id } end),
-- card = ids,
-- extraUse = true,
-- }
-- room:useCard(use)
-- table.insert(mark, ids.trueName)
-- room:setPlayerMark(player, "sw_rendeex-turn", #mark > 0 and mark or 0)
-- end
-- end,
-- }
-- liubei:addSkill(sw_rende)
-- Fk:loadTranslationTable {
-- ["sw_rende"] = "仁德",
-- ["swrende_viewas"] = "仁德",
-- [":sw_rende"] = "出牌阶段每名角色限一次,若你有牌,你可以选择一名角色,摸一张牌并交给其至少两张牌,然后视为使用一张本回合未以此法使用过的基本牌",
-- ["#sw_rende-ask"] = "仁德:请交给 %src 至少两张牌",
-- ["#sw_rende-choice"] = "仁德:请选择要使用的基本牌",
-- }
-- local sw_zhangwu = fk.CreateTriggerSkill {
-- name = "sw_zhangwu",
-- anim_type = "defensive",
-- frequency = Skill.Compulsory,
-- events = { fk.CardUsing },
-- can_trigger = function(self, event, target, player, data)
-- if player:hasSkill(self) then
-- local events = player.room.logic:getEventsOfScope(GameEvent.UseCard, 999, function(e)
-- local use = e.data[1]
-- return use.from == player.id
-- end, Player.HistoryPhase)
-- return #events == player:getLostHp() and player:isWounded()
-- end
-- end,
-- on_use = function(self, event, target, player, data)
-- data.additionalEffect = 1
-- end,
-- }
-- local sw_zhangwu_trigger = fk.CreateTriggerSkill {
-- name = "#sw_zhangwu_trigger",
-- anim_type = "support",
-- frequency = Skill.Compulsory,
-- events = { fk.AfterDying },
-- can_trigger = function(self, event, target, player, data)
-- return player:isAlive() and player:hasSkill("sw_zhangwu") and
-- player:usedSkillTimes(self.name, Player.HistoryGame) == 0
-- end,
-- on_use = function(self, event, target, player, data)
-- local room = player.room
-- if player:getHandcardNum() < player:getLostHp() then
-- local x = player:getLostHp() - player:getHandcardNum()
-- player:drawCards(x, self.name)
-- end
-- room:handleAddLoseSkills(player, "-sw_zhangwu", nil)
-- room:handleAddLoseSkills(player, "jianhe", nil)
-- end,
-- }
-- sw_zhangwu:addRelatedSkill(sw_zhangwu_trigger)
-- liubei:addSkill(sw_zhangwu)
-- liubei:addRelatedSkill("jianhe")
-- Fk:loadTranslationTable {
-- ["sw_zhangwu"] = "章武",
-- ["#sw_zhangwu_trigger"] = "章武",
-- [":sw_zhangwu"] = "锁定技,你于回合内使用的第X张牌额外结算一次;当你首次脱离濒死状态时,失去该技能,获得〖剑合〗",
-- }
-- local sw_jijiang = fk.CreateActiveSkill {
-- name = "sw_jijiang$",
-- anim_type = "support",
-- card_num = 1,
-- target_num = 1,
-- can_use = function(self, player)
-- return not player:isKongcheng()
-- end,
-- card_filter = function(self, to_select, selected)
-- return #selected == 0 and Fk:getCardById(to_select).trueName == "slash"
-- end,
-- target_filter = function(self, to_select, selected)
-- return #selected == 0 and to_select ~= Self.id and Fk:currentRoom():getPlayerById(to_select).kingdom == Self.kingdom
-- end,
-- on_use = function(self, room, effect)
-- local target = room:getPlayerById(effect.tos[1])
-- table.forEach(effect.cards, function(cid)
-- room:setCardMark(Fk:getCardById(cid), "@@sw_jijiang", 1)
-- end)
-- room:obtainCard(target, effect.cards[1], false, fk.ReasonGive)
-- room:getPlayerById(effect.from):drawCards(1, self.name)
-- end,
-- }
-- local sw_jijiang_dlc = fk.CreateTriggerSkill {
-- name = "#sw_jijiang_dlc",
-- anim_type = "drawcard",
-- frequency = Skill.Compulsory,
-- mute = true,
-- events = { fk.Damage },
-- can_trigger = function(self, event, target, player, data)
-- return player:hasSkill(sw_jijiang) and data.card and table.find(Card:getIdList(data.card), function(id)
-- return Fk:getCardById(id):getMark("@@sw_jijiang") > 0
-- end)
-- end,
-- on_use = function(self, event, target, player, data)
-- player.room:setCardMark(data.card, "@@sw_jijiang", 0)
-- player:drawCards(1, self.name)
-- target:drawCards(1, self.name)
-- end,
-- }
-- sw_jijiang:addRelatedSkill(sw_jijiang_dlc)
-- liubei:addSkill(sw_jijiang)
-- Fk:loadTranslationTable {
-- ["sw_jijiang"] = "激将",
-- ["#sw_jijiang_dlc"] = "激将",
-- [":sw_jijiang"] = "主公技,出牌阶段,你可以交给势力与你相同的其他角色角色一张【杀】并摸一张牌;当以此法给出的【杀】造成伤害后,你与其各摸一张牌",
-- ["@@sw_jijiang"] = "激将",
-- }
-- local sw_duozheng = fk.CreateTriggerSkill {
-- name = "sw_duozheng",
-- events = { fk.GamePrepared },
-- priority = 10,
-- mute = true,
-- frequency = Skill.Compulsory,
-- can_trigger = function(self, event, target, player, data)
-- local room = player.room
-- return player:hasSkill(self) and player.role ~= "lord" and
-- (room.settings.gameMode == "aaa_role_mode" or room.settings.gameMode == "vanished_dragon" or room.settings.gameMode == "sfvanished_dragon")
-- end,
-- on_use = function(self, event, target, player, data)
-- local room = player.room
-- player:broadcastSkillInvoke(self.name)
-- room:changeMaxHp(player, 1)
-- room:recover({
-- who = player,
-- num = 1,
-- recoverBy = player,
-- skillName = self.name
-- })
-- local lord = table.find(room.alive_players, function(p) return p.role == "lord" end)
-- if lord then
-- if lord ~= player then
-- lord.role = "unknown"
-- room:broadcastProperty(lord, "role")
-- player.role = "lord"
-- lord.role = table.random({ "loyalist", "rebel", "renegade" })
-- room:notifyProperty(player, player, "role")
-- room:notifyProperty(lord, lord, "role")
-- room:broadcastProperty(player, "role")
-- end
-- local skills = {}
-- for _, skill_name in ipairs(Fk.generals[lord.general]:getSkillNameList(true)) do
-- local skill = Fk.skills[skill_name]
-- if skill.lordSkill then
-- table.insertIfNeed(skills, skill_name)
-- end
-- end
-- if #skills > 0 then
-- room:handleAddLoseSkills(lord, "-" .. table.concat(skills, "|-"), nil, false)
-- end
-- end
-- -- local zg = table.random(table.filter(room.alive_players, function(p) return p.role ~= "lord" end))
-- -- zg.role = "lord"
-- -- room:setPlayerMark(zg, "duozheng_zhugong", 1)
-- -- room:notifyProperty(zg, zg, "role")
-- -- local fz = table.random(table.filter(room.alive_players, function(p) return p.role ~= "lord" end))
-- -- fz.role = "rebel"
-- -- room:setPlayerMark(fz, "duozheng_fanzei", 1)
-- -- room:notifyProperty(fz, fz, "role")
-- -- for _, p in ipairs(room:getAlivePlayers()) do
-- -- if p:getMark("@@duozheng_zhugong") == 0 and p:getMark("@@duozheng_fanzei") == 0 then
-- -- p.role = table.random({ "loyalist", "rebel", "renegade", "lord" })
-- -- room:notifyProperty(p, p, "role")
-- -- end
-- -- end
-- local first = table.find(room.players, function(p) return p.seat == 1 end)
-- if first and first ~= player then
-- room:swapSeat(player, first)
-- room.current = player
-- end
-- end,
-- }
-- liuyan:addSkill(sw_duozheng)
-- Fk:loadTranslationTable {
-- ["sww__liuyan"] = "刘焉",
-- ["~sww__liuyan"] = "根基未稳,吾命休矣...",
-- ["sw_duozheng"] = "夺政",
-- [":sw_duozheng"] = "锁定技,游戏开始时,若你不为主公,将你的身份改为主公,增加一点体力上限并回复一点体力,与一号位交换座位,然后将原主公的身份进行随机分配(仅身份、忠胆模式下生效)。",
-- ["$sw_duozheng1"] = "汉室宝器,岂可丧于外奴之手。",
-- ["$sw_duozheng2"] = "图强自立,据险谋国。",
-- }
local sw_rongzhu = fk.CreateActiveSkill {
name = "sw_rongzhu",
card_num = 1,
can_use = function(self, player)
return player:hasSkill(self.name) and player.phase == Player.Play
end,
card_filter = function(self, to_select, selected)
return #selected == 0 and Fk:currentRoom():getCardArea(to_select) == Player.Hand and
table.contains({ Card.SubtypeWeapon },
Fk:getCardById(to_select).sub_type)
end,
target_filter = function(self, to_select, selected)
return false
end,
on_use = function(self, room, effect)
local player = room:getPlayerById(effect.from)
local card = Fk:getCardById(effect.cards[1])
player:addToPile("majun_wuqi", card, true, self.name)
if card.equip_skill then
room:handleAddLoseSkills(player, card.equip_skill.name, nil, true, false)
-- room:setPlayerMark(player, "sw_rongzhu_equipskill", card.equip_skill.name.. "-" .. card.name)
-- local translate = Fk:translate(card.name)
-- -- dbg()
-- room:setPlayerMark(player, "@" .. translate, "")
end
end,
}
local test = General(extension, "sw__test", "que", 20, 20, General.Female)
local wocaojineng = fk.CreateTriggerSkill {
name = "wocaojineng",
events = { fk.CardUseFinished },
anim_type = "offensive",
frequency = Skill.Compulsory,
can_trigger = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name)
end,
on_use = function(self, event, target, player, data)
local all_skills = {}
for _, skill in ipairs(target.player_skills) do
if not skill.frequency ~= Skill.Wake then
table.insert(all_skills, skill.name)
end
end
if table.contains(all_skills, self.name) then
for _, skill_name in ipairs(all_skills) do
local skill = Fk.skills[skill_name]
local scope_type = skill.scope_type
if scope_type == nil and skill.frequency ~= Skill.Wake then
scope_type = Player.HistoryPhase
end
if scope_type and player:usedSkillTimes(skill_name, scope_type) > 0 then
player:setSkillUseHistory(skill_name, 0, scope_type)
end
end
end
local all_skills1 = {}
for _, skill in ipairs(target.player_skills) do
if not skill.frequency ~= Skill.Wake then
table.insert(all_skills1, skill.name)
end
end
if table.contains(all_skills1, self.name) then
for _, skill_name in ipairs(all_skills1) do
local skill = Fk.skills[skill_name]
local scope_type = skill.scope_type
if scope_type == nil and skill.frequency ~= Skill.Wake then
scope_type = Player.HistoryGame
end
if scope_type and player:usedSkillTimes(skill_name, scope_type) > 0 then
player:setSkillUseHistory(skill_name, 0, scope_type)
end
end
end
local all_skills2 = {}
for _, skill in ipairs(target.player_skills) do
if not skill.frequency ~= Skill.Wake then
table.insert(all_skills2, skill.name)
end
end
if table.contains(all_skills2, self.name) then
for _, skill_name in ipairs(all_skills2) do
local skill = Fk.skills[skill_name]
local scope_type = skill.scope_type
if scope_type == nil and skill.frequency ~= Skill.Wake then
scope_type = Player.HistoryTurn
end
if scope_type and player:usedSkillTimes(skill_name, scope_type) > 0 then
player:setSkillUseHistory(skill_name, 0, scope_type)
end
end
end
local all_skills3 = {}
for _, skill in ipairs(target.player_skills) do
if not skill.frequency ~= Skill.Wake then
table.insert(all_skills3, skill.name)
end
end
if table.contains(all_skills3, self.name) then
for _, skill_name in ipairs(all_skills3) do
local skill = Fk.skills[skill_name]
local scope_type = skill.scope_type
if scope_type == nil and skill.frequency ~= Skill.Wake then
scope_type = Player.HistoryRound
end
if scope_type and player:usedSkillTimes(skill_name, scope_type) > 0 then
player:setSkillUseHistory(skill_name, 0, scope_type)
end
end
end
end,
}
test:addSkill(wocaojineng)
local zhemian = fk.CreateTriggerSkill {
name = "zhemian",
events = { fk.EventPhaseChanging },
can_trigger = function(self, event, target, player, data)
local n = 0
for _, id in ipairs(player.room:getOtherPlayers(player)) do
if #id:getCardIds("h") > 0 then
n = n + 1
end
end
return target ~= player and player:hasSkill(self) and data.to == target.Start and
table.every(player.room:getOtherPlayers(target), function(p)
return p:getHandcardNum() <= target:getHandcardNum()
end) and target.kingdom == "qun" and n > 0
end,
on_cost = function(self, event, target, player, data)
local room = player.room
local targets = room:getOtherPlayers(player)
local to = room:askForChoosePlayers(target, table.map(targets, Util.IdMapper), 1, 1, "遮面:请选择要交换装备的角色", self.name)
if #to == 0 or (#room:getPlayerById(to[1]):getCardIds("e") == 0 and #player:getCardIds("e") == 0) then
return false
else
self.cost_data = to[1]
return true
end
end,
on_use = function(self, event, target, player, data)
local room = player.room
local to = room:getPlayerById(self.cost_data)
if room:askForSkillInvoke(target, self.name, nil, "#zhemian-askskill:" .. player.id .. ":" .. to.id) then
room:askForMoveCardInBoard(target, to, player, self.name)
end
end,
}
Fk:loadTranslationTable {
["zhemian"] = "遮面",
[":zhemian"] = "其他群势力角色的准备阶段,若其手牌数为全场最多,其可以选择一名其他角色,然后令其选择是否调换你与其选择目标装备区的一张牌。",
["#zhemian-askskill"] = "遮面:是否移动%src或%dest装备区的一张牌至对方装备区?",
}
local xiii = fk.CreateViewAsSkill {
name = "xiii",
anim_type = "switch",
switch_skill_name = "xiii",
prompt = function()
return "#xiii-prompt:::" ..
(Self:getSwitchSkillState("xiii") == fk.SwitchYang and "unexpectation" or "looting")
end,
card_filter = function(self, to_select, selected)
return #selected == 0 and Fk:getCardById(to_select).trueName == "slash"
end,
view_as = function(self, cards)
if #cards ~= 1 then return nil end
local name = (Self:getSwitchSkillState("xiii") == fk.SwitchYang and "unexpectation" or "looting")
if not Fk.all_card_types[name] 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 not player:isKongcheng() and table.find(player:getCardIds("h"),
function(id) return Fk:getCardById(id).trueName == "slash" end)
end,
}
local xilve_delay = fk.CreateTriggerSkill {
name = "#xilve_delay",
frequency = Skill.Compulsory,
events = { fk.CardUseFinished },
can_trigger = function(self, event, target, player, data)
return player:hasSkill("xilve") and target == player and data.card and table.contains(data.card.skillNames, "xilve") and
not data.damageDealt
end,
on_use = function(self, event, target, player, data)
local all_slots = { "WeaponSlot", "ArmorSlot", "DefensiveRideSlot", "OffensiveRideSlot", "TreasureSlot" }
local choices = {}
for _, equip_slot in ipairs(all_slots) do
if table.contains(player.sealedSlots, equip_slot) then
table.insert(choices, equip_slot)
end
end
if #choices > 0 then
local choice = player.room:askForChoice(player, choices, self.name, "#xilve-choice", false)
player.room:resumePlayerArea(player, { choice })
player:endPlayPhase()
end
end,
}
Fk:loadTranslationTable {
["xiii"] = "变牌",
[":xiii"] = "转换技,出牌阶段,你可以将【杀】当做,阳:【出其不意】;阴:【趁火打劫】使用,若此牌未造成伤害,你回复一个装备栏并结束出牌阶段。",
}
local napai_viewas = fk.CreateViewAsSkill {
name = "napai_viewas",
anim_type = "offensive",
pattern = "slash,duel",
prompt = "拿牌:是否使用【过河拆桥】?",
interaction = function()
return UI.ComboBox { choices = { "dismantlement" } }
end,
card_filter = function(self, to_select, selected)
return #selected == 0 and table.contains(Self:getCardIds("he"), to_select)
end,
view_as = function(self, cards)
if #cards ~= 1 or not self.interaction.data then return end
local card = Fk:cloneCard(self.interaction.data)
card.skillName = self.name
card:addSubcard(cards[1])
return card
end,
}
Fk:addSkill(napai_viewas)
local napai = fk.CreateTriggerSkill {
name = "napai",
anim_type = "drawcard",
events = { fk.AfterCardsMove, fk.Damage },
can_trigger = function(self, event, target, player, data)
if not player:hasSkill(self) then return end
if event == fk.AfterCardsMove then
self.cost_data = {}
for _, move in ipairs(data) do
if move.from and move.toArea == Card.DiscardPile and move.skillName == "dismantlement_skill" and move.proposer == player.id then
for _, info in ipairs(move.moveInfo) do
if Fk:getCardById(info.cardId).type == Card.TypeBasic and player.room:getCardArea(info.cardId) == Card.DiscardPile then
table.insertIfNeed(self.cost_data, info.cardId)
end
end
end
end
if #self.cost_data > 0 then
return true
end
else
return target == player and data.to and not data.to.dead and data.to ~= player and data.from == player
end
end,
on_cost = function(self, event, target, player, data)
if event == fk.AfterCardsMove then
return true
else
local success, dat = player.room:askForUseActiveSkill(player, "napai_viewas", "#napai-ask:"..data.to.id, true,
{
bypass_times = true,
extraUse = true,
})
if success and dat then
self.cost_data = dat
return true
end
end
end,
on_use = function(self, event, target, player, data)
local room = player.room
if event == fk.AfterCardsMove then
room:delay(200)
local dummy = Fk:cloneCard("dilu")
dummy:addSubcards(self.cost_data)
room:obtainCard(player.id, dummy, true, fk.ReasonJustMove)
else
local card = napai_viewas:viewAs(self.cost_data.cards)
room:useCard {
from = player.id,
tos = table.map(self.cost_data.targets, function(id) return { id } end),
card = card,
}
end
end,
}
test:addSkill(napai)
Fk:loadTranslationTable {
["napai"] = "拿牌",
[":napai"] = "当你对其他角色造成伤害后,你可以将一张牌当做【过河拆桥】对其适应,你获得因此被弃置的基本牌。",
["#napai-ask"] = "拿牌:是否对%src使用【过河拆桥】",
["napai_viewas"] = "拿牌",
}
Fk:loadTranslationTable {
["sw__test"] = "魔法少女",
["wocaojineng"] = "我草",
[":wocaojineng"] = "每当你使用一张牌时,重置你的所有技能",
}
return extension
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ink-cherry-blossom/MahjongSoul.git
git@gitee.com:ink-cherry-blossom/MahjongSoul.git
ink-cherry-blossom
MahjongSoul
MahjongSoul
master

搜索帮助