--Overlay-Knight Gardna function c249001199.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(293542,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetRange(LOCATION_HAND) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(c249001199.spcon) e1:SetTarget(c249001199.sptg) e1:SetOperation(c249001199.spop) c:RegisterEffect(e1) --indes local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e2:SetCountLimit(1) e2:SetValue(c249001199.valcon) c:RegisterEffect(e2) --negate local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(11819616,0)) e3:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_XMATERIAL+EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_CHAINING) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetCondition(c249001199.discon) e3:SetCost(c249001199.discost) e3:SetTarget(c249001199.distg) e3:SetOperation(c249001199.disop) c:RegisterEffect(e3) end function c249001199.cfilter(c) return c:IsFaceup() and c:IsLevelBelow(7) end function c249001199.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(c249001199.cfilter,1,nil) end function c249001199.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) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function c249001199.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end function c249001199.valcon(e,re,r,rp) return bit.band(r,REASON_BATTLE+REASON_EFFECT)~=0 end function c249001199.disfilter(c,tp) return c:IsType(TYPE_XYZ) and c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) end function c249001199.discon(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) then return false end if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return tg and tg:IsExists(c249001199.disfilter,1,nil) and Duel.IsChainNegatable(ev) end function c249001199.discost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) end function c249001199.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function c249001199.disop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end