--Alchemage Manaspark local cid,id=GetID() function cid.initial_effect(c) --Converge Mana local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1,id) e1:SetTarget(cid.cttg) e1:SetOperation(cid.ctop) c:RegisterEffect(e1) --Atk up local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_GRAVE) e3:SetCost(aux.bfgcost) e3:SetTarget(cid.sptg) e3:SetOperation(cid.spop) c:RegisterEffect(e3) end --Filters function cid.filter(c) return (c:IsCode(21770262) or c:IsCode(21770263) or c:IsCode(21770264)) end --Send to GY function cid.cttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(cid.filter,tp,LOCATION_MZONE,0,1,nil) and Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>0 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,cid.filter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,0,LOCATION_ONFIELD) end function cid.ctop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local lv=math.floor(tc:GetLevel()/3) if tc:IsRelateToEffect(e) and tc:IsFaceup() then if Duel.Destroy(tc,REASON_EFFECT)~=0 and lv>0 then local g=Duel.GetMatchingGroup(nil,1-tp,LOCATION_ONFIELD,0,nil) local sg=g:Select(1-tp,lv,lv,nil) Duel.HintSelection(sg) Duel.SendtoGrave(sg,REASON_RULE) end end end --Reduce ATK/DEF function cid.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end end function cid.spop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) local tc=g:GetFirst() while tc do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-100*Duel.GetCounter(tp,1,0,0x1818)) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,2) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) tc=g:GetNext() end end