Commit ea930342 authored by 八宫一月's avatar 八宫一月

fix bug

parent 24e25fe2
......@@ -68,6 +68,11 @@ function s.smtg(e,tp,eg,ep,ev,re,r,rp,chk)
end
function s.smop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local g=Duel.SelectMatchingCard(tp,s.smfilter,tp,LOCATION_HAND,0,1,1,nil)
if g:GetCount()>0 then
Duel.Summon(tp,g:GetFirst(),true,nil)
end
--splimit
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_FIELD)
......@@ -77,28 +82,72 @@ function s.smop(e,tp,eg,ep,ev,re,r,rp)
e0:SetTarget(s.splimit)
e0:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e0,tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetTargetRange(0xff,0xff)
e1:SetTarget(s.sptg2)
e1:SetValue(s.splimit2)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local g=Duel.SelectMatchingCard(tp,s.smfilter,tp,LOCATION_HAND,0,1,1,nil)
if g:GetCount()>0 then
Duel.Summon(tp,g:GetFirst(),true,nil)
end
--synchro level
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_SYNCHRO_MATERIAL_CUSTOM)
e3:SetTarget(s.syntg)
e3:SetValue(1)
e3:SetOperation(s.synop)
local e31=Effect.CreateEffect(c)
e31:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e31:SetReset(RESET_PHASE+PHASE_END)
e31:SetTargetRange(LOCATION_MZONE,0)
e31:SetLabelObject(e3)
Duel.RegisterEffect(e31,tp)
end
function s.splimit(e,c,sump,sumtype,sumpos,targetp,se)
return se:IsHasType(EFFECT_TYPE_ACTIONS) and c:IsLocation(LOCATION_EXTRA) and bit.band(sumtype,SUMMON_TYPE_SYNCHRO)~=SUMMON_TYPE_SYNCHRO
end
function s.smcfilter(c)
return c:IsSetCard(0x2) and c:IsType(TYPE_TUNER)
end
function s.splimit(e,c)
return not c:IsType(TYPE_SYNCHRO) and c:IsLocation(LOCATION_EXTRA)
function s.synfilter(c,syncard,tuner,f)
return c:IsFaceupEx() and c:IsCanBeSynchroMaterial(syncard,tuner) and (f==nil or f(c,syncard))
end
function s.splimit2(e,c)
if not c then return false end
return c:IsControler(e:GetHandlerPlayer())
function s.syncheck(c,g,mg,tp,lv,syncard,minc,maxc)
g:AddCard(c)
local ct=g:GetCount()
local res=s.syngoal(g,tp,lv,syncard,minc,ct)
or (ct<maxc and mg:IsExists(s.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc))
g:RemoveCard(c)
return res
end
function s.sptg2(e,c)
return not ((c:IsSetCard(0x2) and c:IsType(TYPE_TUNER)) or (not c:IsType(TYPE_TUNER)))
function s.syngoal(g,tp,lv,syncard,minc,ct)
return ct>=minc and Duel.GetLocationCountFromEx(tp,tp,g,syncard)>0
and g:CheckWithSumEqual(Card.GetSynchroLevel,lv,ct,ct,syncard)
and aux.MustMaterialCheck(g,tp,EFFECT_MUST_BE_SMATERIAL)
and g:IsExists(s.smcfilter,1,nil)
end
function s.syntg(e,syncard,f,min,max)
local minc=min+1
local maxc=max+1
local c=e:GetHandler()
local tp=syncard:GetControler()
local lv=syncard:GetLevel()
if lv<=c:GetLevel() then return false end
local g=Group.FromCards(c)
local mg=Duel.GetSynchroMaterial(tp):Filter(s.synfilter,c,syncard,c,f)
return mg:IsExists(s.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc)
end
function s.synop(e,tp,eg,ep,ev,re,r,rp,syncard,f,min,max)
local minc=min+1
local maxc=max+1
local c=e:GetHandler()
local lv=syncard:GetLevel()
local g=Group.FromCards(c)
local mg=Duel.GetSynchroMaterial(tp):Filter(s.synfilter,c,syncard,c,f)
for i=1,maxc do
local cg=mg:Filter(s.syncheck,g,g,mg,tp,lv,syncard,minc,maxc)
if cg:GetCount()==0 then break end
local minct=1
if s.syngoal(g,tp,lv,syncard,minc,i) then
minct=0
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local sg=cg:Select(tp,minct,1,nil)
if sg:GetCount()==0 then break end
g:Merge(sg)
end
Duel.SetSynchroMaterial(g)
end
\ No newline at end of file
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