Commit fac3b86c authored by 2924713558's avatar 2924713558 Committed by GitHub

Update c1110115.lua

parent 0418ce22
---庄生梦蝶- ---庄生梦蝶-
function c1110115.initial_effect(c) function c1110115.initial_effect(c)
-- --
aux.AddCodeList(c,1110196) aux.AddCodeList(c,1110196)
--[[
c1110115.Fusion_Muxu(c,
aux.OR(c1110115.FusFilter1,c1110115.FusFilter2),
c1110115.f(c1110115.FusFilter1,c1110115.FusFilter2),
2,2,true)
]]--
c1110115.AddFusionProcMix(c,true,true,1110196,c1110115.FusFilter2)
-- --
c1110115.Fusion_Muxu(c, local e1=Effect.CreateEffect(c)
aux.OR(c1110115.FusFilter1,c1110115.FusFilter2), e1:SetDescription(aux.Stringid(1110115,0))
c1110115.f(c1110115.FusFilter1,c1110115.FusFilter2), e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
2,2,true) e1:SetType(EFFECT_TYPE_IGNITION)
-- e1:SetRange(LOCATION_MZONE)
local e1=Effect.CreateEffect(c) e1:SetLabel(0)
e1:SetDescription(aux.Stringid(1110115,0)) e1:SetCost(c1110115.cost1)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetTarget(c1110115.tg1)
e1:SetType(EFFECT_TYPE_IGNITION) e1:SetOperation(c1110115.op1)
e1:SetRange(LOCATION_MZONE) c:RegisterEffect(e1)
e1:SetLabel(0)
e1:SetCost(c1110115.cost1)
e1:SetTarget(c1110115.tg1)
e1:SetOperation(c1110115.op1)
c:RegisterEffect(e1)
-- --
end end
-- --
function c1110115.FusFilter1(c) function c1110115.FusFilter1(c)
return c:IsFusionCode(1110196) or c:IsHasEffect(EFFECT_FUSION_SUBSTITUTE) return c:IsFusionCode(1110196) or c:IsHasEffect(EFFECT_FUSION_SUBSTITUTE)
end end
function c1110115.FusFilter2(c) function c1110115.FusFilter2(c)
return c:IsFusionType(TYPE_EFFECT) return c:IsFusionType(TYPE_EFFECT)
end end
-- --
function c1110115.Fusion_Muxu(c,mf,f,min,max,myon,sub) function c1110115.Fusion_Muxu(c,mf,f,min,max,myon,sub)
c:EnableReviveLimit() c:EnableReviveLimit()
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_FUSION_MATERIAL) e1:SetCode(EFFECT_FUSION_MATERIAL)
e1:SetCondition(c1110115.FusionCondition1(mf,f,min,max,myon,sub)) e1:SetCondition(c1110115.FusionCondition1(mf,f,min,max,myon,sub))
e1:SetOperation(c1110115.FusionOperation1(mf,f,min,max,myon,sub)) e1:SetOperation(c1110115.FusionOperation1(mf,f,min,max,myon,sub))
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
-- --
function c1110115.MyonCheckFilter(c,ec,myon) --function c1110115.MyonCheckFilter(c,ec,myon)
return myon and c:IsFaceup() and c:IsCanBeFusionMaterial(ec) -- return myon and c:IsFaceup() and c:IsCanBeFusionMaterial(ec)
end --end
function c1110115.FusFilterALL(c,fc,mf,sub) function c1110115.FusFilterALL(c,fc,mf,sub)
return c:IsCanBeFusionMaterial(fc) and not c:IsHasEffect(6205579) and ((not mf or mf(c,fc,sub))) return c:IsCanBeFusionMaterial(fc) and not c:IsHasEffect(6205579) and ((not mf or mf(c,fc,sub)))
end end
function c1110115.CheckGroup(g,f,cg,min,max,...) function c1110115.CheckGroup(g,f,cg,min,max,...)
if cg then Duel.SetSelectedCard(cg) end if cg then Duel.SetSelectedCard(cg) end
return g:CheckSubGroup(f,min,max,...) return g:CheckSubGroup(f,min,max,...)
end end
function c1110115.FusionCheckALL(g,min,tp,fc,f,chkf,sub) function c1110115.FusionCheckALL(g,min,tp,fc,f,chkf,sub)
if g:IsExists(aux.TuneMagicianCheckX,nil,g,EFFECT_TUNE_MAGICIAN_F) then return false end if g:IsExists(aux.TuneMagicianCheckX,nil,g,EFFECT_TUNE_MAGICIAN_F) then return false end
if chkf~=PLAYER_NONE and Duel.GetLocationCountFromEx(chkf,tp,g,fc)<1 then return false end if chkf~=PLAYER_NONE and Duel.GetLocationCountFromEx(chkf,tp,g,fc)<1 then return false end
if aux.FCheckAdditional and not aux.FCheckAdditional(tp,g,fc) then return false end if aux.FCheckAdditional and not aux.FCheckAdditional(tp,g,fc) then return false end
return #g>=min and (not f or f(g,fc,sub)) return #g>=min and (not f or f(g,fc,sub))
end end
function c1110115.FusionCondition1(mf,f,min,max,myon,sub) function c1110115.FusionCondition1(mf,f,min,max,myon,sub)
return function(e,g,gc,chkfnf) return function(e,g,gc,chkfnf)
if g==nil then return true end if g==nil then return true end
local c=e:GetHandler() local c=e:GetHandler()
local chkf=(chkfnf & 0xff) local chkf=(chkfnf & 0xff)
local mg=g:Filter(c1110115.FusFilterALL,nil,e:GetHandler(),mf,sub) local mg=g:Filter(c1110115.FusFilterALL,nil,e:GetHandler(),mf,sub)
local tp=e:GetHandlerPlayer() local tp=e:GetHandlerPlayer()
local exg=Duel.GetMatchingGroup(c1110115.MyonCheckFilter,tp,0,LOCATION_MZONE,nil,c,myon) local exg=Duel.GetMatchingGroup(c1110115.MyonCheckFilter,tp,0,LOCATION_MZONE,nil,c,myon)
mg:Merge(exg) mg:Merge(exg)
local sg=Group.CreateGroup() local sg=Group.CreateGroup()
if gc then if gc then
if not c1110115.FusFilterALL(gc,fc,mf,sub) then return false end if not c1110115.FusFilterALL(gc,fc,mf,sub) then return false end
sg:AddCard(gc) sg:AddCard(gc)
end end
local ce={Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_FMATERIAL)} local ce={Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_FMATERIAL)}
for _,te in ipairs(ce) do for _,te in ipairs(ce) do
local tc=te:GetHandler() local tc=te:GetHandler()
if not mg:IsContains(tc) then return false end if not mg:IsContains(tc) then return false end
sg:AddCard(tc) sg:AddCard(tc)
end end
return c1110115.CheckGroup(mg,c1110115.FusionCheckALL,sg,1,max,min,tp,c,f,chkfnf,sub) return c1110115.CheckGroup(mg,c1110115.FusionCheckALL,sg,1,max,min,tp,c,f,chkfnf,sub)
end end
end end
function c1110115.SelectGroup(tp,desc,cancelable,g,f,cg,min,max,...) function c1110115.SelectGroup(tp,desc,cancelable,g,f,cg,min,max,...)
local min=min or 1 local min=min or 1
local max=max or #g local max=max or #g
local ext_params={...} local ext_params={...}
if cg then Duel.SetSelectedCard(cg) end if cg then Duel.SetSelectedCard(cg) end
Duel.Hint(tp,HINT_SELECTMSG,desc) Duel.Hint(tp,HINT_SELECTMSG,desc)
return g:SelectSubGroup(tp,f,cancelable,min,max,...) return g:SelectSubGroup(tp,f,cancelable,min,max,...)
end end
function c1110115.FusionOperation1(mf,f,min,max,myon,sub) function c1110115.FusionOperation1(mf,f,min,max,myon,sub)
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 chkf=(chkfnf & 0xff) local chkf=(chkfnf & 0xff)
local mg=eg:Filter(c1110115.FusFilterALL,nil,e:GetHandler(),mf,sub) local mg=eg:Filter(c1110115.FusFilterALL,nil,e:GetHandler(),mf,sub)
local exg=Duel.GetMatchingGroup(c1110115.MyonCheckFilter,tp,0,LOCATION_MZONE,nil,c,myon) local exg=Duel.GetMatchingGroup(c1110115.MyonCheckFilter,tp,0,LOCATION_MZONE,nil,c,myon)
mg:Merge(exg) mg:Merge(exg)
local sg=Group.CreateGroup() local sg=Group.CreateGroup()
if gc then if gc then
sg:AddCard(gc) sg:AddCard(gc)
end end
local ce={Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_FMATERIAL)} local ce={Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_FMATERIAL)}
for _,te in ipairs(ce) do for _,te in ipairs(ce) do
local tc=te:GetHandler() local tc=te:GetHandler()
sg:AddCard(tc) sg:AddCard(tc)
end end
local g=c1110115.SelectGroup(tp,HINTMSG_FMATERIAL,false,mg,c1110115.FusionCheckALL,sg,1,max,min,tp,c,f,chkf,sub) local g=c1110115.SelectGroup(tp,HINTMSG_FMATERIAL,false,mg,c1110115.FusionCheckALL,sg,1,max,min,tp,c,f,chkf,sub)
Duel.SetFusionMaterial(g) Duel.SetFusionMaterial(g)
end end
end end
-- --
function c1110115.f(...) function c1110115.f(...)
local list={...} local list={...}
return function(g,fc,sub) return function(g,fc,sub)
return g:IsExists(c1110115.cf,1,nil,g,list,1,fc,sub) return g:IsExists(c1110115.cf,1,nil,g,list,1,fc,sub)
end end
end end
function c1110115.cf(c,g,list,ct,fc,sub) function c1110115.cf(c,g,list,ct,fc,sub)
local f=list[ct] local f=list[ct]
if not f(c,fc,sub) then return false end if not f(c,fc,sub) then return false end
if ct==#list then return true end if ct==#list then return true end
local res=false local res=false
g:RemoveCard(c) g:RemoveCard(c)
if sub and f(c,fc,false) then if sub and f(c,fc,false) then
res=g:IsExists(c1110115.cf,1,nil,g,list,ct+1,fc,true) res=g:IsExists(c1110115.cf,1,nil,g,list,ct+1,fc,true)
else else
res=g:IsExists(c1110115.cf,1,nil,g,list,ct+1,fc,false) res=g:IsExists(c1110115.cf,1,nil,g,list,ct+1,fc,false)
end end
g:AddCard(c) g:AddCard(c)
return res return res
end end
-- --
function c1110115.cost1(e,tp,eg,ep,ev,re,r,rp,chk) function c1110115.cost1(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(100) e:SetLabel(100)
if chk==0 then return true end if chk==0 then return true end
end end
-- --
function c1110115.tfilter1(c,e,tp,fusc,mg) function c1110115.tfilter1(c,e,tp,fusc,mg)
return c:IsLocation(LOCATION_GRAVE) return c:IsLocation(LOCATION_GRAVE)
and bit.band(c:GetReason(),0x40008)==0x40008 and c:GetReasonCard()==fusc and c:GetReasonCard()==fusc
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and bit.band(c:GetReason(),0x40008)==0x40008
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end end
function c1110115.tg1(e,tp,eg,ep,ev,re,r,rp,chk) function c1110115.tg1(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
local mg=c:GetMaterial() local mg=c:GetMaterial()
local ct=mg:GetCount() local ct=mg:GetCount()
local sumtype=c:GetSummonType() local sumtype=c:GetSummonType()
if chk==0 then if chk==0 then
if e:GetLabel()~=100 then return false end if e:GetLabel()~=100 then return false end
e:SetLabel(0) e:SetLabel(0)
return bit.band(sumtype,SUMMON_TYPE_FUSION)~=0 return bit.band(sumtype,SUMMON_TYPE_FUSION)~=0
and ct>0 and ct<=Duel.GetMZoneCount(tp) and ct>0 and ct<=Duel.GetMZoneCount(tp)
and mg:FilterCount(aux.NecroValleyFilter(c1110115.tfilter1),nil,e,tp,c,mg)==ct and mg:FilterCount(aux.NecroValleyFilter(c1110115.tfilter1),nil,e,tp,c,mg)==ct
and not Duel.IsPlayerAffectedByEffect(tp,59822133) and not Duel.IsPlayerAffectedByEffect(tp,59822133)
and c:IsReleasable() and c:IsReleasable()
end end
mg:KeepAlive() mg:KeepAlive()
e:SetLabelObject(mg) e:SetLabelObject(mg)
local tc=mg:GetFirst() local tc=mg:GetFirst()
while tc do while tc do
tc:CreateEffectRelation(e) tc:CreateEffectRelation(e)
tc=mg:GetNext() tc=mg:GetNext()
end end
Duel.Release(c,REASON_COST) Duel.Release(c,REASON_COST)
end end
-- --
function c1110115.ofilter1(c,e) function c1110115.ofilter1(c,e)
return c:IsRelateToEffect(e) return c:IsRelateToEffect(e)
end end
function c1110115.ofilter2(c,tp) function c1110115.ofilter2(c,tp)
return c:GetOwner()~=tp return c:GetOwner()~=tp
end end
function c1110115.op1(e,tp,eg,ep,ev,re,r,rp) function c1110115.op1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local mg=e:GetLabelObject() local mg=e:GetLabelObject()
local ct=mg:GetCount() local ct=mg:GetCount()
if ct>0 and ct<=Duel.GetMZoneCount(tp) if ct>0 and ct<=Duel.GetMZoneCount(tp)
and mg:FilterCount(c1110115.ofilter1,nil,e)==mg:GetCount() and mg:FilterCount(c1110115.ofilter1,nil,e)==mg:GetCount()
and mg:FilterCount(aux.NecroValleyFilter(c1110115.tfilter1),nil,e,tp,c,mg)==ct and mg:FilterCount(aux.NecroValleyFilter(c1110115.tfilter1),nil,e,tp,c,mg)==ct
and not Duel.IsPlayerAffectedByEffect(tp,59822133) then and not Duel.IsPlayerAffectedByEffect(tp,59822133) then
if Duel.SpecialSummon(mg,0,tp,tp,false,false,POS_FACEUP)>0 then if Duel.SpecialSummon(mg,0,tp,tp,false,false,POS_FACEUP)>0 then
local lg=mg:Filter(c1110115.ofilter2,nil,tp) local lg=mg:Filter(c1110115.ofilter2,nil,tp)
if lg:GetCount()<1 then return end if lg:GetCount()<1 then return end
local lc=lg:GetFirst() local lc=lg:GetFirst()
while lc do while lc do
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE) e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) e3:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e3:SetValue(1) e3:SetValue(1)
e3:SetReset(RESET_EVENT+0x1fe0000) e3:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e3,true) c:RegisterEffect(e3,true)
lc=lg:GetNext() lc=lg:GetNext()
end end
end end
end end
end
--
function c1110115.AddFusionProcMix(c,sub,insf,...)
if c:IsStatus(STATUS_COPYING_EFFECT) then return end
local val={...}
local fun={}
local mat={}
for i=1,#val do
if type(val[i])=='function' then
fun[i]=function(c,fc,sub,mg,sg) return val[i](c,fc,sub,mg,sg) and not c:IsHasEffect(6205579) end
elseif type(val[i])=='table' then
fun[i]=function(c,fc,sub,mg,sg)
for _,fcode in ipairs(val[i]) do
if type(fcode)=='function' then
if fcode(c,fc,sub,mg,sg) and not c:IsHasEffect(6205579) then return true end
else
if c:IsFusionCode(fcode) or (sub and c:CheckFusionSubstitute(fc)) then return true end
end
end
return false
end
for _,fcode in ipairs(val[i]) do
if type(fcode)~='function' then mat[fcode]=true end
end
else
fun[i]=function(c,fc,sub) return c:IsFusionCode(val[i]) or (sub and c:CheckFusionSubstitute(fc)) end
mat[val[i]]=true
end
end
if c.material==nil then
local mt=getmetatable(c)
mt.material=mat
end
for index,_ in pairs(mat) do
Auxiliary.AddCodeList(c,index)
end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_FUSION_MATERIAL)
e1:SetCondition(c1110115.FConditionMix(insf,sub,table.unpack(fun)))
e1:SetOperation(c1110115.FOperationMix(insf,sub,table.unpack(fun)))
c:RegisterEffect(e1)
end
--
function c1110115.MyonCheckFilter(c,ec)
return c:IsFaceup() and c:IsCanBeFusionMaterial(ec)
end
function c1110115.FConditionMix(insf,sub,...)
local funs={...}
return
function(e,g,gc,chkfnf)
if g==nil then return insf and Auxiliary.MustMaterialCheck(nil,e:GetHandlerPlayer(),EFFECT_MUST_BE_FMATERIAL) end
local c=e:GetHandler()
local tp=c:GetControler()
local notfusion=chkfnf&0x100>0
local concat_fusion=chkfnf&0x200>0
local sub=(sub or notfusion) and not concat_fusion
local mg=g:Filter(Auxiliary.FConditionFilterMix,c,c,sub,concat_fusion,table.unpack(funs))
local exg=Duel.GetMatchingGroup(c1110115.MyonCheckFilter,tp,0,LOCATION_MZONE,nil,c)
mg:Merge(exg)
if gc then
if not mg:IsContains(gc) then return false end
Duel.SetSelectedCard(Group.FromCards(gc))
end
return mg:CheckSubGroup(Auxiliary.FCheckMixGoal,#funs,#funs,tp,c,sub,chkfnf,table.unpack(funs))
end
end
--
function c1110115.FOperationMix(insf,sub,...)
local funs={...}
return
function(e,tp,eg,ep,ev,re,r,rp,gc,chkfnf)
local c=e:GetHandler()
local tp=c:GetControler()
local notfusion=chkfnf&0x100>0
local concat_fusion=chkfnf&0x200>0
local sub=(sub or notfusion) and not concat_fusion
local mg=eg:Filter(Auxiliary.FConditionFilterMix,c,c,sub,concat_fusion,table.unpack(funs))
local exg=Duel.GetMatchingGroup(c1110115.MyonCheckFilter,tp,0,LOCATION_MZONE,nil,c)
mg:Merge(exg)
if gc then Duel.SetSelectedCard(Group.FromCards(gc)) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local sg=mg:SelectSubGroup(tp,Auxiliary.FCheckMixGoal,false,#funs,#funs,tp,c,sub,chkfnf,table.unpack(funs))
Duel.SetFusionMaterial(sg)
end
end 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