name: Big
card_text: Destroy as many WATER monsters you control as possible, then you can Special Summon WATER monsters from your hand, up to the number of monsters destroyed by this effect.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.dfilter(c)
  	return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_WATER)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.dfilter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(s.dfilter, tp, LOCATION_MZONE, 0, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  end
  function s.spfilter(c, e, tp)
  	return c:IsAttribute(ATTRIBUTE_WATER) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.dfilter, tp, LOCATION_MZONE, 0, nil)
  	local ct = Duel.Destroy(g, REASON_EFFECT)
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	if ct == 0 or ft <= 0 then
  		return
  	end
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		ft = 1
  	end
  	if ct > ft then
  		ct = ft
  	end
  	local sg = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_HAND, 0, nil, e, tp)
  	if sg:GetCount() ~= 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local spg = sg:Select(tp, 1, ct, nil)
  		Duel.SpecialSummon(spg, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  
source_text: Big
  Destroy as many WATER monsters you control as possible, then you can Special Summon WATER monsters from your hand, up to the number of monsters destroyed by this effect.
target_text: -- Big
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.dfilter(c)
  	return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_WATER)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.dfilter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(s.dfilter, tp, LOCATION_MZONE, 0, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  end
  function s.spfilter(c, e, tp)
  	return c:IsAttribute(ATTRIBUTE_WATER) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.dfilter, tp, LOCATION_MZONE, 0, nil)
  	local ct = Duel.Destroy(g, REASON_EFFECT)
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	if ct == 0 or ft <= 0 then
  		return
  	end
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		ft = 1
  	end
  	if ct > ft then
  		ct = ft
  	end
  	local sg = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_HAND, 0, nil, e, tp)
  	if sg:GetCount() ~= 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local spg = sg:Select(tp, 1, ct, nil)
  		Duel.SpecialSummon(spg, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  