name: Tribute
card_text: Once during this turn, you can Tribute Summon a monster that requires 2 Tributes by banishing 1 monster from each GY instead, also you cannot Special Summon monsters for the rest of this turn.
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)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetFlagEffect(tp, id) == 0
  	end
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SUMMON_PROC)
  	e1:SetTargetRange(LOCATION_HAND, 0)
  	e1:SetCondition(s.otcon)
  	e1:SetTarget(s.ottg)
  	e1:SetOperation(s.otop)
  	e1:SetCountLimit(1)
  	e1:SetValue(SUMMON_TYPE_ADVANCE)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_SET_PROC)
  	Duel.RegisterEffect(e2, tp)
  	Duel.RegisterFlagEffect(tp, id, RESET_PHASE + PHASE_END, 0, 1)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e3:SetReset(RESET_PHASE + PHASE_END)
  	e3:SetTargetRange(1, 0)
  	Duel.RegisterEffect(e3, tp)
  end
  function s.rmfilter(c)
  	return c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
  end
  function s.otcon(e, c, minc)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	return minc <= 2
  		and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  		and Duel.IsExistingMatchingCard(s.rmfilter, tp, LOCATION_GRAVE, 0, 1, nil)
  		and Duel.IsExistingMatchingCard(s.rmfilter, tp, 0, LOCATION_GRAVE, 1, nil)
  end
  function s.ottg(e, c)
  	local mi, ma = c:GetTributeRequirement()
  	return mi <= 2 and ma >= 2
  end
  function s.otop(e, tp, eg, ep, ev, re, r, rp, c)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g1 = Duel.SelectMatchingCard(tp, s.rmfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g2 = Duel.SelectMatchingCard(tp, s.rmfilter, tp, 0, LOCATION_GRAVE, 1, 1, nil)
  	g1:Merge(g2)
  	Duel.Remove(g1, POS_FACEUP, REASON_COST)
  	Duel.ResetFlagEffect(tp, id)
  	c:SetMaterial(nil)
  end
  
  
source_text: Tribute
  Once during this turn, you can Tribute Summon a monster that requires 2 Tributes by banishing 1 monster from each GY instead, also you cannot Special Summon monsters for the rest of this turn.
target_text: -- Tribute
  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)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetFlagEffect(tp, id) == 0
  	end
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SUMMON_PROC)
  	e1:SetTargetRange(LOCATION_HAND, 0)
  	e1:SetCondition(s.otcon)
  	e1:SetTarget(s.ottg)
  	e1:SetOperation(s.otop)
  	e1:SetCountLimit(1)
  	e1:SetValue(SUMMON_TYPE_ADVANCE)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_SET_PROC)
  	Duel.RegisterEffect(e2, tp)
  	Duel.RegisterFlagEffect(tp, id, RESET_PHASE + PHASE_END, 0, 1)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e3:SetReset(RESET_PHASE + PHASE_END)
  	e3:SetTargetRange(1, 0)
  	Duel.RegisterEffect(e3, tp)
  end
  function s.rmfilter(c)
  	return c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
  end
  function s.otcon(e, c, minc)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	return minc <= 2
  		and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  		and Duel.IsExistingMatchingCard(s.rmfilter, tp, LOCATION_GRAVE, 0, 1, nil)
  		and Duel.IsExistingMatchingCard(s.rmfilter, tp, 0, LOCATION_GRAVE, 1, nil)
  end
  function s.ottg(e, c)
  	local mi, ma = c:GetTributeRequirement()
  	return mi <= 2 and ma >= 2
  end
  function s.otop(e, tp, eg, ep, ev, re, r, rp, c)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g1 = Duel.SelectMatchingCard(tp, s.rmfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g2 = Duel.SelectMatchingCard(tp, s.rmfilter, tp, 0, LOCATION_GRAVE, 1, 1, nil)
  	g1:Merge(g2)
  	Duel.Remove(g1, POS_FACEUP, REASON_COST)
  	Duel.ResetFlagEffect(tp, id)
  	c:SetMaterial(nil)
  end
  
  