--Meiko local ref=_G['c'..28916163] local id=28916163 function ref.initial_effect(c) --Special Summon local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e0:SetCode(EVENT_SUMMON_SUCCESS) e0:SetCountLimit(1,id) e0:SetCondition(ref.sscon) e0:SetTarget(ref.target0) e0:SetOperation(ref.operation0) c:RegisterEffect(e0) --Search local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_POSITION+CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id+100) e1:SetTarget(ref.thtg) e1:SetOperation(ref.thop) c:RegisterEffect(e1) end function ref.filterE0P0(c,e,tp) return c:IsLevelBelow(6) and c:IsType(TYPE_MONSTER) and c:IsSetCard(1856) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) and not c:IsCode(id) end function ref.sscfilter(c,tc) return c:IsFaceup() and c:IsSetCard(1856) and c:GetCode()~=tc:GetCode() end function ref.sscon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return Duel.IsExistingMatchingCard(ref.sscfilter,tp,LOCATION_ONFIELD,0,1,c,c) end function ref.target0(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(ref.filterE0P0,tp,LOCATION_DECK+LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_HAND) end function ref.operation0(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local c=e:GetHandler() local g0 = Duel.SelectMatchingCard(tp,ref.filterE0P0,tp,LOCATION_DECK+LOCATION_HAND,0,1,1,nil,e,tp) if g0:GetCount()>0 then Duel.SpecialSummon(g0,0,tp,tp,false,false,POS_FACEUP) end end function ref.flipfilter(c) return c:IsFacedown() and (c:IsLocation(LOCATION_MZONE) or c:IsType(TYPE_CONTINUOUS) or (c:IsType(TYPE_FIELD) and c:IsType(TYPE_SPELL))) and c:IsSetCard(1856) end function ref.thfilter(c) return c:IsSetCard(1856) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand() end function ref.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(ref.flipfilter,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(ref.thfilter,tp,LOCATION_DECK,0,1,nil) end local g=Duel.GetMatchingGroup(ref.thfilter,tp,LOCATION_ONFIELD,0,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function ref.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEDOWN) local tc=Duel.SelectMatchingCard(tp,ref.flipfilter,tp,LOCATION_ONFIELD,0,1,1,nil):GetFirst() if tc and Duel.ChangePosition(tc,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK,POS_FACEUP_DEFENSE,POS_FACEUP_DEFENSE)~=0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,ref.thfilter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end end