Commit 9f50e853 authored by 未闻皂名's avatar 未闻皂名

2023/12/27 融合操作更新,允许返回选择融合怪兽

parent 29d629c6
No preview for this file type
-- Rush Duel 融合术/结合 -- Rush Duel 融合
RushDuel = RushDuel or {} RushDuel = RushDuel or {}
-- 添加 融合术/结合 素材 (指定素材与数量) -- 内部方法: 生成融合素材的函数
function RushDuel.AddFusionProcedure(card, ...) function RushDuel._private_make_fusion_material(card, sub, insf, mat, ...)
local insf = true local fun = {}
local sub = true local unspecified = false
Auxiliary.AddFusionProcMix(card, sub, insf, ...) for _, val in ipairs {...} do
local val_type = type(val)
if val_type == "number" then
table.insert(fun, RushDuel._private_make_fusion_material_code(val))
mat[val] = true
elseif val_type == "function" then
table.insert(fun, RushDuel._private_make_fusion_material_func(val))
unspecified = true
elseif val_type == "table" then
local funs = RushDuel._private_make_fusion_material(card, sub, insf, mat, table.unpack(val))
table.insert(fun, RushDuel._private_make_fusion_material_mix(funs))
end
end
return fun, unspecified
end end
-- 添加 融合术/结合 素材 (指定条件与数量)
function RushDuel.AddFusionProcedureType(card, ...) -- 内部方法: 融合素材 - 卡名
local insf = true function RushDuel._private_make_fusion_material_code(code)
local sub = false return function(c, fc, sub, mg, sg)
Auxiliary.AddFusionProcMix(card, sub, insf, ...) return c:IsFusionCode(code) or (sub and c:CheckFusionSubstitute(fc))
end
end
-- 内部方法: 融合素材 - 条件
function RushDuel._private_make_fusion_material_func(func)
return function(c, fc, sub, mg, sg)
return func(c, fc, sub, mg, sg) and not c:IsHasEffect(6205579)
end
end
-- 内部方法: 融合素材 - 混合
function RushDuel._private_make_fusion_material_mix(funs)
return function(c, fc, sub, mg, sg)
for _, fun in ipairs(funs) do
if fun(c, fc, sub, mg, sg) then
return true
end
end
return false
end
end
-- 内部方法: 添加融合素材数据
function RushDuel._private_set_fusion_material_data(card, mat, min, max, unspecified)
local mt = getmetatable(card)
-- 卡名记述的素材
if mt.material == nil then
mt.material = mat
end
-- 素材的数量
if mt.material_count == nil then
mt.material_count = {min, max}
end
-- 包含不指定卡名的融合素材
if unspecified ~= nil then
mt.unspecified_funsion = unspecified
end
end
-- 内部方法: 创建融合效果
function RushDuel._private_create_fusion_effect(card, insf, sub, checker, min, max, ...)
local e = Effect.CreateEffect(card)
e:SetType(EFFECT_TYPE_SINGLE)
e:SetCode(EFFECT_FUSION_MATERIAL)
e:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
e:SetCondition(RushDuel.FusionProcedureCondition(insf, sub, checker, min, max, ...))
e:SetOperation(RushDuel.FusionProcedureOperation(insf, sub, checker, min, max, ...))
card:RegisterEffect(e)
return e
end
-- 添加融合手续: 指定卡名/条件, 固定数量
function RushDuel.AddFusionProcedure(card, sub, insf, ...)
if card:IsStatus(STATUS_COPYING_EFFECT) then
return
end
local vals = {...}
-- 简易融合
if type(insf) ~= "boolean" then
table.insert(vals, 1, insf)
insf = true
end
-- 融合素材替代
if type(sub) ~= "boolean" then
table.insert(vals, 1, sub)
sub = true
end
-- 有卡名记述的融合素材
local mat = {}
local funs, unspecified = RushDuel._private_make_fusion_material(card, sub, insf, mat, table.unpack(vals))
RushDuel._private_set_fusion_material_data(card, mat, #funs, #funs, unspecified)
local checker = RushDuel.FusionProcedureChecker(RushDuel.FusionProcedureCheckStart, nil)
return RushDuel._private_create_fusion_effect(card, insf, sub, checker, #funs, #funs, table.unpack(funs))
end
-- 融合手续 - 检测: 指定卡名/条件, 固定数量
function RushDuel.FusionProcedureCheckStart(mg, fc, sub, ...)
local sg = Group.CreateGroup()
return mg:IsExists(RushDuel.FusionProcedureCheckStep, 1, nil, mg, sg, fc, sub, ...)
end end
-- 添加 融合术/结合 素材 (特殊的素材要求) function RushDuel.FusionProcedureCheckStep(c, mg, sg, fc, sub, fun1, fun2, ...)
function RushDuel.AddFusionProcedureSP(card, matfilter, matcheck, min, max, insf, sub) if fun2 then
local insf = insf ~= false sg:AddCard(c)
local sub = sub ~= false local res = false
if not card:IsStatus(STATUS_COPYING_EFFECT) then if fun1(c, fc, false, mg, sg) then
local e1 = Effect.CreateEffect(card) res = mg:IsExists(RushDuel.FusionProcedureCheckStep, 1, sg, mg, sg, fc, sub, fun2, ...)
e1:SetType(EFFECT_TYPE_SINGLE) elseif sub and fun1(c, fc, true, mg, sg) then
e1:SetCode(EFFECT_FUSION_MATERIAL) res = mg:IsExists(RushDuel.FusionProcedureCheckStep, 1, sg, mg, sg, fc, false, fun2, ...)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE) end
e1:SetCondition(RushDuel.FusionProcCondition(matfilter, matcheck, min, max, insf, sub)) sg:RemoveCard(c)
e1:SetOperation(RushDuel.FusionProcOperation(matfilter, matcheck, min, max, insf, sub)) return res
card:RegisterEffect(e1) else
return fun1(c, fc, sub, mg, sg)
end end
end end
function RushDuel.FusionProcCheck(sg, tp, fc, sub, chkfnf, matfilter, matcheck)
-- 添加融合手续: 指定条件, 不固定数量
function RushDuel.AddFusionProcedureSP(card, matfilter, matcheck, min, max, sub, insf)
if card:IsStatus(STATUS_COPYING_EFFECT) then
return
end
local insf = (insf ~= false)
local sub = (sub ~= false)
local checker = RushDuel.FusionProcedureChecker(RushDuel.FusionProcedureCheckSP, matcheck)
return RushDuel._private_create_fusion_effect(card, insf, sub, checker, min, max, matfilter)
end
-- 融合手续 - 检测: 指定条件, 不固定数量
function RushDuel.FusionProcedureCheckSP(mg, fc, sub, matfilter)
local ct = mg:FilterCount(matfilter, nil, fc, false)
if not sub then
return ct == mg:GetCount()
else
return ct >= mg:GetCount() - 1
end
end
-- 手动添加融合素材列表
function RushDuel.SetFusionMaterial(card, codes, min, max)
if card:IsStatus(STATUS_COPYING_EFFECT) then
return
end
local mat = {}
for _, code in ipairs(codes) do
mat[code] = true
end
RushDuel._private_set_fusion_material_data(card, mat, min, max)
end
-- 融合手续 - 检测
function RushDuel.FusionProcedureChecker(condition, checker)
return function(sg, tp, fc, sub, chkfnf, ...)
local chkf = chkfnf & 0xff local chkf = chkfnf & 0xff
local concat_fusion = chkfnf & 0x200 > 0 local concat_fusion = chkfnf & 0x200 > 0
if not concat_fusion and sg:IsExists(Auxiliary.TuneMagicianCheckX, 1, nil, sg, EFFECT_TUNE_MAGICIAN_F) then if not concat_fusion and sg:IsExists(Auxiliary.TuneMagicianCheckX, 1, nil, sg, EFFECT_TUNE_MAGICIAN_F) then
...@@ -36,20 +163,16 @@ function RushDuel.FusionProcCheck(sg, tp, fc, sub, chkfnf, matfilter, matcheck) ...@@ -36,20 +163,16 @@ function RushDuel.FusionProcCheck(sg, tp, fc, sub, chkfnf, matfilter, matcheck)
if not Auxiliary.MustMaterialCheck(sg, tp, EFFECT_MUST_BE_FMATERIAL) then if not Auxiliary.MustMaterialCheck(sg, tp, EFFECT_MUST_BE_FMATERIAL) then
return false return false
end end
return RushDuel.FusionSubCheck(sg, fc, sub, matfilter) and matcheck(sg, tp, fc, chkf) return condition(sg, fc, sub, ...)
and (chkf == PLAYER_NONE or Duel.GetLocationCountFromEx(tp, tp, sg, fc) > 0) and (chkf == PLAYER_NONE or Duel.GetLocationCountFromEx(tp, tp, sg, fc) > 0)
and (not checker or checker(sg, tp, fc, chkf))
and (not Auxiliary.FCheckAdditional or Auxiliary.FCheckAdditional(tp, sg, fc)) and (not Auxiliary.FCheckAdditional or Auxiliary.FCheckAdditional(tp, sg, fc))
and (not Auxiliary.FGoalCheckAdditional or Auxiliary.FGoalCheckAdditional(tp, sg, fc)) and (not Auxiliary.FGoalCheckAdditional or Auxiliary.FGoalCheckAdditional(tp, sg, fc))
end
function RushDuel.FusionSubCheck(sg, fc, sub, matfilter)
local ct = sg:FilterCount(matfilter, nil, fc, false)
if not sub then
return ct == sg:GetCount()
else
return ct >= sg:GetCount() - 1
end end
end end
function RushDuel.FusionProcCondition(matfilter, matcheck, min, max, insf, sub) -- 融合手续 - 条件
function RushDuel.FusionProcedureCondition(insf, sub, checker, min, max, ...)
local funs = {...}
return function(e, g, gc, chkfnf) return function(e, g, gc, chkfnf)
if g == nil then if g == nil then
return insf and Auxiliary.MustMaterialCheck(nil, e:GetHandlerPlayer(), EFFECT_MUST_BE_FMATERIAL) return insf and Auxiliary.MustMaterialCheck(nil, e:GetHandlerPlayer(), EFFECT_MUST_BE_FMATERIAL)
...@@ -59,46 +182,35 @@ function RushDuel.FusionProcCondition(matfilter, matcheck, min, max, insf, sub) ...@@ -59,46 +182,35 @@ function RushDuel.FusionProcCondition(matfilter, matcheck, min, max, insf, sub)
local notfusion = chkfnf & 0x100 > 0 local notfusion = chkfnf & 0x100 > 0
local concat_fusion = chkfnf & 0x200 > 0 local concat_fusion = chkfnf & 0x200 > 0
local sub = (sub or notfusion) and not concat_fusion local sub = (sub or notfusion) and not concat_fusion
local mg = g:Filter(Auxiliary.FConditionFilterMix, c, c, sub, concat_fusion, matfilter) local mg = g:Filter(Auxiliary.FConditionFilterMix, c, c, sub, concat_fusion, table.unpack(funs))
if gc then if gc then
if not mg:IsContains(gc) then if not mg:IsContains(gc) then
return false return false
end end
Duel.SetSelectedCard(Group.FromCards(gc)) Duel.SetSelectedCard(gc)
end end
return mg:CheckSubGroup(RushDuel.FusionProcCheck, min, max, tp, c, sub, chkfnf, matfilter, matcheck) return mg:CheckSubGroup(checker, min, max, tp, c, sub, chkfnf, table.unpack(funs))
end end
end end
function RushDuel.FusionProcOperation(matfilter, matcheck, min, max, insf, sub) -- 融合手续 - 操作
function RushDuel.FusionProcedureOperation(insf, sub, checker, min, max, ...)
local funs = {...}
return function(e, tp, eg, ep, ev, re, r, rp, gc, chkfnf) return function(e, tp, eg, ep, ev, re, r, rp, gc, chkfnf)
local c = e:GetHandler() local c = e:GetHandler()
local tp = c:GetControler() local tp = c:GetControler()
local notfusion = chkfnf & 0x100 > 0 local notfusion = chkfnf & 0x100 > 0
local concat_fusion = chkfnf & 0x200 > 0 local concat_fusion = chkfnf & 0x200 > 0
local sub = (sub or notfusion) and not concat_fusion local sub = (sub or notfusion) and not concat_fusion
local mg = eg:Filter(Auxiliary.FConditionFilterMix, c, c, sub, concat_fusion, matfilter) local mg = eg:Filter(Auxiliary.FConditionFilterMix, c, c, sub, concat_fusion, table.unpack(funs))
if gc then if gc then
Duel.SetSelectedCard(Group.FromCards(gc)) Duel.SetSelectedCard(gc)
end end
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FMATERIAL) Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FMATERIAL)
local sg = mg:SelectSubGroup(tp, RushDuel.FusionProcCheck, false, min, max, tp, c, sub, chkfnf, matfilter, matcheck) local sg = mg:SelectSubGroup(tp, checker, true, min, max, tp, c, sub, chkfnf, table.unpack(funs))
Duel.SetFusionMaterial(sg) if sg == nil then
end sg = Group.CreateGroup()
end
-- 手动添加融合素材列表
function RushDuel.SetFusionMaterial(card, codes, min, max)
if not card:IsStatus(STATUS_COPYING_EFFECT) then
local mt = getmetatable(card)
if mt.material == nil then
mt.material = {}
for _, code in ipairs(codes) do
mt.material[code] = true
end
end
if mt.material_count == nil then
mt.material_count = { min, max }
end end
Duel.SetFusionMaterial(sg)
end end
end end
...@@ -113,171 +225,136 @@ function RushDuel.CreateFusionEffect(card, matfilter, spfilter, exfilter, s_rang ...@@ -113,171 +225,136 @@ function RushDuel.CreateFusionEffect(card, matfilter, spfilter, exfilter, s_rang
e:SetOperation(RushDuel.FusionOperation(matfilter, spfilter, exfilter, self_range, opponent_range, mat_check, move, include, operation_action)) e:SetOperation(RushDuel.FusionOperation(matfilter, spfilter, exfilter, self_range, opponent_range, mat_check, move, include, operation_action))
return e return e
end end
-- 判断条件: 是否可以进行 融合术/结合 召唤 -- 融合效果 - 素材过滤
function RushDuel.IsCanFusionSummon(e, tp, matfilter, spfilter, exfilter, s_range, o_range, mat_check, including_self, except)
local chkf = tp
local mg1 = Duel.GetFusionMaterial(tp):Filter(RushDuel.FusionMaterialFilter, except, matfilter)
if s_range ~= 0 or o_range ~= 0 then
local mg2 = Duel.GetMatchingGroup(exfilter, tp, s_range, o_range, except)
mg1:Merge(mg2)
end
aux.FGoalCheckAdditional = mat_check
local gc = nil
if including_self then
gc = e:GetHandler()
end
local res = Duel.IsExistingMatchingCard(RushDuel.FusionSpecialSummonFilter, tp, LOCATION_EXTRA, 0, 1, nil, e, tp, mg1, nil, gc, chkf, spfilter)
if not res then
local ce = Duel.GetChainMaterial(tp)
if ce ~= nil then
local fgroup = ce:GetTarget()
local mg3 = fgroup(ce, e, tp)
local mf = ce:GetValue()
res = Duel.IsExistingMatchingCard(RushDuel.FusionSpecialSummonFilter, tp, LOCATION_EXTRA, 0, 1, nil, e, tp, mg3, mf, gc, chkf, spfilter)
end
end
aux.FGoalCheckAdditional = nil
return res
end
function RushDuel.FusionMaterialFilter(c, filter, e) function RushDuel.FusionMaterialFilter(c, filter, e)
return (not filter or filter(c)) and (not e or not c:IsImmuneToEffect(e)) return (not filter or filter(c)) and (not e or not c:IsImmuneToEffect(e))
end end
-- 融合效果 - 融合召唤的怪兽过滤
function RushDuel.FusionSpecialSummonFilter(c, e, tp, m, f, gc, chkf, filter) function RushDuel.FusionSpecialSummonFilter(c, e, tp, m, f, gc, chkf, filter)
return c:IsType(TYPE_FUSION) and (not filter or filter(c, e, tp, m, f, chkf)) and (not f or f(c)) and c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_FUSION, tp, false, false) and c:CheckFusionMaterial(m, gc, chkf) return c:IsType(TYPE_FUSION) and (not filter or filter(c, e, tp, m, f, chkf)) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_FUSION, tp, false, false)
and c:CheckFusionMaterial(m, gc, chkf)
end end
-- 融合效果 - 确认素材过滤
function RushDuel.ConfirmCardFilter(c) function RushDuel.ConfirmCardFilter(c)
return c:IsLocation(LOCATION_HAND) or (c:IsLocation(LOCATION_MZONE) and c:IsFacedown()) return c:IsLocation(LOCATION_HAND) or (c:IsLocation(LOCATION_MZONE) and c:IsFacedown())
end end
function RushDuel.FusionTarget(matfilter, spfilter, exfilter, s_range, o_range, mat_check, including_self, action) -- 融合效果 - 获取融合素材与融合怪兽
return function(e, tp, eg, ep, ev, re, r, rp, chk) function RushDuel.GetFusionSummonData(e, tp, matfilter, spfilter, exfilter, s_range, o_range, including_self, except, effect)
if chk == 0 then
return RushDuel.IsCanFusionSummon(e, tp, matfilter, spfilter, exfilter, s_range, o_range, mat_check, including_self, nil)
end
if action ~= nil then
action(e, tp, eg, ep, ev, re, r, rp)
end
Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
end
end
function RushDuel.FusionOperation(matfilter, spfilter, exfilter, s_range, o_range, mat_check, mat_move, including_self, action)
return function(e, tp, eg, ep, ev, re, r, rp)
local chkf = tp local chkf = tp
local mg1 = Duel.GetFusionMaterial(tp):Filter(RushDuel.FusionMaterialFilter, nil, matfilter, e) local mg1 = Duel.GetFusionMaterial(tp):Filter(RushDuel.FusionMaterialFilter, except, matfilter, effect)
if s_range ~= 0 or o_range ~= 0 then if s_range ~= 0 or o_range ~= 0 then
local mg2 = Duel.GetMatchingGroup(aux.NecroValleyFilter(exfilter), tp, s_range, o_range, nil, e) local ext = Duel.GetMatchingGroup(aux.NecroValleyFilter(exfilter), tp, s_range, o_range, except, effect)
mg1:Merge(mg2) mg1:Merge(ext)
end end
aux.FGoalCheckAdditional = mat_check
local gc = nil local gc = nil
if including_self then if including_self then
gc = e:GetHandler() gc = e:GetHandler()
end end
local sg1 = Duel.GetMatchingGroup(RushDuel.FusionSpecialSummonFilter, tp, LOCATION_EXTRA, 0, nil, e, tp, mg1, nil, gc, chkf, spfilter) local sg1 = Duel.GetMatchingGroup(RushDuel.FusionSpecialSummonFilter, tp, LOCATION_EXTRA, 0, nil, e, tp, mg1, nil, gc, chkf, spfilter)
local mg3 = nil local mg2 = nil
local sg2 = nil local sg2 = nil
local ce = Duel.GetChainMaterial(tp) local ce = Duel.GetChainMaterial(tp)
if ce ~= nil then if ce ~= nil then
local fgroup = ce:GetTarget() local fgroup = ce:GetTarget()
mg3 = fgroup(ce, e, tp) mg2 = fgroup(ce, e, tp)
local mf = ce:GetValue() local mf = ce:GetValue()
sg2 = Duel.GetMatchingGroup(RushDuel.FusionSpecialSummonFilter, tp, LOCATION_EXTRA, 0, nil, e, tp, mg3, mf, gc, chkf, spfilter) sg2 = Duel.GetMatchingGroup(RushDuel.FusionSpecialSummonFilter, tp, LOCATION_EXTRA, 0, nil, e, tp, mg2, mf, gc, chkf, spfilter)
end end
local mat = nil return ce, mg1, mg2, sg1, sg2, chkf, gc
local fc = nil end
if sg1:GetCount() > 0 or (sg2 ~= nil and sg2:GetCount() > 0) then -- 融合效果 - 进行融合召唤
function RushDuel.ExecuteFusionSummon(e, tp, ce, mg1, mg2, sg1, sg2, gc, chkf, mat_move)
local sg = sg1:Clone() local sg = sg1:Clone()
if sg2 then if sg2 then
sg:Merge(sg2) sg:Merge(sg2)
end end
::cancel::
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
local tg = sg:Select(tp, 1, 1, nil) local fc = sg:Select(tp, 1, 1, nil):GetFirst()
fc = tg:GetFirst() local mat = nil
if sg1:IsContains(fc) and (sg2 == nil or not sg2:IsContains(fc) or not Duel.SelectYesNo(tp, ce:GetDescription())) then if sg1:IsContains(fc) and (sg2 == nil or not sg2:IsContains(fc) or not Duel.SelectYesNo(tp, ce:GetDescription())) then
mat = Duel.SelectFusionMaterial(tp, fc, mg1, gc, chkf) mat = Duel.SelectFusionMaterial(tp, fc, mg1, gc, chkf)
if #mat < 2 then
goto cancel
end
fc:SetMaterial(mat) fc:SetMaterial(mat)
local cg = mat:Filter(RushDuel.ConfirmCardFilter, nil) local cg = mat:Filter(RushDuel.ConfirmCardFilter, nil)
if cg:GetCount() > 0 then if #cg > 0 then
Duel.ConfirmCards(1 - tp, cg) Duel.ConfirmCards(1 - tp, cg)
end end
mat_move(mat) mat_move(mat)
Duel.BreakEffect() Duel.BreakEffect()
Duel.SpecialSummon(fc, SUMMON_TYPE_FUSION, tp, tp, false, false, POS_FACEUP) Duel.SpecialSummon(fc, SUMMON_TYPE_FUSION, tp, tp, false, false, POS_FACEUP)
else else
mat = Duel.SelectFusionMaterial(tp, fc, mg3, gc, chkf) mat = Duel.SelectFusionMaterial(tp, fc, mg2, gc, chkf)
if #mat < 2 then
goto cancel
end
local fop = ce:GetOperation() local fop = ce:GetOperation()
fop(ce, e, tp, fc, mat) fop(ce, e, tp, fc, mat)
end end
fc:CompleteProcedure() fc:CompleteProcedure()
return fc, mat
end
-- 判断条件: 是否可以进行融合召唤
function RushDuel.IsCanFusionSummon(e, tp, matfilter, spfilter, exfilter, s_range, o_range, mat_check, including_self, except)
Auxiliary.FGoalCheckAdditional = mat_check
local ce, mg1, mg2, sg1, sg2 = RushDuel.GetFusionSummonData(e, tp, matfilter, spfilter, exfilter, s_range, o_range, including_self, except)
local res = #sg1 > 0
if not res and ce ~= nil then
res = #sg2 > 0
end
Auxiliary.FGoalCheckAdditional = nil
return res
end
-- 融合效果 - 目标
function RushDuel.FusionTarget(matfilter, spfilter, exfilter, s_range, o_range, mat_check, including_self, action)
return function(e, tp, eg, ep, ev, re, r, rp, chk)
if chk == 0 then
return RushDuel.IsCanFusionSummon(e, tp, matfilter, spfilter, exfilter, s_range, o_range, mat_check, including_self, nil)
end end
if action ~= nil then if action ~= nil then
action(e, tp, eg, ep, ev, re, r, rp, mat, fc) action(e, tp, eg, ep, ev, re, r, rp)
end end
aux.FGoalCheckAdditional = nil Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
end end
end end
-- 融合效果 - 操作
-- 素材去向: 墓地 function RushDuel.FusionOperation(matfilter, spfilter, exfilter, s_range, o_range, mat_check, mat_move, including_self, action)
function RushDuel.FusionToGrave(mat) return function(e, tp, eg, ep, ev, re, r, rp)
Duel.SendtoGrave(mat, REASON_EFFECT + REASON_MATERIAL + REASON_FUSION) Auxiliary.FGoalCheckAdditional = mat_check
end local ce, mg1, mg2, sg1, sg2, chkf, gc = RushDuel.GetFusionSummonData(e, tp, matfilter, spfilter, exfilter, s_range, o_range, including_self, nil, e)
-- 素材去向: 卡组 if sg1:GetCount() > 0 or (sg2 ~= nil and sg2:GetCount() > 0) then
function RushDuel.FusionToDeck(mat) local fc, mat = RushDuel.ExecuteFusionSummon(e, tp, ce, mg1, mg2, sg1, sg2, gc, chkf, mat_move)
Duel.SendtoDeck(mat, nil, SEQ_DECKSHUFFLE, REASON_EFFECT + REASON_MATERIAL + REASON_FUSION) if action ~= nil then
action(e, tp, eg, ep, ev, re, r, rp, mat, fc)
end
end
Auxiliary.FGoalCheckAdditional = nil
end
end end
-- 可以进行融合术召唤 -- 可以进行融合术召唤
function RushDuel.CanFusionSummon(desc, matfilter, spfilter, exfilter, s_range, o_range, mat_check, mat_move, e, tp, break_effect, including_self) function RushDuel.CanFusionSummon(desc, matfilter, spfilter, exfilter, s_range, o_range, mat_check, mat_move, e, tp, break_effect, including_self)
local chkf = tp Auxiliary.FGoalCheckAdditional = mat_check
local mg1 = Duel.GetFusionMaterial(tp):Filter(RushDuel.FusionMaterialFilter, nil, matfilter, e) local ce, mg1, mg2, sg1, sg2, chkf, gc = RushDuel.GetFusionSummonData(e, tp, matfilter, spfilter, exfilter, s_range, o_range, including_self, nil, e)
if s_range ~= 0 or o_range ~= 0 then
local mg2 = Duel.GetMatchingGroup(aux.NecroValleyFilter(exfilter), tp, s_range, o_range, nil, e)
mg1:Merge(mg2)
end
aux.FGoalCheckAdditional = mat_check
local gc = nil
if including_self then
gc = e:GetHandler()
end
local sg1 = Duel.GetMatchingGroup(RushDuel.FusionSpecialSummonFilter, tp, LOCATION_EXTRA, 0, nil, e, tp, mg1, nil, gc, chkf, spfilter)
local mg3 = nil
local sg2 = nil
local ce = Duel.GetChainMaterial(tp)
if ce ~= nil then
local fgroup = ce:GetTarget()
mg3 = fgroup(ce, e, tp)
local mf = ce:GetValue()
sg2 = Duel.GetMatchingGroup(RushDuel.FusionSpecialSummonFilter, tp, LOCATION_EXTRA, 0, nil, e, tp, mg3, mf, gc, chkf, spfilter)
end
local mat = nil
local fc = nil local fc = nil
if (sg1:GetCount() > 0 or (sg2 ~= nil and sg2:GetCount() > 0)) and Duel.SelectYesNo(tp, desc) then if (sg1:GetCount() > 0 or (sg2 ~= nil and sg2:GetCount() > 0)) and Duel.SelectYesNo(tp, desc) then
if break_effect then if break_effect then
Duel.BreakEffect() Duel.BreakEffect()
end end
local sg = sg1:Clone() fc = RushDuel.ExecuteFusionSummon(e, tp, ce, mg1, mg2, sg1, sg2, gc, chkf, mat_move)
if sg2 then
sg:Merge(sg2)
end
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
local tg = sg:Select(tp, 1, 1, nil)
fc = tg:GetFirst()
if sg1:IsContains(fc) and (sg2 == nil or not sg2:IsContains(fc) or not Duel.SelectYesNo(tp, ce:GetDescription())) then
mat = Duel.SelectFusionMaterial(tp, fc, mg1, gc, chkf)
fc:SetMaterial(mat)
local cg = mat:Filter(RushDuel.ConfirmCardFilter, nil)
if cg:GetCount() > 0 then
Duel.ConfirmCards(1 - tp, cg)
end
mat_move(mat)
Duel.BreakEffect()
Duel.SpecialSummon(fc, SUMMON_TYPE_FUSION, tp, tp, false, false, POS_FACEUP)
else
mat = Duel.SelectFusionMaterial(tp, fc, mg3, gc, chkf)
local fop = ce:GetOperation()
fop(ce, e, tp, fc, mat)
end
fc:CompleteProcedure()
end end
aux.FGoalCheckAdditional = nil aux.FGoalCheckAdditional = nil
return fc return fc
end end
-- 素材去向: 墓地
function RushDuel.FusionToGrave(mat)
Duel.SendtoGrave(mat, REASON_EFFECT + REASON_MATERIAL + REASON_FUSION)
end
-- 素材去向: 卡组
function RushDuel.FusionToDeck(mat)
Duel.SendtoDeck(mat, nil, SEQ_DECKSHUFFLE, REASON_EFFECT + REASON_MATERIAL + REASON_FUSION)
end
...@@ -3,7 +3,7 @@ local cm=_G["c"..m] ...@@ -3,7 +3,7 @@ local cm=_G["c"..m]
cm.name="五神龙" cm.name="五神龙"
function cm.initial_effect(c) function cm.initial_effect(c)
--Fusion Material --Fusion Material
RD.AddFusionProcedureType(c,cm.matfilter,cm.matfilter,cm.matfilter,cm.matfilter,cm.matfilter) RD.AddFusionProcedure(c,false,cm.matfilter,cm.matfilter,cm.matfilter,cm.matfilter,cm.matfilter)
--Only Fusion Summon --Only Fusion Summon
local e0=Effect.CreateEffect(c) local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE) e0:SetType(EFFECT_TYPE_SINGLE)
......
...@@ -16,8 +16,7 @@ function cm.filter(c) ...@@ -16,8 +16,7 @@ function cm.filter(c)
return c:IsFaceup() and c:IsType(TYPE_FUSION) and c:IsAbleToExtra() return c:IsFaceup() and c:IsType(TYPE_FUSION) and c:IsAbleToExtra()
end end
function cm.spfilter(c,e,tp,fc) function cm.spfilter(c,e,tp,fc)
return c:IsControler(tp) and c:IsLocation(LOCATION_GRAVE) and aux.IsMaterialListCode(fc,c:GetCode()) return aux.IsMaterialListCode(fc,c:GetCode()) and RD.IsCanBeSpecialSummoned(c,e,tp,POS_FACEUP)
and RD.IsCanBeSpecialSummoned(c,e,tp,POS_FACEUP)
end end
function cm.check(g,fc) function cm.check(g,fc)
return fc:CheckFusionMaterial(g,nil,PLAYER_NONE,true) return fc:CheckFusionMaterial(g,nil,PLAYER_NONE,true)
......
...@@ -3,7 +3,7 @@ local cm=_G["c"..m] ...@@ -3,7 +3,7 @@ local cm=_G["c"..m]
cm.name="传导士 炼金化学人·水雷" cm.name="传导士 炼金化学人·水雷"
function cm.initial_effect(c) function cm.initial_effect(c)
--Fusion Material --Fusion Material
RD.AddFusionProcedureType(c,cm.matfilter1,cm.matfilter2) RD.AddFusionProcedure(c,false,cm.matfilter1,cm.matfilter2)
--Atk Up --Atk Up
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0)) e1:SetDescription(aux.Stringid(m,0))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment