name: Flower
card_text: Special Summon 4 "Flower Cardian" monsters with 100 ATK and different names from your Deck in Attack Position, but their effects are negated, also they cannot be Tributed for a Tribute Summon. You can only activate 1 "Flower Gathering" per turn. You cannot Normal or Special Summon other monsters during the turn you activate this card, except "Flower Cardian" monsters.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local SETCARD_ID_0 = 0xe6 --Flower
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local SETCARD_ID_0 = 0xe6 --Flower
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	Duel.AddCustomActivityCounter(id, ACTIVITY_SUMMON, s.counterfilter)
  	Duel.AddCustomActivityCounter(id, ACTIVITY_SPSUMMON, s.counterfilter)
  end
  function s.counterfilter(c)
  	return c:IsSetCard(SETCARD_ID_0)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetCustomActivityCount(id, tp, ACTIVITY_SUMMON) == 0 and Duel.GetCustomActivityCount(id, tp, ACTIVITY_SPSUMMON) == 0
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetCode(EFFECT_CANNOT_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.sumlimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.sumlimit(e, c, sump, sumtype, sumpos, targetp, se)
  	return not c:IsSetCard(SETCARD_ID_0)
  end
  function s.filter(c, e, tp)
  	return c:IsAttack(100) and c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP_ATTACK)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) > 3
  			and Duel.GetMatchingGroup(s.filter, tp, LOCATION_DECK, 0, nil, e, tp):GetClassCount(Card.GetCode) > 3
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 4, tp, LOCATION_DECK)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local ct = math.min(4, (Duel.GetLocationCount(tp, LOCATION_MZONE)))
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_DECK, 0, nil, e, tp)
  	if not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) and ct > 3 and g:GetClassCount(Card.GetCode) > 3 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		aux.GCheckAdditional = aux.dncheck
  		local g1 = g:SelectSubGroup(tp, aux.TRUE, false, 4, 4)
  		aux.GCheckAdditional = nil
  		local tc = g1:GetFirst()
  		while tc do
  			if Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP_ATTACK) then
  				local e1 = Effect.CreateEffect(c)
  				e1:SetType(EFFECT_TYPE_SINGLE)
  				e1:SetCode(EFFECT_DISABLE)
  				e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  				tc:RegisterEffect(e1, true)
  				local e2 = Effect.CreateEffect(c)
  				e2:SetType(EFFECT_TYPE_SINGLE)
  				e2:SetCode(EFFECT_DISABLE_EFFECT)
  				e2:SetValue(RESET_TURN_SET)
  				e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  				tc:RegisterEffect(e2, true)
  				local e3 = Effect.CreateEffect(c)
  				e3:SetType(EFFECT_TYPE_SINGLE)
  				e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  				e3:SetCode(EFFECT_UNRELEASABLE_SUM)
  				e3:SetRange(LOCATION_MZONE)
  				e3:SetValue(1)
  				e3:SetReset(RESET_EVENT + RESETS_STANDARD)
  				tc:RegisterEffect(e3, true)
  			end
  			tc = g1:GetNext()
  		end
  		Duel.SpecialSummonComplete()
  	end
  end
  
  
source_text: Flower
  Special Summon 4 "Flower Cardian" monsters with 100 ATK and different names from your Deck in Attack Position, but their effects are negated, also they cannot be Tributed for a Tribute Summon. You can only activate 1 "Flower Gathering" per turn. You cannot Normal or Special Summon other monsters during the turn you activate this card, except "Flower Cardian" monsters.
target_text: -- Flower
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local SETCARD_ID_0 = 0xe6 --Flower
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	Duel.AddCustomActivityCounter(id, ACTIVITY_SUMMON, s.counterfilter)
  	Duel.AddCustomActivityCounter(id, ACTIVITY_SPSUMMON, s.counterfilter)
  end
  function s.counterfilter(c)
  	return c:IsSetCard(SETCARD_ID_0)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetCustomActivityCount(id, tp, ACTIVITY_SUMMON) == 0 and Duel.GetCustomActivityCount(id, tp, ACTIVITY_SPSUMMON) == 0
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetCode(EFFECT_CANNOT_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.sumlimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.sumlimit(e, c, sump, sumtype, sumpos, targetp, se)
  	return not c:IsSetCard(SETCARD_ID_0)
  end
  function s.filter(c, e, tp)
  	return c:IsAttack(100) and c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP_ATTACK)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) > 3
  			and Duel.GetMatchingGroup(s.filter, tp, LOCATION_DECK, 0, nil, e, tp):GetClassCount(Card.GetCode) > 3
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 4, tp, LOCATION_DECK)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local ct = math.min(4, (Duel.GetLocationCount(tp, LOCATION_MZONE)))
  	local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_DECK, 0, nil, e, tp)
  	if not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) and ct > 3 and g:GetClassCount(Card.GetCode) > 3 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		aux.GCheckAdditional = aux.dncheck
  		local g1 = g:SelectSubGroup(tp, aux.TRUE, false, 4, 4)
  		aux.GCheckAdditional = nil
  		local tc = g1:GetFirst()
  		while tc do
  			if Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP_ATTACK) then
  				local e1 = Effect.CreateEffect(c)
  				e1:SetType(EFFECT_TYPE_SINGLE)
  				e1:SetCode(EFFECT_DISABLE)
  				e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  				tc:RegisterEffect(e1, true)
  				local e2 = Effect.CreateEffect(c)
  				e2:SetType(EFFECT_TYPE_SINGLE)
  				e2:SetCode(EFFECT_DISABLE_EFFECT)
  				e2:SetValue(RESET_TURN_SET)
  				e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  				tc:RegisterEffect(e2, true)
  				local e3 = Effect.CreateEffect(c)
  				e3:SetType(EFFECT_TYPE_SINGLE)
  				e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  				e3:SetCode(EFFECT_UNRELEASABLE_SUM)
  				e3:SetRange(LOCATION_MZONE)
  				e3:SetValue(1)
  				e3:SetReset(RESET_EVENT + RESETS_STANDARD)
  				tc:RegisterEffect(e3, true)
  			end
  			tc = g1:GetNext()
  		end
  		Duel.SpecialSummonComplete()
  	end
  end
  
  