--created & coded by Lyris, art from "Guardian Elma" & at https://us.123rf.com/450wm/iimages/iimages1603/iimages160300284/53485338-stock-vector-forest-scene-with-trail-in-the-woods-illustration.jpg?ver=6 --インライトメント・エルマ武器庫 local s,id,o=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0xda6)) e1:SetValue(1) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_BATTLED) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCategory(CATEGORY_DESTROY) e2:SetDescription(1101) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) local e1=Effect.CreateEffect(c) e1:SetDescription(1152) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsDiscardable() end Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD) end function s.filter(c,e,tp) return c:IsCode(CARD_INLIGHTENED_PSYCHIC_HELMET) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE) end function s.operation(e,tp,eg,ep,ev,re,r,rp,chk) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.SpecialSummon(Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp),0,tp,tp,false,false,POS_FACEUP) end function s.descon(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() if d and d:IsControler(tp) then a,d=d,a end return a:IsSetCard(0xda6) and a~=e:GetHandler() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local dir=Duel.GetAttackTarget()==nil if chkc then if dir then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) else return chkc==Duel.GetAttacker():GetBattleTarget() end end if chk==0 then return true end local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() if d and d:IsControler(tp) then a,d=d,a end local g=Group.FromCards(d) if dir then g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_MZONE,1,1,nil) else Duel.SetTargetCard(d) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsControler(1-tp) and e:GetHandler():IsLocation(LOCATION_MZONE) and (Duel.GetAttackTarget()==nil or tc:IsRelateToBattle()) then Duel.Destroy(tc,REASON_EFFECT) end end