Commit 032bd407 authored by Grajade's avatar Grajade

Update c66917001.lua

parent b495120b
...@@ -27,16 +27,13 @@ end ...@@ -27,16 +27,13 @@ end
function cm.thfilter1(c) function cm.thfilter1(c)
return c:IsType(TYPE_MONSTER) and c:IsFaceup() return c:IsType(TYPE_MONSTER) and c:IsFaceup()
end end
function cm.spfilter0(c)
return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial()
end
function cm.spfilter1(c,e) function cm.spfilter1(c,e)
return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and not c:IsImmuneToEffect(e) return not c:IsImmuneToEffect(e)
end end
function cm.spfilter2(c,e,tp,m,f,chkf) 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)) 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 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) local res=c:CheckFusionMaterial(m,nil,chkf)
aux.FCheckAdditional=nil aux.FCheckAdditional=nil
return res return res
...@@ -44,22 +41,6 @@ end ...@@ -44,22 +41,6 @@ end
function cm.fcheck(tp,sg,fc) function cm.fcheck(tp,sg,fc)
return sg:IsExists(Card.IsFusionCode,1,nil,66917000) return sg:IsExists(Card.IsFusionCode,1,nil,66917000)
end 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) function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 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 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) ...@@ -90,40 +71,49 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
e2:SetOperation(f) e2:SetOperation(f)
token:RegisterEffect(e2) token:RegisterEffect(e2)
local chkf=tp 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 local mg1=Duel.GetFusionMaterial(tp):Filter(c66917001.spfilter1,nil,e)
if Duel.SelectYesNo(tp,aux.Stringid(m,2)) then local res=Duel.IsExistingMatchingCard(c66917001.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELECT) if not res then
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 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()
mg2=fgroup(ce,e,tp) local mg2=fgroup(ce,e,tp)
local mf=ce:GetValue() 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 end
if mgchk1 or mgchk2 then if res and Duel.SelectYesNo(tp,aux.Stringid(m,2)) then
if mgchk1 and (not mgchk2 or not Duel.SelectYesNo(tp,ce:GetDescription())) 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) local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
tc:SetMaterial(mat1) tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION) Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect() Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf) local mat2=Duel.SelectFusionMaterial(tp,tc,mg3,nil,chkf)
local fop=ce:GetOperation() local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2) fop(ce,e,tp,tc,mat2)
end end
tc:CompleteProcedure() tc:CompleteProcedure()
end end
end end
else
end
end end
end end
function cm.mfilter(c) 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