--created & coded by Lyris, art taken by Casey Horner of Unsplash --アーマリン灯台 local s,id,o=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,0,id) local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) e0:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH) e0:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e0:SetTarget(s.target) e0:SetOperation(s.activate) c:RegisterEffect(e0) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_SZONE) e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.cfilter(c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0xa6c) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.activate(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,s.cfilter,tp,LOCATION_DECK,0,1,1,nil) Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() if a:IsControler(1-tp) then a=Duel.GetAttackTarget() end return a and a:IsSetCard(0xa6c) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local a=Duel.GetAttacker() if a:IsControler(1-tp) then a=Duel.GetAttackTarget() end if not c:IsRelateToEffect(e) or not a:IsRelateToBattle() then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,aux.AND(s.cfilter,aux.NOT(Card.IsCode)),tp,LOCATION_DECK,0,1,1,nil,a:GetCode()) if Duel.SendtoHand(g,nil,REASON_EFFECT)==0 then return end Duel.ConfirmCards(1-tp,g) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_TO_HAND) e1:SetTargetRange(1,0) e1:SetTarget(s.thlimit) e1:SetLabel(g:GetFirst():GetCode()) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end function s.thlimit(e,c,tp,re) return c:IsCode(e:GetLabel()) and re and re:GetHandler():IsCode(id) end