--created by Swag, coded by Lyris local s,id=GetID() function s.initial_effect(c) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x412)) e2:SetValue(s.val) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetOperation(s.activate) c:RegisterEffect(e1) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_SPSUMMON_SUCCESS) e4:SetRange(LOCATION_FZONE) e4:SetCountLimit(1,id) e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e4:SetCondition(s.con(TYPE_XYZ)) e4:SetTarget(s.xtg) e4:SetOperation(s.xop) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCategory(CATEGORY_TOGRAVE) e5:SetCondition(s.con(TYPE_SYNCHRO)) e5:SetTarget(s.stg) e5:SetOperation(s.sop) c:RegisterEffect(e5) local e6=e4:Clone() e6:SetCategory(CATEGORY_SPECIAL_SUMMON) e6:SetCondition(s.con(TYPE_LINK)) e6:SetTarget(s.ltg) e6:SetOperation(s.lop) c:RegisterEffect(e6) end function s.val(e,c) return Duel.GetMatchingGroup(Card.IsType,e:GetHandlerPlayer(),LOCATION_GRAVE,0,nil,TYPE_MONSTER):GetClassCount(Card.GetAttribute)*100 end function s.filter(c) return c:IsSetCard(0x412) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function s.activate(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil) if #g>0 and Duel.SelectYesNo(tp,1190) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:Select(tp,1,1,nil) Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end function s.con(typ) return function(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(function(c) return c:IsFaceup() and c:IsSetCard(0x412) and c:IsControler(tp) and c:IsType(typ) end,1,nil) end end function s.xfilter(c,tp) return c:IsSetCard(0x412) and c:IsCanOverlay(tp) end function s.xtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.xfilter,tp,LOCATION_GRAVE,0,1,nil,tp) and Duel.IsExistingMatchingCard(aux.AND(Card.IsFaceup,Card.IsType),tp,LOCATION_MZONE,0,1,nil,TYPE_XYZ) end Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,0) end function s.xop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEDOWN) local tc=Duel.SelectMatchingCard(tp,aux.AND(Card.IsFaceup,Card.IsType),tp,LOCATION_MZONE,0,1,1,nil,TYPE_XYZ):GetFirst() if not tc then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) Duel.Overlay(tc,Duel.SelectMatchingCard(tp,s.xfilter,tp,LOCATION_GRAVE,0,1,1,nil,tp)) end function s.stg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.AND(Card.IsSetCard,Card.IsAbleToGrave),tp,LOCATION_DECK,0,1,nil,0x412) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.sop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.SendtoGrave(Duel.SelectMatchingCard(tp,aux.AND(Card.IsSetCard,Card.IsAbleToGrave),tp,LOCATION_DECK,0,1,1,nil,0x412),REASON_EFFECT) end function s.lfilter(c,e,tp) return c:IsSetCard(0x412) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.ltg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.lfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.lop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.lfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)~=0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+RESETS_REDIRECT) e1:SetValue(LOCATION_REMOVED) g:GetFirst():RegisterEffect(e1,true) end end