name: Elborz,
card_text: All WIND Winged Beast monsters on the field gain 300 ATK/DEF. You can only use each of the following effects of "Elborz, the Sacred Lands of Simorgh" once per turn.
  ● You can reveal 1 Level 5 or higher WIND Winged Beast monster in your hand; this turn, you can Normal Summon Winged Beast monsters for 1 less Tribute (even if this card leaves the field).
  ● If you control a WIND Winged Beast monster, you can: Immediately after this effect resolves, Normal Summon 1 Winged Beast monster.
lua: local s, id, o = 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)
  	--atkup
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e2:SetTarget(s.atktg)
  	e2:SetValue(300)
  	c:RegisterEffect(e2)
  	local e5 = e2:Clone()
  	e5:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e5)
  	--decrease tribute
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetRange(LOCATION_FZONE)
  	e3:SetCountLimit(1, id)
  	e3:SetCost(s.trcost)
  	e3:SetOperation(s.trop)
  	c:RegisterEffect(e3)
  	--summon
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetCategory(CATEGORY_SUMMON)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_FZONE)
  	e4:SetCountLimit(1, id + 1)
  	e4:SetCondition(s.sumcon)
  	e4:SetTarget(s.sumtg)
  	e4:SetOperation(s.sumop)
  	c:RegisterEffect(e4)
  end
  function s.atktg(e, c)
  	return c:IsRace(RACE_WINDBEAST) and c:IsAttribute(ATTRIBUTE_WIND)
  end
  function s.costfilter(c)
  	return c:IsLevelAbove(5) and c:IsRace(RACE_WINDBEAST) and c:IsAttribute(ATTRIBUTE_WIND) and not c:IsPublic()
  end
  function s.trcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_HAND, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local g = Duel.SelectMatchingCard(tp, s.costfilter, tp, LOCATION_HAND, 0, 1, 1, nil)
  	Duel.ConfirmCards(1 - tp, g)
  	Duel.ShuffleHand(tp)
  end
  function s.trop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_DECREASE_TRIBUTE)
  	e1:SetTargetRange(LOCATION_HAND, 0)
  	e1:SetTarget(aux.TargetBoolFunction(Card.IsRace, RACE_WINDBEAST))
  	e1:SetValue(0x1)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsRace(RACE_WINDBEAST) and c:IsAttribute(ATTRIBUTE_WIND)
  end
  function s.sumcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.sumfilter(c)
  	return c:IsRace(RACE_WINDBEAST) and c:IsSummonable(true, nil)
  end
  function s.sumtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.sumfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SUMMON, nil, 1, 0, 0)
  end
  function s.sumop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SUMMON)
  	local g = Duel.SelectMatchingCard(tp, s.sumfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, 1, nil)
  	local tc = g:GetFirst()
  	if tc then
  		Duel.Summon(tp, tc, true, nil)
  	end
  end
  
  
source_text: Elborz,
  All WIND Winged Beast monsters on the field gain 300 ATK/DEF. You can only use each of the following effects of "Elborz, the Sacred Lands of Simorgh" once per turn.
  ● You can reveal 1 Level 5 or higher WIND Winged Beast monster in your hand; this turn, you can Normal Summon Winged Beast monsters for 1 less Tribute (even if this card leaves the field).
  ● If you control a WIND Winged Beast monster, you can: Immediately after this effect resolves, Normal Summon 1 Winged Beast monster.
target_text: -- Elborz,
  local s, id, o = 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)
  	--atkup
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e2:SetTarget(s.atktg)
  	e2:SetValue(300)
  	c:RegisterEffect(e2)
  	local e5 = e2:Clone()
  	e5:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e5)
  	--decrease tribute
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetRange(LOCATION_FZONE)
  	e3:SetCountLimit(1, id)
  	e3:SetCost(s.trcost)
  	e3:SetOperation(s.trop)
  	c:RegisterEffect(e3)
  	--summon
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetCategory(CATEGORY_SUMMON)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_FZONE)
  	e4:SetCountLimit(1, id + 1)
  	e4:SetCondition(s.sumcon)
  	e4:SetTarget(s.sumtg)
  	e4:SetOperation(s.sumop)
  	c:RegisterEffect(e4)
  end
  function s.atktg(e, c)
  	return c:IsRace(RACE_WINDBEAST) and c:IsAttribute(ATTRIBUTE_WIND)
  end
  function s.costfilter(c)
  	return c:IsLevelAbove(5) and c:IsRace(RACE_WINDBEAST) and c:IsAttribute(ATTRIBUTE_WIND) and not c:IsPublic()
  end
  function s.trcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_HAND, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local g = Duel.SelectMatchingCard(tp, s.costfilter, tp, LOCATION_HAND, 0, 1, 1, nil)
  	Duel.ConfirmCards(1 - tp, g)
  	Duel.ShuffleHand(tp)
  end
  function s.trop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_DECREASE_TRIBUTE)
  	e1:SetTargetRange(LOCATION_HAND, 0)
  	e1:SetTarget(aux.TargetBoolFunction(Card.IsRace, RACE_WINDBEAST))
  	e1:SetValue(0x1)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsRace(RACE_WINDBEAST) and c:IsAttribute(ATTRIBUTE_WIND)
  end
  function s.sumcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.sumfilter(c)
  	return c:IsRace(RACE_WINDBEAST) and c:IsSummonable(true, nil)
  end
  function s.sumtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.sumfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SUMMON, nil, 1, 0, 0)
  end
  function s.sumop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SUMMON)
  	local g = Duel.SelectMatchingCard(tp, s.sumfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, 1, nil)
  	local tc = g:GetFirst()
  	if tc then
  		Duel.Summon(tp, tc, true, nil)
  	end
  end
  
  