Commit 032bd407 authored by Grajade's avatar Grajade

Update c66917001.lua

parent b495120b
......@@ -27,16 +27,13 @@ end
function cm.thfilter1(c)
return c:IsType(TYPE_MONSTER) and c:IsFaceup()
end
function cm.spfilter0(c)
return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial()
end
function cm.spfilter1(c,e)
return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and not c:IsImmuneToEffect(e)
return not c:IsImmuneToEffect(e)
end
function cm.spfilter2(c,e,tp,m,f,chkf)
if not (c:IsType(TYPE_FUSION) and aux.IsMaterialListCode(c,66917000) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false)) then return false end
aux.FCheckAdditional=c.starlight_fusion_check or cm.fcheck
aux.FCheckAdditional=c.starlight_fusion_check or c66917001.fcheck
local res=c:CheckFusionMaterial(m,nil,chkf)
aux.FCheckAdditional=nil
return res
......@@ -44,22 +41,6 @@ end
function cm.fcheck(tp,sg,fc)
return sg:IsExists(Card.IsFusionCode,1,nil,66917000)
end
function cm.spfilter3(c,e,tp,chkf,rc)
if not (c:IsType(TYPE_FUSION) and aux.IsMaterialListCode(c,66917000)) then return false end
if Duel.GetLocationCountFromEx(tp,tp,rc,c)<=0 then return false end
local mg=Duel.GetMatchingGroup(cm.spfilter0,tp,LOCATION_HAND+LOCATION_MZONE,0,c)
local res=cm.spfilter2(c,e,tp,mg,nil,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=cm.spfilter2(c,e,tp,mg,mf,chkf)
end
end
return res
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,66917008,0,0x4011,0,0,4,RACE_SPELLCASTER,ATTRIBUTE_LIGHT,POS_FACEUP) and Duel.IsExistingTarget(cm.thfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
......@@ -90,40 +71,49 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
e2:SetOperation(f)
token:RegisterEffect(e2)
local chkf=tp
if not Duel.IsExistingMatchingCard(cm.spfilter3,tp,LOCATION_EXTRA,0,1,nil,e,tp,chkf,e:GetHandler()) or not Duel.IsPlayerCanSpecialSummonCount(tp,1) then return end
if Duel.SelectYesNo(tp,aux.Stringid(m,2)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELECT)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.spfilter3),tp,LOCATION_EXTRA,0,1,1,nil,e,tp,chkf,nil)
local tc=g:GetFirst()
if tc and tc:IsLocation(LOCATION_EXTRA) then
local mg1=Duel.GetMatchingGroup(cm.spfilter1,tp,LOCATION_HAND+LOCATION_MZONE,0,nil,e)
local mgchk1=cm.spfilter2(tc,e,tp,mg1,nil,chkf)
local mg2=nil
local mgchk2=false
local mg1=Duel.GetFusionMaterial(tp):Filter(c66917001.spfilter1,nil,e)
local res=Duel.IsExistingMatchingCard(c66917001.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp)
local mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
mgchk2=cm.spfilter2(tc,e,tp,mg2,mf,chkf)
res=Duel.IsExistingMatchingCard(c66917001.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,chkf)
end
end
if mgchk1 or mgchk2 then
if mgchk1 and (not mgchk2 or not Duel.SelectYesNo(tp,ce:GetDescription())) then
if res and Duel.SelectYesNo(tp,aux.Stringid(m,2)) then
local sg1=Duel.GetMatchingGroup(c66917001.spfilter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
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(c66917001.spfilter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg3,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1: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()
aux.FCheckAdditional=tc.starlight_fusion_check or c66917001.fcheck
if sg1: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 mat2=Duel.SelectFusionMaterial(tp,tc,mg3,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end
else
end
end
end
function cm.mfilter(c)
......
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