--Duelahan's Spiny Whip local cid,id=GetID() function cid.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DISABLE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CONTINUOUS_TARGET) e1:SetCondition(cid.condition) e1:SetTarget(cid.target) e1:SetOperation(cid.tgop) c:RegisterEffect(e1) --disable local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_TARGET) e3:SetCode(EFFECT_DISABLE) e3:SetRange(LOCATION_SZONE) c:RegisterEffect(e3) --cannot attack local e4=e3:Clone() e4:SetCode(EFFECT_CANNOT_ATTACK) c:RegisterEffect(e4) --atk gain local e5=e3:Clone() e5:SetCode(EFFECT_UPDATE_ATTACK) e5:SetValue(1000) c:RegisterEffect(e5) --battle indes local e6=e3:Clone() e6:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e6:SetValue(1) c:RegisterEffect(e6) --destroy local e7=Effect.CreateEffect(c) e7:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e7:SetRange(LOCATION_SZONE) e7:SetCode(EVENT_LEAVE_FIELD) e7:SetCondition(cid.descon) e7:SetOperation(cid.desop) c:RegisterEffect(e7) --act in hand local e8=Effect.CreateEffect(c) e8:SetType(EFFECT_TYPE_SINGLE) e8:SetCode(EFFECT_TRAP_ACT_IN_HAND) e8:SetCondition(cid.handcon) c:RegisterEffect(e8) --spsummon local e9=Effect.CreateEffect(c) e9:SetCategory(CATEGORY_SPECIAL_SUMMON) e9:SetType(EFFECT_TYPE_QUICK_O) e9:SetCode(EVENT_FREE_CHAIN) e9:SetRange(LOCATION_GRAVE) e9:SetCountLimit(1,id+EFFECT_COUNT_CODE_DUEL) e9:SetCost(aux.bfgcost) e9:SetTarget(cid.sptg) e9:SetOperation(cid.spop) c:RegisterEffect(e9) end function cid.cfilter(c) return c:IsFaceup() and c:IsSetCard(0x684) end function cid.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(cid.cfilter,tp,LOCATION_MZONE,0,1,nil) and aux.dscon() end function cid.filter(c) return c:IsFaceup() and aux.disfilter1(c) end function cid.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and cid.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(cid.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectTarget(tp,cid.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0) end function cid.tgop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e) then c:SetCardTarget(tc) end end function cid.descon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=c:GetFirstCardTarget() return tc and eg:IsContains(tc) end function cid.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end function cid.hcfilter(c) return c:IsFaceup() and c:IsSetCard(0x684) and c:IsType(TYPE_LINK) end function cid.handcon(e) return Duel.IsExistingMatchingCard(cid.hcfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function cid.spfilter(c,e,tp) return c:IsSetCard(0x684) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function cid.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(cid.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function cid.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,cid.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end