Commit 57f8ba15 authored by fallenstardust's avatar fallenstardust

fix リペア・ジェネクス・コントローラー:https://github.com/Fluorohydride/ygopro-pre-script/pull/1202

parent 0ed7950e
--リペア・ジェネクス・コントローラー --リペア・ジェネクス・コントローラー
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()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local g=Duel.SelectMatchingCard(tp,s.smfilter,tp,LOCATION_HAND,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,s.smfilter,tp,LOCATION_HAND,0,1,1,nil)
if g:GetCount()>0 then if g:GetCount()>0 then
Duel.Summon(tp,g:GetFirst(),true,nil) Duel.Summon(tp,g:GetFirst(),true,nil)
end end
--splimit --splimit
local e0=Effect.CreateEffect(c) local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_FIELD) e0:SetType(EFFECT_TYPE_FIELD)
e0:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e0:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e0:SetTargetRange(1,0) e0:SetTargetRange(1,0)
e0:SetTarget(s.splimit) e0:SetTarget(s.splimit)
e0:SetReset(RESET_PHASE+PHASE_END) e0:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e0,tp) Duel.RegisterEffect(e0,tp)
--synchro level --splimit2
local e3=Effect.CreateEffect(c) local e1=e0:Clone()
e3:SetType(EFFECT_TYPE_SINGLE) e1:SetTarget(s.splimit1)
e3:SetCode(EFFECT_SYNCHRO_MATERIAL_CUSTOM) Duel.RegisterEffect(e1,tp)
e3:SetTarget(s.syntg) --synchro level
e3:SetValue(1) local e3=Effect.CreateEffect(c)
e3:SetOperation(s.synop) e3:SetType(EFFECT_TYPE_SINGLE)
local e31=Effect.CreateEffect(c) e3:SetCode(EFFECT_SYNCHRO_MATERIAL_CUSTOM)
e31:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e31:SetReset(RESET_PHASE+PHASE_END) e3:SetTarget(s.syntg)
e31:SetTargetRange(LOCATION_MZONE,0) e3:SetValue(1)
e31:SetLabelObject(e3) e3:SetOperation(s.synop)
Duel.RegisterEffect(e31,tp) local e31=Effect.CreateEffect(c)
e31:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e31:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e31:SetReset(RESET_PHASE+PHASE_END)
e31:SetTargetRange(LOCATION_MZONE,0)
e31:SetLabelObject(e3)
Duel.RegisterEffect(e31,tp)
end end
function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) 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 return c:IsLocation(LOCATION_EXTRA) and bit.band(sumtype,SUMMON_TYPE_SYNCHRO)~=SUMMON_TYPE_SYNCHRO
end end
function s.smcfilter(c) function s.splimit1(e,c,sump,sumtype,sumpos,targetp,se)
return c:IsSetCard(0x2) and c:IsType(TYPE_TUNER) return se:IsHasType(EFFECT_TYPE_ACTIONS) and c:IsLocation(LOCATION_EXTRA)
end
function s.smcfilter(c,sc)
return c:IsSetCard(0x2) and c:IsTuner(sc)
end end
function s.synfilter(c,syncard,tuner,f) function s.synfilter(c,syncard,tuner,f)
return c:IsFaceupEx() and c:IsCanBeSynchroMaterial(syncard,tuner) and (f==nil or f(c,syncard)) return c:IsFaceupEx() and c:IsCanBeSynchroMaterial(syncard,tuner) and (f==nil or f(c,syncard))
end end
function s.syncheck(c,g,mg,tp,lv,syncard,minc,maxc) function s.syncheck(c,g,mg,tp,lv,syncard,minc,maxc)
g:AddCard(c) g:AddCard(c)
local ct=g:GetCount() local ct=g:GetCount()
local res=s.syngoal(g,tp,lv,syncard,minc,ct) 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)) or (ct<maxc and mg:IsExists(s.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc))
g:RemoveCard(c) g:RemoveCard(c)
return res return res
end end
function s.syngoal(g,tp,lv,syncard,minc,ct) function s.syngoal(g,tp,lv,syncard,minc,ct)
return ct>=minc and Duel.GetLocationCountFromEx(tp,tp,g,syncard)>0 return ct>=minc and Duel.GetLocationCountFromEx(tp,tp,g,syncard)>0
and g:CheckWithSumEqual(Card.GetSynchroLevel,lv,ct,ct,syncard) and g:CheckWithSumEqual(Card.GetSynchroLevel,lv,ct,ct,syncard)
and aux.MustMaterialCheck(g,tp,EFFECT_MUST_BE_SMATERIAL) and aux.MustMaterialCheck(g,tp,EFFECT_MUST_BE_SMATERIAL)
and g:IsExists(s.smcfilter,1,nil) and g:IsExists(s.smcfilter,1,nil,syncard)
end end
function s.syntg(e,syncard,f,min,max) function s.syntg(e,syncard,f,min,max)
local minc=min+1 local minc=min+1
local maxc=max+1 local maxc=max+1
local c=e:GetHandler() local c=e:GetHandler()
local tp=syncard:GetControler() local tp=syncard:GetControler()
local lv=syncard:GetLevel() local lv=syncard:GetLevel()
if lv<=c:GetLevel() then return false end if lv<=c:GetLevel() then return false end
local g=Group.FromCards(c) local g=Group.FromCards(c)
local mg=Duel.GetSynchroMaterial(tp):Filter(s.synfilter,c,syncard,c,f) 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) return mg:IsExists(s.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc)
end end
function s.synop(e,tp,eg,ep,ev,re,r,rp,syncard,f,min,max) function s.synop(e,tp,eg,ep,ev,re,r,rp,syncard,f,min,max)
local minc=min+1 local minc=min+1
local maxc=max+1 local maxc=max+1
local c=e:GetHandler() local c=e:GetHandler()
local lv=syncard:GetLevel() local lv=syncard:GetLevel()
local g=Group.FromCards(c) local g=Group.FromCards(c)
local mg=Duel.GetSynchroMaterial(tp):Filter(s.synfilter,c,syncard,c,f) local mg=Duel.GetSynchroMaterial(tp):Filter(s.synfilter,c,syncard,c,f)
for i=1,maxc do for i=1,maxc do
local cg=mg:Filter(s.syncheck,g,g,mg,tp,lv,syncard,minc,maxc) local cg=mg:Filter(s.syncheck,g,g,mg,tp,lv,syncard,minc,maxc)
if cg:GetCount()==0 then break end if cg:GetCount()==0 then break end
local minct=1 local minct=1
if s.syngoal(g,tp,lv,syncard,minc,i) then if s.syngoal(g,tp,lv,syncard,minc,i) then
minct=0 minct=0
end end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local sg=cg:Select(tp,minct,1,nil) local sg=cg:Select(tp,minct,1,nil)
if sg:GetCount()==0 then break end if sg:GetCount()==0 then break end
g:Merge(sg) g:Merge(sg)
end end
Duel.SetSynchroMaterial(g) 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