--created by Swag, coded by Lyris local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id+1000) e2:SetCategory(CATEGORY_CONTROL) e2:SetCost(s.ctcost) e2:SetTarget(s.cttg) e2:SetOperation(s.ctop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_GRAVE) e3:SetCountLimit(1,id+2000) e3:SetCategory(CATEGORY_TODECK) e3:SetCondition(aux.exccon) e3:SetCost(aux.bfgcost) e3:SetTarget(s.tg) e3:SetOperation(s.op) c:RegisterEffect(e3) end function s.cfilter(c) return c:GetSummonLocation()&LOCATION_EXTRA~=0 end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.AND(Card.IsFaceup,Card.IsSetCard,s.cfilter),tp,LOCATION_MZONE,0,1,nil,0x412) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local c=e:GetHandler() local chid=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_REMAIN_FIELD) e1:SetProperty(EFFECT_FLAG_OATH) e1:SetReset(RESET_CHAIN) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_CHAIN_DISABLED) e2:SetOperation(s.tgop) e2:SetLabel(chid) e2:SetReset(RESET_CHAIN) Duel.RegisterEffect(e2,tp) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local chid=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID) if chid~=e:GetLabel() then return end if e:GetOwner():IsRelateToChain(ev) then e:GetOwner():CancelToGrave(false) end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return e:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsLocation(LOCATION_SZONE) then return end if not c:IsRelateToEffect(e) or c:IsStatus(STATUS_LEAVE_CONFIRMED) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Equip(tp,c,tc) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_DISABLE) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_ATTACK) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET) e3:SetValue(aux.imval1) c:RegisterEffect(e3) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_EQUIP_LIMIT) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetValue(aux.TRUE) e3:SetReset(RESET_EVENT+RESETS_STANDARD) c:RegisterEffect(e3) else c:CancelToGrave(false) end end function s.ctcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToGraveAsCost() end e:SetLabelObject(c:GetEquipTarget()) Duel.SendtoGrave(c,REASON_COST) end function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk) local eqc=e:GetHandler():GetEquipTarget() if chk==0 then return eqc and eqc:IsControlerCanBeChanged() end local ec=e:GetLabelObject() if ec:IsLocation(LOCATION_MZONE) then Duel.SetOperationInfo(0,CATEGORY_CONTROL,ec,1,0,0) end end function s.ctop(e,tp,eg,ep,ev,re,r,rp) local ec=e:GetLabelObject() if ec:IsLocation(LOCATION_MZONE) then Duel.GetControl(ec,tp,PHASE_END) end end function s.filter(c) return c:IsSetCard(0x412) and c:IsAbleToDeck() and not c:IsCode(id) end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_REMOVED,0,nil) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) end function s.op(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoDeck(Duel.GetMatchingGroup(s.filter,tp,LOCATION_REMOVED,0,nil),tp,2,REASON_EFFECT) end