name: Pyramid
card_text: You can select and activate 1 of the following effects:
  ● Increase the ATK of all face-up monsters on your side of the field by 200 points until the End Phase of the turn this card is activated.
  ● Increase the DEF of all face-up monsters on your side of the field by 500 points until the End Phase of the turn this card is activated.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_ATKCHANGE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(TIMING_DAMAGE_STEP)
  	e1:SetCondition(aux.dscon)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsFaceup, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	local op = Duel.SelectOption(tp, aux.Stringid(id, 0), aux.Stringid(id, 1))
  	e:SetLabel(op)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(Card.IsFaceup, tp, LOCATION_MZONE, 0, nil)
  	if g:GetCount() == 0 then
  		return
  	end
  	if e:GetLabel() == 0 then
  		local sc = g:GetFirst()
  		while sc do
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_UPDATE_ATTACK)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			e1:SetValue(200)
  			sc:RegisterEffect(e1)
  			sc = g:GetNext()
  		end
  	else
  		local sc = g:GetFirst()
  		while sc do
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_UPDATE_DEFENSE)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			e1:SetValue(500)
  			sc:RegisterEffect(e1)
  			sc = g:GetNext()
  		end
  	end
  end
  
  
source_text: Pyramid
  You can select and activate 1 of the following effects:
  ● Increase the ATK of all face-up monsters on your side of the field by 200 points until the End Phase of the turn this card is activated.
  ● Increase the DEF of all face-up monsters on your side of the field by 500 points until the End Phase of the turn this card is activated.
target_text: -- Pyramid
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_ATKCHANGE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(TIMING_DAMAGE_STEP)
  	e1:SetCondition(aux.dscon)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsFaceup, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	local op = Duel.SelectOption(tp, aux.Stringid(id, 0), aux.Stringid(id, 1))
  	e:SetLabel(op)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(Card.IsFaceup, tp, LOCATION_MZONE, 0, nil)
  	if g:GetCount() == 0 then
  		return
  	end
  	if e:GetLabel() == 0 then
  		local sc = g:GetFirst()
  		while sc do
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_UPDATE_ATTACK)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			e1:SetValue(200)
  			sc:RegisterEffect(e1)
  			sc = g:GetNext()
  		end
  	else
  		local sc = g:GetFirst()
  		while sc do
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_UPDATE_DEFENSE)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			e1:SetValue(500)
  			sc:RegisterEffect(e1)
  			sc = g:GetNext()
  		end
  	end
  end
  
  