--Calamus & Alula ~梦迹的孩子们~ function c33710911.initial_effect(c) --link summon c:EnableReviveLimit() aux.AddLinkProcedure(c,nil,2,2) --TEF local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_PREDRAW) e1:SetRange(LOCATION_MZONE) e1:SetCondition(c33710911.con) e1:SetTarget(c33710911.tg) e1:SetOperation(c33710911.op) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_PREDRAW) e2:SetRange(LOCATION_MZONE) e2:SetCondition(c33710911.con1) e2:SetTarget(c33710911.tg1) e2:SetOperation(c33710911.op1) c:RegisterEffect(e2) --Effect Draw local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_DRAW_COUNT) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(1,1) e3:SetCondition(c33710911.con2) e3:SetValue(2) c:RegisterEffect(e3) end function c33710911.con(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() and Duel.GetFieldGroupCount(1-tp,LOCATION_DECK,0)>0 and Duel.GetDrawCount(tp)>0 and e:GetHandler():GetLinkedGroup():IsExists(Card.IsControler,1,nil,1-tp) end function c33710911.tg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 end local dt=Duel.GetDrawCount(tp) if dt~=0 then _replace_count=0 _replace_max=dt local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_DRAW_COUNT) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE+PHASE_DRAW) e1:SetValue(0) Duel.RegisterEffect(e1,tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_DECK) end function c33710911.op(e,tp,eg,ep,ev,re,r,rp) _replace_count=_replace_count+1 if _replace_count>_replace_max or not e:GetHandler():IsRelateToEffect(e) then return end local g=Duel.GetDecktopGroup(1-tp,1) if g:GetCount()>0 then Duel.DisableShuffleCheck() Duel.SendtoHand(g,tp,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function c33710911.con1(e,tp,eg,ep,ev,re,r,rp) return tp~=Duel.GetTurnPlayer() and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 and Duel.GetDrawCount(tp)>0 and e:GetHandler():GetLinkedGroup():IsExists(Card.IsControler,1,nil,tp) end function c33710911.tg1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 end local dt=Duel.GetDrawCount(1-tp) if dt~=0 then _replace_count=0 _replace_max=dt local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_DRAW_COUNT) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE+PHASE_DRAW) e1:SetValue(0) Duel.RegisterEffect(e1,1-tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_DECK) end function c33710911.op1(e,tp,eg,ep,ev,re,r,rp) _replace_count=_replace_count+1 if _replace_count>_replace_max or not e:GetHandler():IsRelateToEffect(e) then return end local g=Duel.GetDecktopGroup(tp,1) if g:GetCount()>0 then Duel.DisableShuffleCheck() Duel.SendtoHand(g,1-tp,REASON_EFFECT) Duel.ConfirmCards(tp,g) end end function c33710911.con2(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetLinkedGroupCount()==0 end