Commit 03d15dc7 authored by Nemo Ma's avatar Nemo Ma

fix

parent 5d3e60bb
No preview for this file type
......@@ -29,7 +29,7 @@ function cm.reop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.SelectYesNo(tp,aux.Stringid(m,0)) then
Duel.Hint(HINT_CARD,1-tp,m)
Duel.Remove(c,POS_FACEUP,REASON_RULE)
Duel.Remove(c,POS_FACEDOWN,REASON_RULE)
if c:GetPreviousLocation()==LOCATION_HAND then
Duel.Draw(tp,1,REASON_RULE)
end
......
......@@ -3,17 +3,19 @@ local m=188801
local cm=_G["c"..m]
function cm.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
c:EnableReviveLimit()
--spsummon
local e0=Effect.CreateEffect(c)
e0:SetDescription(aux.Stringid(m,1))
e0:SetType(EFFECT_TYPE_FIELD)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_PROC)
e0:SetRange(LOCATION_EXTRA)
e0:SetOperation(cm.hspop)
c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,1))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(cm.syncon)
e1:SetTarget(cm.syntg)
e1:SetOperation(cm.synop)
e1:SetValue(SUMMON_TYPE_SYNCHRO)
c:RegisterEffect(e1)
--atkup
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
......@@ -47,34 +49,146 @@ function cm.initial_effect(c)
e6:SetValue(1)
c:RegisterEffect(e6)
end
function cm.hspfilter(c,tp,sc)
return c:IsControler(tp) and Duel.GetLocationCountFromEx(tp,tp,c,sc)>0 and c:IsCanBeFusionMaterial(sc,SUMMON_TYPE_SPECIAL)
function cm.CheckGroup(g,f,cg,min,max,...)
if cg then Duel.SetSelectedCard(cg) end
return g:CheckSubGroup(f,min,max,...)
end
function cm.SelectGroupNew(tp,desc,cancelable,g,f,cg,min,max,...)
local min=min or 1
local max=max or #g
local ext_params={...}
if cg then Duel.SetSelectedCard(cg) end
Duel.Hint(tp,HINT_SELECTMSG,desc)
return g:SelectSubGroup(tp,f,cancelable,min,max,...)
end
function cm.SelectGroup(tp,desc,g,f,cg,min,max,...)
return cm.SelectGroupNew(tp,desc,false,g,f,cg,min,max,...)
end
function cm.matfilter1(c,syncard,tp)
if c:IsFacedown() then return false end
if c:IsLocation(LOCATION_OVERLAY) and c:IsLevelAbove(1) then return c:IsSetCard(0x7e) or c:IsSynchroType(TYPE_TUNER) end
return c:IsSynchroType(TYPE_TUNER) and c:IsCanBeSynchroMaterial(syncard)
end
function cm.ckfilter(c,mg,tc)
return c:IsType(TYPE_TUNER) or (c:IsSetCard(0x7e) and mg:IsContains(c)) and c:IsCanBeFusionMaterial(tc,SUMMON_TYPE_SPECIAL)
function cm.matfilter2(c,syncard)
if c:IsLocation(LOCATION_OVERLAY) and c:IsLevelAbove(1) and c:IsNotTuner(syncard) then return true end
return (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsNotTuner(syncard) and c:IsCanBeSynchroMaterial(syncard)
end
function cm.ckfilter2(c,tc)
return not c:IsType(TYPE_TUNER) and c:IsCanBeFusionMaterial(tc,SUMMON_TYPE_SPECIAL)
function cm.val(c,syncard)
return c:GetSynchroLevel(syncard)
end
function cm.check(g,mg1,mg2,tc)
local res=0x0
if g:IsExists(cm.ckfilter,1,nil,mg1,tc) then res=res+0x1 end
if g:IsExists(cm.ckfilter2,1,nil,tc) then res=res+0x2 end
return res==0x3 and Duel.GetLocationCountFromEx(tp,tp,g,tc)>0
function cm.CheckGroupRecursive(c,sg,g,f,min,max,ext_params)
sg:AddCard(c)
local ct=sg:GetCount()
local res=(ct>=min and f(sg,table.unpack(ext_params)))
or (ct<max and g:IsExists(cm.CheckGroupRecursive,1,sg,sg,g,f,min,max,ext_params))
sg:RemoveCard(c)
return res
end
function cm.ckfilter3(c)
return c:IsLevelAbove(1) and c:IsType(TYPE_MONSTER)
function cm.synfilter(c,syncard,lv,g2,g3,minc,maxc,tp)
local tsg=c:IsHasEffect(EFFECT_HAND_SYNCHRO) and g3 or g2
local f=c.tuner_filter
if c.tuner_filter then tsg=tsg:Filter(f,nil) end
return cm.CheckGroup(tsg,cm.goal,Group.FromCards(c),minc,maxc,tp,lv,syncard,c)
end
function cm.hspop(e,tp,eg,ep,ev,re,r,rp,c)
local mg1=Duel.GetOverlayGroup(tp,LOCATION_MZONE,0):Filter(cm.ckfilter3,nil)
local mg2=Duel.GetMatchingGroup(cm.ckfilter3,tp,LOCATION_MZONE,0,nil)
local mg3=mg1
mg3:Merge(mg2)
local g=mg3:SelectSubGroup(tp,cm.check,false,2,2,mg1,mg2,c)
function cm.goal(g,tp,lv,syncard,tuc)
if Duel.GetLocationCountFromEx(tp,tp,g,syncard)<=0 then return false end
if tuc:IsHasEffect(EFFECT_HAND_SYNCHRO) and g:IsExists(Card.IsLocation,2,tuc,LOCATION_HAND) then return false end
local ct=g:GetCount()
return g:CheckWithSumEqual(cm.val,lv,ct,ct,syncard)
end
function cm.syncon(e,c,tuner,mg)
if c==nil then return true end
if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
local tp=c:GetControler()
local minc=2
local maxc=c:GetLevel()
local g1=nil
local g2=nil
local g3=nil
local sg=nil
local sg1=nil
local sg2=nil
if mg then
g1=mg:Filter(cm.matfilter1,nil,c,tp)
g2=mg:Filter(cm.matfilter2,nil,c)
g3=g2:Clone()
else
sg=Duel.GetOverlayGroup(tp,LOCATION_ONFIELD,0)
sg1=sg:Filter(cm.matfilter1,nil,c,tp)
sg2=sg:Filter(cm.matfilter1,nil,c,tp)
g1=Duel.GetMatchingGroup(cm.matfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c,tp)
g2=Duel.GetMatchingGroup(cm.matfilter2,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c)
g3=Duel.GetMatchingGroup(cm.matfilter2,tp,LOCATION_MZONE+LOCATION_HAND,LOCATION_MZONE,nil,c)
g1:Merge(sg1)
g2:Merge(sg2)
end
local pe=Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_SMATERIAL)
local lv=c:GetLevel()
local sg=nil
if tuner then
return cm.matfilter1(c,tp) and cm.synfilter(tuner,c,lv,g2,g3,minc,maxc,tp)
elseif pe then
return cm.matfilter1(pe:GetOwner(),tp) and cm.synfilter(pe:GetOwner(),c,lv,g2,g3,minc,maxc,tp)
else
return g1:IsExists(cm.synfilter,1,nil,c,lv,g2,g3,minc,maxc,tp)
end
end
function cm.syntg(e,tp,eg,ep,ev,re,r,rp,chk,c,tuner,mg)
local minc=2
local maxc=c:GetLevel()
local g1=nil
local g2=nil
local g3=nil
local sg=nil
local sg1=nil
local sg2=nil
if mg then
g1=mg:Filter(cm.matfilter1,nil,c,tp)
g2=mg:Filter(cm.matfilter2,nil,c)
g3=g2:Clone()
else
sg=Duel.GetOverlayGroup(tp,LOCATION_ONFIELD,0)
sg1=sg:Filter(cm.matfilter1,nil,c,tp)
sg2=sg:Filter(cm.matfilter1,nil,c,tp)
g1=Duel.GetMatchingGroup(cm.matfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c,tp)
g2=Duel.GetMatchingGroup(cm.matfilter2,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c)
g3=Duel.GetMatchingGroup(cm.matfilter2,tp,LOCATION_MZONE+LOCATION_HAND,LOCATION_MZONE,nil,c)
g1:Merge(sg1)
g2:Merge(sg2)
end
local pe=Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_SMATERIAL)
local lv=c:GetLevel()
local tuc=nil
if tuner then
tuc=tuner
else
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,2))
if not pe then
local t1=g1:FilterSelect(tp,cm.synfilter,1,1,nil,c,lv,g2,g3,minc,maxc,tp)
tuc=t1:GetFirst()
else
tuc=pe:GetOwner()
Group.FromCards(tuc):Select(tp,1,1,nil)
end
end
tuc:RegisterFlagEffect(m,RESET_EVENT+0x1fe0000,0,1)
local tsg=tuc:IsHasEffect(EFFECT_HAND_SYNCHRO) and g3 or g2
local f=tuc.tuner_filter
if tuc.tuner_filter then tsg=tsg:Filter(f,nil) end
local g=cm.SelectGroup(tp,HINTMSG_SMATERIAL,tsg,cm.goal,Group.FromCards(tuc),minc,maxc,tp,lv,c,tuc)
if g then
g:KeepAlive()
e:SetLabelObject(g)
return true
else return false end
end
function cm.synop(e,tp,eg,ep,ev,re,r,rp,c,tuner,mg)
local g=e:GetLabelObject()
c:SetMaterial(g)
Duel.SendtoGrave(g,REASON_COST)
Duel.SendtoGrave(g,REASON_MATERIAL+REASON_SYNCHRO)
g:DeleteGroup()
Duel.Hint(HINT_MUSIC,0,m*16+2)
end
function cm.cfilter(c)
return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsSetCard(0x107f) and c:GetOverlayCount()>0
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