--Automate ID local s,id=GetID() function s.initial_effect(c) --xyz summon aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_WATER),4,2) c:EnableReviveLimit() --special summon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_RECOVER) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) e1:SetCountLimit(1,id) c:RegisterEffect(e1) --material local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.condition) e2:SetCost(s.cost) e2:SetTarget(s.target) e2:SetOperation(s.operation) e2:SetCountLimit(1,id+100) c:RegisterEffect(e2) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_TO_GRAVE_REDIRECT) e2:SetValue(s.val) c:RegisterEffect(e2) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ) and Duel.IsExistingMatchingCard(function(c) return c:IsFaceup() and c:IsCode(69010) end,tp,LOCATION_ONFIELD,0,1,nil) end function s.spfilter(c,e,tp) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetTargetPlayer(tp) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) local tc=g:GetFirst() if tc:IsRelateToEffect(e) then if Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 then Duel.BreakEffect() local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) Duel.Recover(p,tc:GetAttack()/2,REASON_EFFECT) end end end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetLP(tp)>Duel.GetLP(1-tp) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) end function s.filter(c) return c:IsSetCard(0x6969) and c:IsType(TYPE_MONSTER) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_DECK+LOCATION_EXTRA) and s.filter(chkc) and c:IsControler(tp) end if chk==0 then return e:GetHandler():IsType(TYPE_XYZ) and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,nil) 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.SelectTarget(tp,s.filter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,1,nil) local tc=g:GetFirst() Duel.Overlay(c,Group.FromCards(tc)) end function s.val(e) local c=e:GetHandler() local tc=c:GetOverlayTarget() if tc then local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_TO_GRAVE) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCondition(s.descon) e3:SetTarget(s.destg) e3:SetOperation(s.desop) e3:SetLabelObject(tc) e3:SetCountLimit(1,id+200) c:RegisterEffect(e3) end return LOCATION_GRAVE end function s.descon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() return tc:IsLocation(LOCATION_MZONE) end function s.thfilter(c) return c:IsSetCard(0x95) and c:IsAbleToHand() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.thfilter(chkc,e,tp) end if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_GRAVE) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) if #g==0 then return end Duel.BreakEffect() Duel.SendtoHand(g,nil,REASON_EFFECT) end end