--Noble Knight Agravain function c80347322.initial_effect(c) c:EnableReviveLimit() aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0x107a),2,2) --battle indestructable local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_FIELD) e0:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e0:SetRange(LOCATION_MZONE) e0:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e0:SetCondition(c80347322.incon) e0:SetTarget(c80347322.indtg) e0:SetValue(1) c:RegisterEffect(e0) --indestructable local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetCondition(c80347322.incon) e1:SetValue(1) c:RegisterEffect(e1) --destroy and special local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DESTROY) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,80347322) e2:SetTarget(c80347322.target) e2:SetOperation(c80347322.operation) c:RegisterEffect(e2) --searching on summon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(80347322,0)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetRange(LOCATION_MZONE) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetCountLimit(1) e3:SetCondition(c80347322.condition1) e3:SetTarget(c80347322.target1) e3:SetOperation(c80347322.operation1) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e4) end function c80347322.indtg(e,c) return e:GetHandler():GetLinkedGroup():IsContains(c) and c:IsSetCard(0x107a) end function c80347322.incon(e,c) return e:GetHandler():GetEquipCount()>0 end function c80347322.desfilter1(c) return c:IsFaceup() and c:IsType(TYPE_EQUIP) end function c80347322.spfilter(c,e,tp) return c:IsSetCard(0x107a) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c80347322.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(e:GetLabel()) and chkc:IsControler(tp) and chkc~=c and c80347322.desfilter1(chkc) end if chk==0 then local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<-1 then return false end local loc=LOCATION_ONFIELD if ft==0 then loc=LOCATION_MZONE end e:SetLabel(loc) return Duel.IsExistingTarget(c80347322.desfilter1,tp,loc,0,1,c) and Duel.IsExistingMatchingCard(c80347322.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,c80347322.desfilter1,tp,e:GetLabel(),0,1,1,c) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function c80347322.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 then if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c80347322.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_DEFENSE) end end end function c80347322.cfilter(c,g) return c:IsSetCard(0x107a) and g:IsContains(c) end function c80347322.condition1(e,tp,eg,ep,ev,re,r,rp) local lg=e:GetHandler():GetLinkedGroup() return lg and eg:IsExists(c80347322.cfilter,1,nil,lg) end function c80347322.filter1(c) return c:IsSetCard(0x207a) and c:IsAbleToHand() end function c80347322.target1(e,tp,eg,ep,ev,re,r,rp,chk) local tc=eg:GetFirst() if chk==0 then return tc:IsSetCard(0x107a) and tc:IsControler(tp) and Duel.IsExistingMatchingCard(c80347322.filter1,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE) end function c80347322.operation1(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c80347322.filter1,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end