--Bio-Dragun of Gust Vine function c160002427.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(160002427,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_DECKDES) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,160002427) e1:SetTarget(c160002427.target) e1:SetOperation(c160002427.operation) c:RegisterEffect(e1) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e3) --spsummon local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(160002427,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) -- e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetCode(EVENT_TO_GRAVE) e4:SetCountLimit(1,160002427) e4:SetCondition(c160002427.spcon) e4:SetTarget(c160002427.sptg) e4:SetOperation(c160002427.spop) c:RegisterEffect(e4) end function c160002427.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,5) end end function c160002427.filter(c) return c:IsAbleToHand() and c:IsSetCard(0x885a) and c:IsType(TYPE_SPELL+TYPE_TRAP) end function c160002427.operation(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsPlayerCanDiscardDeck(tp,5) then return end Duel.ConfirmDecktop(tp,5) local g=Duel.GetDecktopGroup(tp,5) if g:GetCount()>0 then Duel.DisableShuffleCheck() if g:IsExists(c160002427.filter,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(160002427,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:FilterSelect(tp,c160002427.filter,1,1,nil) Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) Duel.ShuffleHand(tp) g:Sub(sg) end Duel.SendtoGrave(g,REASON_EFFECT+REASON_REVEAL) end end function c160002427.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_EFFECT) end function c160002427.filter2(c,e,tp) return c:IsSetCard(0x885a) and c:IsLevelBelow(4) and not c:IsCode(160002427) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function c160002427.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chkc then return chkc:IsControler(tp) and c160002427.filter2(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c160002427.filter2,tp,LOCATION_GRAVE+LOCATION_DECK,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c160002427.filter2,tp,LOCATION_GRAVE+LOCATION_DECK,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c160002427.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end