--Saintly Paragon Scholar --Scripted by: XGlitchy30 and Swag, created by Swag local cid,id=GetID() function cid.initial_effect(c) --time leap procedure aux.AddOrigTimeleapType(c,false) aux.AddTimeleapProc(c,5,cid.sumcon,cid.tlfilter,nil) c:EnableReviveLimit() --cannot draw local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_FIELD) e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e0:SetCode(EFFECT_CANNOT_DRAW) e0:SetRange(LOCATION_MZONE) e0:SetTargetRange(0,1) e0:SetCondition(cid.limitcon) c:RegisterEffect(e0) --draw local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(433006,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCondition(cid.drcon) e1:SetTarget(cid.drtg) e1:SetOperation(cid.drop) c:RegisterEffect(e1) --tohand local e2=Effect.CreateEffect(c) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCategory(CATEGORY_TOHAND) e2:SetCode(EVENT_DRAW) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(cid.thcon) e2:SetTarget(cid.thtg) e2:SetOperation(cid.thop) c:RegisterEffect(e2) --revive local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL+EFFECT_FLAG_DELAY) e3:SetRange(LOCATION_GRAVE) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetCondition(cid.revcon) e3:SetTarget(cid.revtg) e3:SetOperation(cid.revop) c:RegisterEffect(e3) --global_check if not cid.global_check then cid.global_check=true local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_DRAW) ge1:SetOperation(cid.checkop) Duel.RegisterEffect(ge1,0) local ge2=Effect.CreateEffect(c) ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge2:SetCode(EVENT_PHASE_START+PHASE_DRAW) ge2:SetOperation(cid.clear) Duel.RegisterEffect(ge2,0) end end cid.totaldraw_self=0 cid.totaldraw_oppo=0 --check draw function cid.checkop(e,tp,eg,ep,ev,re,r,rp) if ep==1-e:GetHandler():GetOwner() then cid.totaldraw_oppo=cid.totaldraw_oppo+ev else cid.totaldraw_self=cid.totaldraw_self+ev end end function cid.clear(e,tp,eg,ep,ev,re,r,rp) cid.totaldraw_self=0 cid.totaldraw_oppo=0 end --limit function cid.limitcon(e) return (e:GetHandlerPlayer()==e:GetHandler():GetOwner() and cid.totaldraw_oppo>0) or cid.totaldraw_self>0 end function cid.sumcon(e,c) local tp=c:GetControler() local g=Duel.GetFieldGroup(tp,LOCATION_MZONE,0):Filter(Card.IsType,nil,TYPE_MONSTER) local sg=g:Filter(cid.sumconfilter,nil) return #g>1 and sg:GetClassCount(Card.GetRace)==1 and not g:IsExists(Card.IsFacedown,1,nil) end function cid.sumconfilter(c) return c:IsFaceup() and c:IsType(TYPE_MONSTER) end function cid.tlfilter(c,e,mg) return c:IsAttribute(ATTRIBUTE_DARK) and c:GetLevel()==e:GetHandler():GetFuture()-1 end function cid.drcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_TIMELEAP) end function cid.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function cid.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) if Duel.Draw(p,d,REASON_EFFECT)>0 then Duel.BreakEffect() Duel.DiscardHand(tp,aux.TRUE,1,1,REASON_EFFECT) end end function cid.thcon(e,tp,eg,ep,ev,re,r,rp) return r~=REASON_RULE end function cid.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function cid.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end function cid.revfilter(c,tp) return c:GetSummonLocation()==LOCATION_EXTRA and c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and bit.band(c:GetPreviousRaceOnField(),RACE_BEAST)>0 end function cid.revcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(cid.revfilter,1,nil,tp) and not eg:IsContains(e:GetHandler()) end function cid.revtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function cid.revop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetValue(LOCATION_REMOVED) e1:SetReset(RESET_EVENT+RESETS_REDIRECT) c:RegisterEffect(e1,true) end end