-- Spiral Drill's Determination -- Archetype by TaxingCorn117, card and script by Swaggy local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON+CATEGORY_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:HOPT() e1:SetCondition(s.thcon) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --attack declaration local e2=Effect.CreateEffect(c) e2:Desc(1) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_GRAVE) e2:HOPT() e2:SetCost(s.attcost) e2:SetTarget(s.atttg) e2:SetOperation(s.attop) c:RegisterEffect(e2) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 end function s.thfilter(c) return c:IsSetCard(0x205) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.spfilter(c,e,tp) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x205) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.nsfilter(c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x205) and c:IsSummonable(true,nil) and (not c:IsLocation(LOCATION_MZONE) or c:IsFaceup()) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local tc=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() if tc and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_HAND) then Duel.ConfirmCards(1-tp,tc) Duel.ShuffleHand(tp) if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then local sc local sg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND,0,nil,e,tp) local gg=Duel.GetMatchingGroup(s.nsfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,nil) local b1,b2 = #sg>0, #gg>0 local opt=aux.Option(id,tp,1,b1,b2) if opt==0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) sc=sg:Select(tp,1,1,nil) if sc then Duel.BreakEffect() Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP) end elseif opt==1 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) sc=gg:Select(tp,1,1,nil) if sc then Duel.BreakEffect() Duel.Summon(tp,sc:GetFirst(),true,nil) end end if sc then local e1=Effect.CreateEffect(e:GetHandler()) e1:Desc(4) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CLIENT_HINT) e1:SetRange(LOCATION_MZONE) e1:SetCode(EVENT_CHAINING) e1:SetOperation(s.chainop) e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TOFIELD) sc:GetFirst():RegisterEffect(e1,true) end end end end function s.chainop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=re:GetHandler() if c:IsFaceup() and c:IsLocation(LOCATION_MZONE) and re:IsActiveType(TYPE_MONSTER) and rc==c then Duel.SetChainLimit(s.chainlm) end end function s.chainlm(e,rp,tp) return tp==rp end function s.cfilter(c) return c:IsMonster(TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ+TYPE_LINK) and c:IsSetCard(0x205) and c:IsAbleToRemoveAsCost() end function s.attcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,1,1,c) g:AddCard(c) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.filter(c) return c:IsFaceup() and c:IsSetCard(0x205) and c:GetFlagEffect(id)==0 end function s.atttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) end function s.attop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToChain() and tc:IsFaceup() then tc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,0) local e1=Effect.CreateEffect(c) e1:Desc(5) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CHANGE_BATTLE_DAMAGE) e1:SetValue(DOUBLE_DAMAGE) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) end end