--created by Eaden, coded by Lyris local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_DARK),6,2) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCategory(CATEGORY_TOHAND) e1:SetTarget(function(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 end end) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id+100) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetCondition(function(e) local c=e:GetHandler() return aux.dscon() and c:GetBattleTarget() and c:GetOverlayCount()>5 end) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local g=Duel.GetDecktopGroup(tp,1) Duel.DisableShuffleCheck() Duel.Overlay(c,g) local og=Duel.GetOverlayGroup(tp,1,0):Filter(Card.IsAbleToHand,nil) if g:GetFirst():IsLocation(LOCATION_OVERLAY) and #og>0 and Duel.SelectYesNo(tp,1190) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=og:Select(tp,1,1,nil) Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end function s.filter(c) return c:IsCanOverlay() and c:GetBaseAttack()>0 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,0,1,e:GetHandler()) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_MZONE,0,1,1,c) local tc=g:GetFirst() local atk=tc:GetBaseAttack() Duel.Overlay(c,g) if tc and tc:IsLocation(LOCATION_OVERLAY) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE+RESET_PHASE+PHASE_END) e1:SetValue(math.ceil(atk/2)) c:RegisterEffect(e1) end end