--RUM Triton Force --Script by XGlitchy30 function c31231307.initial_effect(c) aux.AddCodeList(c,31231300) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(c31231307.target) e1:SetOperation(c31231307.activate) c:RegisterEffect(e1) --recycle local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_GRAVE) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCondition(c31231307.thcon) e2:SetTarget(c31231307.thtg) e2:SetOperation(c31231307.thop) c:RegisterEffect(e2) --shuffle local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_TODECK) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_GRAVE) e3:SetCountLimit(1,31231307) e3:SetTarget(c31231307.tdtg) e3:SetOperation(c31231307.tdop) c:RegisterEffect(e3) end --c31231307.card_code_list={31231300} --filters function c31231307.filter1(c,e,tp) local rk=c:GetRank() return rk>0 and c:IsFaceup() and c:IsRace(RACE_AQUA) and Duel.IsExistingMatchingCard(c31231307.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c,rk+2) and Duel.GetLocationCountFromEx(tp,tp,c)>0 end function c31231307.spfilter(c,e,tp,mc,rk) return c:GetRank()==rk and c:IsSetCard(0x3233) and mc:IsCanBeXyzMaterial(c) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) end function c31231307.tdfilter(c) return c:IsSetCard(0x3233) and c:IsAbleToDeck() end --Activate function c31231307.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and c31231307.filter1(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(c31231307.filter1,tp,LOCATION_MZONE,0,1,nil,e,tp) end e:SetCategory(CATEGORY_SPECIAL_SUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,c31231307.filter1,tp,LOCATION_MZONE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function c31231307.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if Duel.GetLocationCountFromEx(tp,tp,tc)<=0 then return end if tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsControler(1-tp) or tc:IsImmuneToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c31231307.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc,tc:GetRank()+2) local sc=g:GetFirst() if sc then local mg=tc:GetOverlayGroup() if mg:GetCount()~=0 then Duel.Overlay(sc,mg) end sc:SetMaterial(Group.FromCards(tc)) Duel.Overlay(sc,Group.FromCards(tc)) if Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)~=0 then if e:GetHandler():IsRelateToEffect(e) then e:GetHandler():CancelToGrave() Duel.Overlay(sc,Group.FromCards(e:GetHandler())) end end sc:CompleteProcedure() end end --recycle function c31231307.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_DECK) and re:IsActiveType(TYPE_MONSTER) and re:GetHandler():IsAttribute(ATTRIBUTE_WATER) and bit.band(r,REASON_EFFECT)~=0 end function c31231307.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsAbleToHand() end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c31231307.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsLocation(LOCATION_GRAVE) and c:IsAbleToHand() then Duel.SendtoHand(c,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,c) end end --shuffle function c31231307.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c31231307.tdfilter,tp,LOCATION_REMOVED,0,2,nil) and e:GetHandler():IsAbleToDeck() end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,2,tp,LOCATION_REMOVED) end function c31231307.tdop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Duel.GetMatchingGroup(c31231307.tdfilter,tp,LOCATION_REMOVED,0,nil) if g:GetCount()<2 or (not c:IsAbleToDeck() or not c:IsLocation(LOCATION_GRAVE)) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local dg=g:Select(tp,2,2,nil) if Duel.SendtoDeck(dg,nil,2,REASON_EFFECT)~=0 then Duel.ShuffleDeck(tp) Duel.SendtoDeck(c,nil,2,REASON_EFFECT) Duel.ShuffleDeck(tp) end end