--Aquabizarre Waterfalls --scripted by Rawstone local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --reduce tribute local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_FIELD) e2:SetTargetRange(LOCATION_HAND,0) e2:SetCode(EFFECT_SUMMON_PROC) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1,id+100) e2:SetCondition(s.ntcon) e2:SetTarget(s.nttg) c:RegisterEffect(e2) --make opp place on top local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TODECK) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1) e3:SetCondition(s.condition) e3:SetCost(s.cost) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) --plc on top local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_TODECK) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_TO_GRAVE) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetCountLimit(1,id+200) e4:SetCondition(s.cornd) e4:SetTarget(s.tdtg) e4:SetOperation(s.tdop) c:RegisterEffect(e4) end function s.ntcon(e,c,minc) if c==nil then return true end return minc==0 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 end function s.nttg(e,c) return c:IsLevelAbove(5) and c:IsSetCard(0xb23) end function s.filtor(c) return c:IsSetCard(0xb23) and c:IsFaceup() and c:IsType(TYPE_SPELL) and c:IsType(TYPE_CONTINUOUS) and c:IsLocation(LOCATION_SZONE) end function s.filtor2(c) return c:IsSetCard(0xb23) and c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsLocation(LOCATION_MZONE) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.filtor2,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(s.filtor,tp,LOCATION_SZONE,0,1,nil) end function s.filter(c) return c:IsSetCard(0xb23) and (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsAbleToGraveAsCost() end function s.filter2(c) return (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,c) Duel.SendtoGrave(g,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetMatchingGroupCount(s.filter2,1-tp,LOCATION_ONFIELD+LOCATION_HAND,0,nil)>=1 end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,0,LOCATION_ONFIELD+LOCATION_HAND) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsExistingMatchingCard(s.filtor2,tp,LOCATION_MZONE,0,1,nil) then return end if not Duel.IsExistingMatchingCard(s.filtor,tp,LOCATION_SZONE,0,1,nil) then return end if not e:GetHandler():IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(s.filter2,1-tp,LOCATION_ONFIELD+LOCATION_HAND,0,nil) if g:GetCount()>0 then Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TODECK) local sg=g:Select(1-tp,1,1,nil) Duel.HintSelection(sg) Duel.SendtoDeck(sg,nil,0,REASON_RULE) end end function s.cornd(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.filtor2,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(s.filtor,tp,LOCATION_SZONE,0,1,nil) end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToDeck() end Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsExistingMatchingCard(s.filtor2,tp,LOCATION_MZONE,0,1,nil) then return end if not Duel.IsExistingMatchingCard(s.filtor,tp,LOCATION_SZONE,0,1,nil) then return end if e:GetHandler():IsRelateToEffect(e) then Duel.SendtoDeck(e:GetHandler(),nil,0,REASON_EFFECT) end end