--Adptive Gardna function c249000639.initial_effect(c) --negate attack local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(54512827,1)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_HAND) e1:SetCondition(c249000639.spcon1) e1:SetTarget(c249000639.sptg) e1:SetOperation(c249000639.spop) c:RegisterEffect(e1) --negate local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(5818294,0)) e2:SetCategory(CATEGORY_DISABLE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,249000639) e2:SetCondition(c249000639.negcon) e2:SetProperty(EFFECT_FLAG_NO_TURN_RESET) e2:SetTarget(c249000639.negtg) e2:SetOperation(c249000639.negop) c:RegisterEffect(e2) --destroy local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(79409334,0)) e3:SetCategory(CATEGORY_POSITION) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_BE_BATTLE_TARGET) e3:SetTarget(c249000639.target) e3:SetOperation(c249000639.operation2) c:RegisterEffect(e3) --negate attack local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(54512827,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_BE_BATTLE_TARGET) e4:SetRange(LOCATION_HAND) e4:SetCondition(c249000639.spcon2) e4:SetTarget(c249000639.sptg) e4:SetOperation(c249000639.spop) c:RegisterEffect(e4) end function c249000639.spcon1(e,tp,eg,ep,ev,re,r,rp) local at=Duel.GetAttacker() return at:GetControler()~=tp and Duel.GetAttackTarget()==nil end function c249000639.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function c249000639.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.NegateAttack() then if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function c249000639.tfilter(c,tp) return c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsFaceup() and (c:IsSetCard(0x1E1) or c:IsType(TYPE_FUSION) or c:IsType(TYPE_SYNCHRO) or c:IsType(TYPE_XYZ)) end function c249000639.confilter(c) return c:IsSetCard(0x1E1) and not c:IsCode(249000639) end function c249000639.negcon(e,tp,eg,ep,ev,re,r,rp) if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return g and g:IsExists(c249000639.tfilter,1,nil,tp) and Duel.IsChainDisablable(ev) and Duel.IsExistingMatchingCard(c249000639.confilter,tp,LOCATION_GRAVE,0,1,nil) end function c249000639.negcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) end function c249000639.negtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) end function c249000639.negop(e,tp,eg,ep,ev,re,r,rp) Duel.NegateEffect(ev) end function c249000639.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAttackPos() end Duel.SetOperationInfo(0,CATEGORY_POSITION,e:GetHandler(),1,0,0) end function c249000639.operation2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsPosition(POS_FACEUP_ATTACK) then Duel.ChangePosition(c,POS_FACEUP_DEFENSE) end end function c249000639.spcon2(e,tp,eg,ep,ev,re,r,rp) local at=Duel.GetAttackTarget() return at:IsControler(tp) and at:IsFaceup() and at:IsSetCard(0x8d) end