function c210216010.initial_effect(c) c:EnableCounterPermit(0x216) --link summon aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0x216),2,2) c:EnableReviveLimit() --Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(65330383,0)) e1:SetCategory(CATEGORY_LEAVE_GRAVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,65330383) e1:SetCondition(c210216010.sumcon) e1:SetCost(c210216010.sumcost) e1:SetTarget(c210216010.sumtg) e1:SetOperation(c210216010.sumop) c:RegisterEffect(e1) --Add counter local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e0:SetCode(EVENT_CHAINING) e0:SetRange(LOCATION_MZONE) e0:SetOperation(aux.chainreg) c:RegisterEffect(e0) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetCode(EVENT_CHAIN_SOLVED) e2:SetRange(LOCATION_MZONE) e2:SetCondition(c210216010.ctcon) e2:SetOperation(c210216010.ctop) c:RegisterEffect(e2) --atk up local e6=Effect.CreateEffect(c) e6:SetType(EFFECT_TYPE_SINGLE) e6:SetCode(EFFECT_UPDATE_ATTACK) e6:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e6:SetRange(LOCATION_MZONE) e6:SetValue(c210216010.atkval) c:RegisterEffect(e6) --negate local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(27548199,1)) e3:SetCategory(CATEGORY_NEGATE) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_CHAINING) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e3:SetRange(LOCATION_MZONE) e3:SetCondition(c210216010.discon) e3:SetCost(c210216010.discost) e3:SetTarget(c210216010.distg) e3:SetOperation(c210216010.disop) c:RegisterEffect(e3) end function c210216010.discon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return rp==1-tp and re:IsActiveType(TYPE_MONSTER) and not c:IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev) end function c210216010.discost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x216,2,REASON_COST) end e:GetHandler():RemoveCounter(tp,0x216,2,REASON_COST) end function c210216010.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return aux.nbcon(tp,re) end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0) end end function c210216010.disop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Remove(eg,POS_FACEUP,REASON_EFFECT) end end function c210216010.ctcon(e,tp,eg,ep,ev,re,r,rp) if not re then return false end local c=re:GetHandler() return re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_TRAP) and c:IsSetCard(0x216) and e:GetHandler():GetFlagEffect(1)>0 end function c210216010.ctop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():AddCounter(0x216,1) end function c210216010.atkval(e,c) return e:GetHandler():GetCounter(0x216)*500 end function c210216010.sumcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) end function c210216010.sumcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD) end function c210216010.sumfilter(c,e,tp,zone) return c:IsType(TYPE_XYZ) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) and c:IsSetCard(0x216) end function c210216010.sumtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local zone=bit.band(e:GetHandler():GetLinkedZone(tp),0x216f) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c210216010.sumfilter(chkc,e,tp,zone) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c210216010.sumfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,zone) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c210216010.sumfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,zone) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c210216010.sumop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local zone=bit.band(e:GetHandler():GetLinkedZone(tp),0x216f) if tc:IsRelateToEffect(e) and zone~=0 then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,zone) end end