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

fix bug

parent 24e25fe2
--リペア・ジェネクス・コントローラー --リペア・ジェネクス・コントローラー
local s,id,o=GetID() local s,id,o=GetID()
function s.initial_effect(c) function s.initial_effect(c)
--link summon --link summon
aux.AddLinkProcedure(c,s.mfilter,1,1) aux.AddLinkProcedure(c,s.mfilter,1,1)
c:EnableReviveLimit() c:EnableReviveLimit()
c:SetSPSummonOnce(id) c:SetSPSummonOnce(id)
--tohand --tohand
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0)) e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_LEAVE_GRAVE) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_LEAVE_GRAVE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(s.thcon) e1:SetCondition(s.thcon)
e1:SetTarget(s.thtg) e1:SetTarget(s.thtg)
e1:SetOperation(s.thop) e1:SetOperation(s.thop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--summon --summon
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1)) e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetRange(LOCATION_MZONE) e2:SetRange(LOCATION_MZONE)
e2:SetCode(EVENT_TO_HAND) e2:SetCode(EVENT_TO_HAND)
e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCondition(s.smcon) e2:SetCondition(s.smcon)
e2:SetTarget(s.smtg) e2:SetTarget(s.smtg)
e2:SetOperation(s.smop) e2:SetOperation(s.smop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function s.mfilter(c) function s.mfilter(c)
return c:IsLevelBelow(4) and c:IsSetCard(0x2) return c:IsLevelBelow(4) and c:IsSetCard(0x2)
end end
function s.thcon(e,tp,eg,ep,ev,re,r,rp) function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
end end
function s.thfilter(c) function s.thfilter(c)
return c:IsSetCard(0x2) and c:IsAbleToHand() return c:IsSetCard(0x2) and c:IsAbleToHand()
end end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE)
end end
function s.thop(e,tp,eg,ep,ev,re,r,rp) function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
if g:GetCount()>0 then if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g) Duel.ConfirmCards(1-tp,g)
end end
end end
function s.smfilter(c) function s.smfilter(c)
return c:IsSetCard(0x2) and c:IsSummonable(true,nil) return c:IsSetCard(0x2) and c:IsSummonable(true,nil)
end end
function s.trigfilter(c,tp) function s.trigfilter(c,tp)
return c:IsSetCard(0x2) and c:IsControler(tp) and c:IsType(TYPE_MONSTER) and not c:IsReason(REASON_DRAW) return c:IsSetCard(0x2) and c:IsControler(tp) and c:IsType(TYPE_MONSTER) and not c:IsReason(REASON_DRAW)
end end
function s.smcon(e,tp,eg,ep,ev,re,r,rp) function s.smcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.trigfilter,1,nil,tp) return eg:IsExists(s.trigfilter,1,nil,tp)
end end
function s.smtg(e,tp,eg,ep,ev,re,r,rp,chk) function s.smtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(s.smfilter,tp,LOCATION_HAND,0,1,nil) if chk==0 then return Duel.IsExistingMatchingCard(s.smfilter,tp,LOCATION_HAND,0,1,nil)
and c:GetFlagEffect(id)==0 end and c:GetFlagEffect(id)==0 end
c:RegisterFlagEffect(id,RESET_CHAIN,0,1) c:RegisterFlagEffect(id,RESET_CHAIN,0,1)
Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0)
end end
function s.smop(e,tp,eg,ep,ev,re,r,rp) function s.smop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
--splimit Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local e0=Effect.CreateEffect(c) local g=Duel.SelectMatchingCard(tp,s.smfilter,tp,LOCATION_HAND,0,1,1,nil)
e0:SetType(EFFECT_TYPE_FIELD) if g:GetCount()>0 then
e0:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) Duel.Summon(tp,g:GetFirst(),true,nil)
e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET) end
e0:SetTargetRange(1,0) --splimit
e0:SetTarget(s.splimit) local e0=Effect.CreateEffect(c)
e0:SetReset(RESET_PHASE+PHASE_END) e0:SetType(EFFECT_TYPE_FIELD)
Duel.RegisterEffect(e0,tp) e0:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
local e1=Effect.CreateEffect(c) e0:SetTargetRange(1,0)
e1:SetType(EFFECT_TYPE_FIELD) e0:SetTarget(s.splimit)
e1:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL) e0:SetReset(RESET_PHASE+PHASE_END)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_IMMUNE) Duel.RegisterEffect(e0,tp)
e1:SetTargetRange(0xff,0xff) --synchro level
e1:SetTarget(s.sptg2) local e3=Effect.CreateEffect(c)
e1:SetValue(s.splimit2) e3:SetType(EFFECT_TYPE_SINGLE)
e1:SetReset(RESET_PHASE+PHASE_END) e3:SetCode(EFFECT_SYNCHRO_MATERIAL_CUSTOM)
Duel.RegisterEffect(e1,tp) e3:SetTarget(s.syntg)
local g=Duel.SelectMatchingCard(tp,s.smfilter,tp,LOCATION_HAND,0,1,1,nil) e3:SetValue(1)
if g:GetCount()>0 then e3:SetOperation(s.synop)
Duel.Summon(tp,g:GetFirst(),true,nil) local e31=Effect.CreateEffect(c)
end e31:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
end e31:SetReset(RESET_PHASE+PHASE_END)
function s.splimit(e,c) e31:SetTargetRange(LOCATION_MZONE,0)
return not c:IsType(TYPE_SYNCHRO) and c:IsLocation(LOCATION_EXTRA) e31:SetLabelObject(e3)
end Duel.RegisterEffect(e31,tp)
function s.splimit2(e,c) end
if not c then return false end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se)
return c:IsControler(e:GetHandlerPlayer()) return se:IsHasType(EFFECT_TYPE_ACTIONS) and c:IsLocation(LOCATION_EXTRA) and bit.band(sumtype,SUMMON_TYPE_SYNCHRO)~=SUMMON_TYPE_SYNCHRO
end end
function s.sptg2(e,c) function s.smcfilter(c)
return not ((c:IsSetCard(0x2) and c:IsType(TYPE_TUNER)) or (not c:IsType(TYPE_TUNER))) return c:IsSetCard(0x2) and c:IsType(TYPE_TUNER)
end
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.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.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 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