--Bit Trooper Recoded function c249000976.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(c249000976.spcon) e1:SetOperation(c249000976.spop) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_PLAYER_TARGET) e2:SetCountLimit(1,249000976) e2:SetCondition(c249000976.thcon) e2:SetTarget(c249000976.thtg) e2:SetOperation(c249000976.thop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetCode(EVENT_BATTLE_DAMAGE) e4:SetCondition(c249000976.condition) e4:SetTarget(c249000976.target) e4:SetOperation(c249000976.operation) c:RegisterEffect(e4) end function c249000976.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_HAND) end function c249000976.spfilter(c) return c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost() end function c249000976.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c249000976.spfilter,tp,LOCATION_HAND,0,1,c) end function c249000976.spop(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,c249000976.spfilter,tp,LOCATION_HAND,0,1,1,c) Duel.SendtoGrave(g,REASON_COST) end function c249000976.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_HAND) end function c249000976.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>=3 and Duel.GetDecktopGroup(tp,3):FilterCount(Card.IsAbleToHand,nil)>0 end Duel.SetTargetPlayer(tp) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_DECK) end function c249000976.thfilter(c) return c:IsSetCard(0x1FE) and c:IsAbleToHand() end function c249000976.thop(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) Duel.ConfirmDecktop(p,3) local g=Duel.GetDecktopGroup(p,3) if g:GetCount()>0 and g:IsExists(c249000976.thfilter,1,nil) and Duel.SelectYesNo(p,aux.Stringid(94620082,1)) then Duel.Hint(HINT_SELECTMSG,p,HINTMSG_ATOHAND) local sg=g:FilterSelect(p,c249000976.thfilter,1,1,nil) Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-p,sg) Duel.ShuffleHand(p) end Duel.ShuffleDeck(p) end function c249000976.condition(e,tp,eg,ep,ev,re,r,rp) return ep~=tp end function c249000976.filter(c,e,tp) return c:IsFaceup() and c:IsSetCard(0x1FE) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c249000976.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and c249000976.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c249000976.filter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c249000976.filter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c249000976.operation(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) end end