Commit 129b9ead authored by POLYMER's avatar POLYMER

fix

parent 4b8d0ae6
--蒹葭苍苍
local cm, m, ofs = GetID()
local yr = 13020010
xpcall(function() dofile("expansions/script/c16670000.lua") end, function() dofile("script/c16670000.lua") end)
-- xpcall(function() dofile("expansions/script/c16670000.lua") end, function() dofile("script/c16670000.lua") end)
if not Duel.LoadScript and loadfile then
function Duel.LoadScript(str)
require_list = require_list or {}
str = "expansions/script/" .. str
if not require_list[str] then
if string.find(str, "%.") then
require_list[str] = loadfile(str)
else
require_list[str] = loadfile(str .. ".lua")
end
pcall(require_list[str])
end
return require_list[str]
end
end
Duel.LoadScript("c16670000.lua")
function cm.initial_effect(c)
aux.AddCodeList(c, yr)
--Activate
local e1 = Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1, m)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
local e3 = Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m, 2))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetRange(QY_mx)
e3:SetCountLimit(1, m + 1)
e3:SetCondition(cm.spcon2)
e3:SetTarget(cm.sptg2)
e3:SetOperation(cm.spop2)
c:RegisterEffect(e3)
aux.AddCodeList(c, yr)
--Activate
local e1 = Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1, m)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
local e3 = Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m, 2))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetRange(QY_mx)
e3:SetCountLimit(1, m + 1)
e3:SetCondition(cm.spcon2)
e3:SetCost(cm.spcost2)
e3:SetTarget(cm.sptg2)
e3:SetOperation(cm.spop2)
c:RegisterEffect(e3)
end
function cm.filter(c)
return aux.IsCodeListed(c, yr) and c:IsAbleToHand()
return aux.IsCodeListed(c, yr) and c:IsAbleToHand()
end
function cm.filter2(c, e, tp)
return c:IsType(TYPE_EQUIP) and c:IsCanBeSpecialSummoned(e, 0, tp, true, false)
return c:IsType(TYPE_EQUIP) and c:IsCanBeSpecialSummoned(e, 0, tp, true, false)
end
function cm.target(e, tp, eg, ep, ev, re, r, rp, chk)
if chk == 0 then return Duel.IsExistingMatchingCard(cm.filter, tp, LOCATION_DECK, 0, 1, nil) end
Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
if chk == 0 then return Duel.IsExistingMatchingCard(cm.filter, tp, LOCATION_DECK, 0, 1, nil) end
Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
end
function cm.activate(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
local g = Duel.SelectMatchingCard(tp, cm.filter, tp, LOCATION_DECK, 0, 1, 1, nil)
if g:GetCount() > 0 then
Duel.SendtoHand(g, nil, REASON_EFFECT)
Duel.ConfirmCards(1 - tp, g)
end
local c = e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
local g = Duel.SelectMatchingCard(tp, cm.filter, tp, LOCATION_DECK, 0, 1, 1, nil)
if g:GetCount() > 0 then
Duel.SendtoHand(g, nil, REASON_EFFECT)
Duel.ConfirmCards(1 - tp, g)
end
end
function cm.cfilter(c, tp)
return c:IsType(TYPE_NORMAL)
return c:IsType(TYPE_NORMAL)
end
function cm.spcon2(e, tp, eg, ep, ev, re, r, rp)
return eg:IsExists(cm.cfilter, 1, nil, tp)
return eg:IsExists(cm.cfilter, 1, nil, tp)
end
function cm.spcost2(e, tp, eg, ep, ev, re, r, rp, chk)
if chk == 0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable, tp, LOCATION_HAND, 0, 1, nil) end
Duel.DiscardHand(tp, Card.IsDiscardable, 1, 1, REASON_COST + REASON_DISCARD)
end
function cm.sptg2(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and chkc:IsType(TYPE_SPELL + TYPE_EQUIP) end
local kx, zzx, sxx, zzjc, sxjc, zzl = it.sxbl()
if chk == 0 then return Duel.IsExistingTarget(cm.filter2, tp, LOCATION_GRAVE, 0, 1, nil, e, tp) and zzx > 0 end
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
local g = Duel.SelectTarget(tp, cm.filter2, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
local zz, sx, lv = it.sxblx(tp, kx, zzx, sxx, zzl)
e:SetLabel(zz, sx, lv)
Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and chkc:IsType(TYPE_SPELL + TYPE_EQUIP) end
local kx, zzx, sxx, zzjc, sxjc, zzl = it.sxbl()
if chk == 0 then return Duel.IsExistingTarget(cm.filter2, tp, LOCATION_GRAVE, 0, 1, nil, e, tp) and zzx > 0 end
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
local g = Duel.SelectTarget(tp, cm.filter2, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
local zz, sx, lv = it.sxblx(tp, kx, zzx, sxx, zzl)
e:SetLabel(zz, sx, lv)
Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
end
function cm.spop2(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
local tc = Duel.GetFirstTarget()
local zz, sx, lv = e:GetLabel()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then
if not Duel.IsPlayerCanSpecialSummonMonster(tp, tc:GetCode(), 0, TYPE_NORMAL + TYPE_MONSTER, 0, 0, lv, zz, sx) then return end
it.AddMonsterate(tc, TYPE_NORMAL + TYPE_MONSTER, sx, zz, lv, 0, 0)
Duel.SpecialSummonStep(tc, 0, tp, tp, true, false, POS_FACEUP_DEFENSE)
local e3 = Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetReset(RESET_EVENT + RESETS_REDIRECT)
e3:SetValue(LOCATION_REMOVED)
tc:RegisterEffect(e3, true)
local e2 = Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetReset(RESET_EVENT + RESETS_REDIRECT)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(cm.atkval)
tc:RegisterEffect(e2)
Duel.SpecialSummonComplete()
end
local c = e:GetHandler()
local tc = Duel.GetFirstTarget()
local zz, sx, lv = e:GetLabel()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then
if not Duel.IsPlayerCanSpecialSummonMonster(tp, tc:GetCode(), 0, TYPE_NORMAL + TYPE_MONSTER, 0, 0, lv, zz, sx) then return end
it.AddMonsterate(tc, TYPE_NORMAL + TYPE_MONSTER, sx, zz, lv, 0, 0)
Duel.SpecialSummonStep(tc, 0, tp, tp, true, false, POS_FACEUP_DEFENSE)
local e3 = Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetReset(RESET_EVENT + RESETS_REDIRECT)
e3:SetValue(LOCATION_REMOVED)
tc:RegisterEffect(e3, true)
local e2 = Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetReset(RESET_EVENT + RESETS_REDIRECT)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(cm.atkval)
tc:RegisterEffect(e2)
Duel.SpecialSummonComplete()
local cl = Duel.GetMatchingGroup(function(c)
return c:IsXyzSummonable(nil) and c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_XYZ, tp, false, false)
end, tp, LOCATION_EXTRA, 0, 1, nil)
local lj = Duel.GetMatchingGroup(function(c)
return c:IsLinkSummonable(nil) and c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_LINK, tp, false, false)
end, tp, LOCATION_EXTRA, 0, 1, nil)
local td = Duel.GetMatchingGroup(function(c)
return c:IsSynchroSummonable(nil) and
c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_SYNCHRO, tp, false, false)
end, tp, LOCATION_EXTRA, 0, 1, nil)
local mg1 = Duel.GetFusionMaterial(tp):Filter(function(c)
return not c:IsImmuneToEffect(e)
end, nil)
local rh = Duel.GetMatchingGroup(function(c)
return c:CheckFusionMaterial(mg1, nil, tp) and
c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_FUSION, tp, false, false)
end, tp, LOCATION_EXTRA, 0, 1, nil)
if (cl:GetCount() > 0 or lj:GetCount() > 0 or td:GetCount() > 0 or rh:GetCount() > 0) and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
local off = 1
local ops = {}
local opval = {}
if td then
ops[off] = aux.Stringid(m, 3)
opval[off - 1] = 1
off = off + 1
end
if cl then
ops[off] = aux.Stringid(m, 1)
opval[off - 1] = 2
off = off + 1
end
if lj then
ops[off] = aux.Stringid(m, 5)
opval[off - 1] = 3
off = off + 1
end
if rh then
ops[off] = aux.Stringid(m, 6)
opval[off - 1] = 3
off = off + 1
end
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EFFECT)
local op = Duel.SelectOption(tp, table.unpack(ops))
if opval[op] == 1 then
local tc = td:Select(tp, 1, 1, nil):GetFirst()
if tc then
Duel.LinkSummon(tp, tc, nil)
end
elseif opval[op] == 2 then
local tc = cl:Select(tp, 1, 1, nil):GetFirst()
if tc then
Duel.XyzSummon(tp, tc, nil)
end
elseif opval[op] == 3 then
local tc = lj:Select(tp, 1, 1, nil):GetFirst()
if tc then
Duel.LinkSummon(tp, tc, nil)
end
elseif opval[op] == 4 then
local chkf = tp
local mg2 = nil
local sg2 = nil
local ce = Duel.GetChainMaterial(tp)
if ce ~= nil then
local fgroup = ce:GetTarget()
mg2 = fgroup(ce, e, tp)
local mf = ce:GetValue()
sg2 = Duel.GetMatchingGroup(function(c, e, tp, m, f, chkf)
return c:IsType(TYPE_FUSION) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_FUSION, tp, false, false) and
c:CheckFusionMaterial(m, nil, chkf)
end, tp, LOCATION_EXTRA, 0, nil, e, tp, mg2, mf, chkf)
end
if rh:GetCount() > 0 or (sg2 ~= nil and sg2:GetCount() > 0) then
local sg = rh:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
local tg = sg:Select(tp, 1, 1, nil)
local tc = tg:GetFirst()
if rh:IsContains(tc) and (sg2 == nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp, ce:GetDescription())) then
local mat1 = Duel.SelectFusionMaterial(tp, tc, mg1, nil, chkf)
tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1, REASON_EFFECT + REASON_MATERIAL + REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc, SUMMON_TYPE_FUSION, tp, tp, false, false, POS_FACEUP)
else
local mat2 = Duel.SelectFusionMaterial(tp, tc, mg2, nil, chkf)
local fop = ce:GetOperation()
fop(ce, e, tp, tc, mat2)
end
tc:CompleteProcedure()
end
end
end
end
end
function cm.atkval(e, c)
return Duel.GetMatchingGroupCount(cm.atkfilter, e:GetHandlerPlayer(), LOCATION_GRAVE + LOCATION_REMOVED, 0, nil) *
500
return Duel.GetMatchingGroupCount(cm.atkfilter, e:GetHandlerPlayer(), LOCATION_GRAVE + LOCATION_REMOVED, 0, nil) *
500
end
function cm.atkfilter(c)
return aux.IsCodeListed(c, yr) and c:IsType(TYPE_EQUIP)
return aux.IsCodeListed(c, yr) and c:IsType(TYPE_EQUIP)
end
--所谓伊人
local cm, m, ofs = GetID()
local yr = 13020010
xpcall(function() dofile("expansions/script/c16670000.lua") end, function() dofile("script/c16670000.lua") end) --引用库
-- xpcall(function() dofile("expansions/script/c16670000.lua") end, function() dofile("script/c16670000.lua") end) --引用库
if not Duel.LoadScript and loadfile then
function Duel.LoadScript(str)
require_list = require_list or {}
str = "expansions/script/" .. str
if not require_list[str] then
if string.find(str, "%.") then
require_list[str] = loadfile(str)
else
require_list[str] = loadfile(str .. ".lua")
end
pcall(require_list[str])
end
return require_list[str]
end
end
Duel.LoadScript("c16670000.lua")
function cm.initial_effect(c)
aux.AddCodeList(c, yr)
-- local e1 = xg.epp2(c, m, 1, nil, 3, QY_sp, cm.setcon2, cm.cost, cm.target, cm.operation, true) --使用库内函数进行便捷注册
......
--在水一方
local cm, m, ofs = GetID()
local yr = 13020010
xpcall(function() dofile("expansions/script/c16670000.lua") end, function() dofile("script/c16670000.lua") end) --引用库
-- xpcall(function() dofile("expansions/script/c16670000.lua") end, function() dofile("script/c16670000.lua") end) --引用库
if not Duel.LoadScript and loadfile then
function Duel.LoadScript(str)
require_list = require_list or {}
str = "expansions/script/" .. str
if not require_list[str] then
if string.find(str, "%.") then
require_list[str] = loadfile(str)
else
require_list[str] = loadfile(str .. ".lua")
end
pcall(require_list[str])
end
return require_list[str]
end
end
Duel.LoadScript("c16670000.lua")
function cm.initial_effect(c)
aux.AddCodeList(c, yr)
--aux.AddEquipSpellEffect(c, true, true, Card.IsFaceup, nil)
......
--在水之泗
local cm, m, ofs = GetID()
local yr = 13020010
xpcall(function() dofile("expansions/script/c16670000.lua") end, function() dofile("script/c16670000.lua") end) --引用库
-- xpcall(function() dofile("expansions/script/c16670000.lua") end, function() dofile("script/c16670000.lua") end) --引用库
if not Duel.LoadScript and loadfile then
function Duel.LoadScript(str)
require_list = require_list or {}
str = "expansions/script/" .. str
if not require_list[str] then
if string.find(str, "%.") then
require_list[str] = loadfile(str)
else
require_list[str] = loadfile(str .. ".lua")
end
pcall(require_list[str])
end
return require_list[str]
end
end
Duel.LoadScript("c16670000.lua")
function cm.initial_effect(c)
aux.AddCodeList(c, yr)
aux.AddEquipSpellEffect(c, true, true, Card.IsFaceup, nil)
......
--在水之湄
local cm, m, ofs = GetID()
local yr = 13020010
xpcall(function() dofile("expansions/script/c16670000.lua") end, function() dofile("script/c16670000.lua") end) --引用库
-- xpcall(function() dofile("expansions/script/c16670000.lua") end, function() dofile("script/c16670000.lua") end) --引用库
if not Duel.LoadScript and loadfile then
function Duel.LoadScript(str)
require_list = require_list or {}
str = "expansions/script/" .. str
if not require_list[str] then
if string.find(str, "%.") then
require_list[str] = loadfile(str)
else
require_list[str] = loadfile(str .. ".lua")
end
pcall(require_list[str])
end
return require_list[str]
end
end
Duel.LoadScript("c16670000.lua")
function cm.initial_effect(c)
aux.AddCodeList(c, yr)
aux.AddEquipSpellEffect(c, true, true, Card.IsFaceup, nil)
......
--在水中央
local cm, m, ofs = GetID()
local yr = 13020010
xpcall(function() dofile("expansions/script/c16670000.lua") end, function() dofile("script/c16670000.lua") end) --引用库
-- xpcall(function() dofile("expansions/script/c16670000.lua") end, function() dofile("script/c16670000.lua") end) --引用库
if not Duel.LoadScript and loadfile then
function Duel.LoadScript(str)
require_list = require_list or {}
str = "expansions/script/" .. str
if not require_list[str] then
if string.find(str, "%.") then
require_list[str] = loadfile(str)
else
require_list[str] = loadfile(str .. ".lua")
end
pcall(require_list[str])
end
return require_list[str]
end
end
Duel.LoadScript("c16670000.lua")
function cm.initial_effect(c)
aux.AddCodeList(c, yr)
aux.AddEquipSpellEffect(c, true, true, Card.IsFaceup, nil)
......@@ -183,7 +200,11 @@ function cm.operation(e, tp, eg, ep, ev, re, r, rp)
if te then
for _, ie in ipairs(te) do
Duel.BreakEffect()
-- Debug.Message(te)
-- Debug.Message(aux.GetValueType(te))
local tg = ie:GetTarget()
-- Debug.Message(tg)
-- Debug.Message(aux.GetValueType(tg))
if tg and tg(ie, tp, eg, ep, ev, re, r, rp, 0) then
local op = ie:GetOperation()
if op then
......
--白露未已
local cm, m, o = GetID()
local yr = 13020010
xpcall(function() dofile("expansions/script/c16670000.lua") end, function() dofile("script/c16670000.lua") end)
-- xpcall(function() dofile("expansions/script/c16670000.lua") end, function() dofile("script/c16670000.lua") end)
if not Duel.LoadScript and loadfile then
function Duel.LoadScript(str)
require_list = require_list or {}
str = "expansions/script/" .. str
if not require_list[str] then
if string.find(str, "%.") then
require_list[str] = loadfile(str)
else
require_list[str] = loadfile(str .. ".lua")
end
pcall(require_list[str])
end
return require_list[str]
end
end
Duel.LoadScript("c16670000.lua")
function cm.initial_effect(c)
c:EnableReviveLimit()
local e1 = Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE + EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.FALSE)
c:RegisterEffect(e1)
local e2 = Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
e2:SetRange(LOCATION_EXTRA)
e2:SetCountLimit(1, m)
e2:SetCondition(cm.condition)
e2:SetOperation(cm.operation)
c:RegisterEffect(e2)
local e11 = Effect.CreateEffect(c)
-- e11:SetDescription(aux.Stringid(m, 0))
e11:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
e11:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
e11:SetProperty(EFFECT_FLAG_DELAY)
e11:SetCode(EVENT_SPSUMMON_SUCCESS)
e11:SetCost(cm.cost)
e11:SetTarget(cm.drtg)
e11:SetOperation(cm.drop)
c:RegisterEffect(e11)
if not cm.global_check then
cm.global_check = true
local e4 = Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
e4:SetCode(EVENT_ADJUST)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_IGNORE_IMMUNE)
e4:SetOperation(cm.adop)
Duel.RegisterEffect(e4, tp)
end
c:EnableReviveLimit()
local e1 = Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE + EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.FALSE)
c:RegisterEffect(e1)
local e2 = Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
e2:SetRange(LOCATION_EXTRA)
e2:SetCountLimit(1, m)
e2:SetCondition(cm.condition)
e2:SetOperation(cm.operation)
c:RegisterEffect(e2)
local e11 = Effect.CreateEffect(c)
-- e11:SetDescription(aux.Stringid(m, 0))
e11:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
e11:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
e11:SetProperty(EFFECT_FLAG_DELAY)
e11:SetCode(EVENT_SPSUMMON_SUCCESS)
e11:SetCost(cm.cost)
e11:SetTarget(cm.drtg)
e11:SetOperation(cm.drop)
c:RegisterEffect(e11)
if not cm.global_check then
cm.global_check = true
local e4 = Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
e4:SetCode(EVENT_ADJUST)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_IGNORE_IMMUNE)
e4:SetOperation(cm.adop)
Duel.RegisterEffect(e4, tp)
end
end
function cm.cfilter(c, e, tp, sc)
return c:IsAbleToDeckAsCost() and aux.IsCodeListed(c, yr) and (c:IsLocation(QY_sk) or
Duel.GetLocationCountFromEx(tp, tp, c, sc) > 0)
return c:IsAbleToDeckAsCost() and aux.IsCodeListed(c, yr) and (c:IsLocation(QY_sk) or
Duel.GetLocationCountFromEx(tp, tp, c, sc) > 0)
end
function cm.cfilter2(c, e, tp, sc)
return c:IsAbleToExtraAsCost() and Duel.GetLocationCountFromEx(tp, tp, c, sc) > 0
return c:IsAbleToExtraAsCost() and Duel.GetLocationCountFromEx(tp, tp, c, sc) > 0
end
function cm.condition(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
local tp = c:GetControler()
local g = Duel.GetMatchingGroup(cm.cfilter, tp, LOCATION_HAND + LOCATION_ONFIELD, 0, nil, e, tp, c)
local g2 = Duel.GetMatchingGroup(cm.cfilter2, tp, LOCATION_ONFIELD, 0, nil, e, tp, c)
return #g > 0 and #g2 > 0
local c = e:GetHandler()
local tp = c:GetControler()
local g = Duel.GetMatchingGroup(cm.cfilter, tp, LOCATION_HAND + LOCATION_ONFIELD, 0, nil, e, tp, c)
local g2 = Duel.GetMatchingGroup(cm.cfilter2, tp, LOCATION_ONFIELD, 0, nil, e, tp, c)
return #g > 0 and #g2 > 0
end
function cm.operation(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
local tp = c:GetControler()
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SELECT)
local g1 = Duel.SelectMatchingCard(tp, cm.cfilter, tp, LOCATION_HAND + LOCATION_ONFIELD, 0, 1, 1, nil, e, tp, c)
local g2 = Duel.SelectMatchingCard(tp, cm.cfilter2, tp, LOCATION_ONFIELD, 0, 1, 1, g1, e, tp, c)
g2:Merge(g1)
c:SetMaterial(g2)
Duel.SendtoDeck(g2, tp, SEQ_DECKSHUFFLE, REASON_COST + REASON_MATERIAL)
local c = e:GetHandler()
local tp = c:GetControler()
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SELECT)
local g1 = Duel.SelectMatchingCard(tp, cm.cfilter, tp, LOCATION_HAND + LOCATION_ONFIELD, 0, 1, 1, nil, e, tp, c)
local g2 = Duel.SelectMatchingCard(tp, cm.cfilter2, tp, LOCATION_ONFIELD, 0, 1, 1, g1, e, tp, c)
g2:Merge(g1)
c:SetMaterial(g2)
Duel.SendtoDeck(g2, tp, SEQ_DECKSHUFFLE, REASON_COST + REASON_MATERIAL)
end
function cm.cfilter3(c, e, tp, sc)
return (c:IsAbleToRemove() or c:IsAbleToGrave()) and aux.IsCodeListed(c, yr)
return (c:IsAbleToRemove() or c:IsAbleToGrave()) and aux.IsCodeListed(c, yr)
end
function cm.cost(e, tp, eg, ep, ev, re, r, rp, chk)
local g = Duel.GetMatchingGroup(cm.cfilter3, tp, QY_kz, 0, nil)
if chk == 0 then return #g > 0 end
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SELECT)
if #g == 0 then return end
local sg = g:Select(tp, 1, 1, nil):GetFirst()
local off = 1
local ops = {}
local opval = {}
if sg:IsAbleToRemove() then
ops[off] = aux.Stringid(m, 0)
opval[off - 1] = 1
off = off + 1
end
if sg:IsAbleToGrave() then
ops[off] = aux.Stringid(m, 1)
opval[off - 1] = 2
off = off + 1
end
local op = Duel.SelectOption(tp, table.unpack(ops))
if opval[op] == 1 then
Duel.SendtoGrave(sg, REASON_EFFECT)
elseif opval[op] == 2 then
Duel.Remove(sg, POS_FACEUP, REASON_EFFECT)
end
e:SetLabel(sg:GetCode())
local g = Duel.GetMatchingGroup(cm.cfilter3, tp, QY_kz, 0, nil)
if chk == 0 then return #g > 0 end
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SELECT)
if #g == 0 then return end
local sg = g:Select(tp, 1, 1, nil):GetFirst()
local off = 1
local ops = {}
local opval = {}
if sg:IsAbleToRemove() then
ops[off] = aux.Stringid(m, 0)
opval[off - 1] = 1
off = off + 1
end
if sg:IsAbleToGrave() then
ops[off] = aux.Stringid(m, 1)
opval[off - 1] = 2
off = off + 1
end
local op = Duel.SelectOption(tp, table.unpack(ops))
if opval[op] == 1 then
Duel.SendtoGrave(sg, REASON_EFFECT)
elseif opval[op] == 2 then
Duel.Remove(sg, POS_FACEUP, REASON_EFFECT)
end
e:SetLabel(sg:GetCode())
end
function cm.cfilter4(c, code)
return c:IsAbleToHand() and aux.IsCodeListed(c, yr) and not c:IsCode(code)
return c:IsAbleToHand() and aux.IsCodeListed(c, yr) and not c:IsCode(code)
end
function cm.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
local c = e:GetHandler()
local code = e:GetLabel()
local g = Duel.GetMatchingGroup(cm.cfilter4, tp, QY_kz + QY_md + QY_cw, 0, nil, code)
if chk == 0 then return #g > 0 end
Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, QY_kz + QY_md + QY_cw)
local c = e:GetHandler()
local code = e:GetLabel()
local g = Duel.GetMatchingGroup(cm.cfilter4, tp, QY_kz + QY_md + QY_cw, 0, nil, code)
if chk == 0 then return #g > 0 end
Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, QY_kz + QY_md + QY_cw)
end
function cm.drop(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
local code = e:GetLabel()
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SELECT)
local g = Duel.GetMatchingGroup(cm.cfilter4, tp, QY_kz + QY_md + QY_cw, 0, nil, code)
local sg = g:Select(tp, 1, 1, nil)
Duel.SendtoHand(sg, tp, REASON_EFFECT)
if Duel.SelectYesNo(tp, aux.Stringid(m, 2)) then
Duel.BreakEffect()
Duel.RegisterFlagEffect(tp, m, RESET_PHASE + PHASE_END, 0, 2)
end
local c = e:GetHandler()
local code = e:GetLabel()
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SELECT)
local g = Duel.GetMatchingGroup(cm.cfilter4, tp, QY_kz + QY_md + QY_cw, 0, nil, code)
local sg = g:Select(tp, 1, 1, nil)
Duel.SendtoHand(sg, tp, REASON_EFFECT)
if Duel.SelectYesNo(tp, aux.Stringid(m, 2)) then
local g = Duel.GetFieldGroup(tp, LOCATION_HAND, 0):Select(tp, 1, 1, nil)
if g:GetCount() > 0 then
Duel.BreakEffect()
if Duel.SendtoDeck(g, nil, SEQ_DECKSHUFFLE, REASON_EFFECT) ~= 0 then
Duel.RegisterFlagEffect(tp, m, RESET_PHASE + PHASE_END, 0, 2)
end
end
end
end
function cm.adop(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
local ng = Duel.GetMatchingGroup(cm.filsn, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE + QY_kz, 0, nil)
local nc = ng:GetFirst()
while nc do
if not cm.reg then
cm.reg = Card.RegisterEffect
Card.RegisterEffect = cm.reg2
end
nc:RegisterFlagEffect(m, 0, 0, 1)
nc:ReplaceEffect(nc:GetOriginalCodeRule(), 0)
nc = ng:GetNext()
end
local c = e:GetHandler()
local ng = Duel.GetMatchingGroup(cm.filsn, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE + QY_kz, 0, nil)
local nc = ng:GetFirst()
while nc do
if not cm.reg then
cm.reg = Card.RegisterEffect
Card.RegisterEffect = cm.reg2
end
nc:RegisterFlagEffect(m, 0, 0, 1)
nc:ReplaceEffect(nc:GetOriginalCodeRule(), 0)
nc = ng:GetNext()
end
end
function cm.filsn(c)
return aux.IsCodeListed(c, yr) and c:GetFlagEffect(m) == 0
return aux.IsCodeListed(c, yr) and c:GetFlagEffect(m) == 0
end
function cm.reg2(c, ie, ob)
local b = ob or false
local p = ie:GetCode()
local id, ida = ie:GetCountLimit()
if not aux.IsCodeListed(c, yr) or not ie:IsActivated() or (not id and not ida and
bit.band(ie:GetProperty(), EFFECT_FLAG_CARD_TARGET) == 0) then
return cm.reg(c, ie, b)
end
-- Debug.Message(id, ida)
local co = ie:GetCondition()
local ie2 = ie:Clone()
if id or ida then
ie2:SetCountLimit(id + 1, ida)
end
ie2:SetCondition(function(e, tp, eg, ep, ev, re, r, rp)
local code = Duel.GetFlagEffect(tp, m)
return (not co or co(e, tp, eg, ep, ev, re, r, rp)) and code > 0
end)
if bit.band(ie2:GetProperty(), EFFECT_FLAG_CARD_TARGET) ~= 0 then
local tn = ie:GetTarget()
ie2:SetProperty(ie2:GetProperty() - EFFECT_FLAG_CARD_TARGET)
ie2:SetTarget(function(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
local exis = Duel.IsExistingTarget
local exis2 = Duel.SelectTarget
local operat = Duel.SetOperationInfo
Duel.IsExistingTarget = function(fun, tp2, s1, o1, num, cg, ...)
-- cm[ie2] = { tp, fun, tp2, s1, o1, num, cg, ... }
return Duel.IsExistingMatchingCard(fun, tp2, s1, o1, num, cg, ...)
end
Duel.SelectTarget = function(tp1, fun, tp2, s1, o1, min, max, cg, ...)
local t = { ... }
for _, va in ipairs(t) do
if aux.GetValueType(va) == "Group" then
Group.KeepAlive(va)
end
end
cm[ie2] = { tp1, fun, tp2, s1, o1, min, max, cg, { ... } }
-- Duel.ConfirmCards(tp, table.unpack({ ... }))
return Group.CreateGroup()
end
Duel.SetOperationInfo = function(chainc, category, targets, count, target_player, target_param)
return operat(chainc, category, nil, count, target_player, target_param)
end
local jg = tn(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
Duel.IsExistingTarget = exis
Duel.SelectTarget = exis2
Duel.SetOperationInfo = operat
return jg
end)
local op = ie:GetOperation()
ie2:SetOperation(function(e, tp, eg, ep, ev, re, r, rp)
local ma = cm[ie2]
-- Debug.Message(ma[0])
-- Debug.Message(ma[1])
-- Debug.Message(ma[2])
-- Debug.Message(ma[3])
-- Debug.Message(ma[4])
-- Debug.Message(ma[5])
-- Debug.Message(ma[6])
-- Debug.Message(table.unpack(ma[8]))
-- Duel.ConfirmCards(tp, table.unpack(ma[9]))
local g = Duel.SelectMatchingCard(ma[1], ma[2], ma[3], ma[4], ma[5], ma[6], ma[7], ma[8],
table.unpack(ma[9]))
--ma[0], ma[1], ma[2], ma[3], ma[4], 1, ma[5],ma[6], table.unpack(ma[7])
-- local g = Group.CreateGroup()
local xta = Duel.GetFirstTarget
Duel.GetFirstTarget = function() return g:GetFirst(), g:GetNext(), g:GetNext(), g:GetNext() end
for tc in aux.Next(g) do
tc:CreateEffectRelation(e)
end
op(e, tp, eg, ep, ev, re, r, rp)
Duel.GetFirstTarget = xta
end)
end
ie:SetCondition(function(e, tp, eg, ep, ev, re, r, rp)
local code = Duel.GetFlagEffect(tp, m)
return (not co or co(e, tp, eg, ep, ev, re, r, rp)) and code == 0
end)
return cm.reg(c, ie, b), cm.reg(c, ie2, b)
local b = ob or false
local p = ie:GetCode()
local id, ida = ie:GetCountLimit()
if not aux.IsCodeListed(c, yr) or not ie:IsActivated() or (not id and not ida and
bit.band(ie:GetProperty(), EFFECT_FLAG_CARD_TARGET) == 0) then
return cm.reg(c, ie, b)
end
-- Debug.Message(id, ida)
local co = ie:GetCondition()
local ie2 = ie:Clone()
if id or ida then
ie2:SetCountLimit(id + 1, ida)
end
ie2:SetCondition(function(e, tp, eg, ep, ev, re, r, rp)
local code = Duel.GetFlagEffect(tp, m)
return (not co or co(e, tp, eg, ep, ev, re, r, rp)) and code > 0
end)
if bit.band(ie2:GetProperty(), EFFECT_FLAG_CARD_TARGET) ~= 0 then
local tn = ie:GetTarget()
ie2:SetProperty(ie2:GetProperty() - EFFECT_FLAG_CARD_TARGET)
ie2:SetTarget(function(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
local exis = Duel.IsExistingTarget
local exis2 = Duel.SelectTarget
local operat = Duel.SetOperationInfo
Duel.IsExistingTarget = function(fun, tp2, s1, o1, num, cg, ...)
-- cm[ie2] = { tp, fun, tp2, s1, o1, num, cg, ... }
return Duel.IsExistingMatchingCard(fun, tp2, s1, o1, num, cg, ...)
end
Duel.SelectTarget = function(tp1, fun, tp2, s1, o1, min, max, cg, ...)
local t = { ... }
for _, va in ipairs(t) do
if aux.GetValueType(va) == "Group" then
Group.KeepAlive(va)
end
end
cm[ie2] = { tp1, fun, tp2, s1, o1, min, max, cg, { ... } }
-- Duel.ConfirmCards(tp, table.unpack({ ... }))
return Group.CreateGroup()
end
Duel.SetOperationInfo = function(chainc, category, targets, count, target_player, target_param)
return operat(chainc, category, nil, count, target_player, target_param)
end
local jg = tn(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
Duel.IsExistingTarget = exis
Duel.SelectTarget = exis2
Duel.SetOperationInfo = operat
return jg
end)
local op = ie:GetOperation()
ie2:SetOperation(function(e, tp, eg, ep, ev, re, r, rp)
local ma = cm[ie2]
-- Debug.Message(ma[0])
-- Debug.Message(ma[1])
-- Debug.Message(ma[2])
-- Debug.Message(ma[3])
-- Debug.Message(ma[4])
-- Debug.Message(ma[5])
-- Debug.Message(ma[6])
-- Debug.Message(table.unpack(ma[8]))
-- Duel.ConfirmCards(tp, table.unpack(ma[9]))
local g = Duel.SelectMatchingCard(ma[1], ma[2], ma[3], ma[4], ma[5], ma[6], ma[7], ma[8],
table.unpack(ma[9]))
--ma[0], ma[1], ma[2], ma[3], ma[4], 1, ma[5],ma[6], table.unpack(ma[7])
-- local g = Group.CreateGroup()
local xta = Duel.GetFirstTarget
Duel.GetFirstTarget = function() return g:GetFirst(), g:GetNext(), g:GetNext(), g:GetNext() end
for tc in aux.Next(g) do
tc:CreateEffectRelation(e)
end
op(e, tp, eg, ep, ev, re, r, rp)
Duel.GetFirstTarget = xta
end)
end
ie:SetCondition(function(e, tp, eg, ep, ev, re, r, rp)
local code = Duel.GetFlagEffect(tp, m)
return (not co or co(e, tp, eg, ep, ev, re, r, rp)) and code == 0
end)
return cm.reg(c, ie, b), cm.reg(c, ie2, b)
end
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