--Automate ID local s,id=GetID() function s.initial_effect(c) aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_WATER),6,3) c:EnableReviveLimit() local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --atk local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetValue(s.atkval) c:RegisterEffect(e2) local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DESTROY) e2:SetDescription(aux.Stringid(85252081,0)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id+100) e2:SetHintTiming(0,TIMING_END_PHASE) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not (Duel.IsPlayerAffectedByEffect(tp,EFFECT_REVERSE_RECOVER) and not Duel.IsPlayerAffectedByEffect(tp,EFFECT_REVERSE_DAMAGE)) end Duel.Recover(tp,500,REASON_COST) end function s.spfilter(c,e,tp) return c:IsSetCard(0x6969) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g==0 then return end local tc=g:GetFirst() Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end function s.atkval(e,c) return c:GetOverlayCount()*500 end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local ct=math.floor((Duel.GetLP(tp)-Duel.GetLP(1-tp))/2000) if chk==0 then return ct>0 and e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_EFFECT) and Duel.IsExistingTarget(nil,tp,0,LOCATION_ONFIELD,ct,nil) end local g=Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,ct,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:CheckRemoveOverlayCard(tp,1,REASON_EFFECT) then return end c:RemoveOverlayCard(tp,1,1,REASON_EFFECT) local ct=math.floor((Duel.GetLP(tp)-Duel.GetLP(1-tp))/2000) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_ONFIELD,ct,ct,nil) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end