name: Degen-Force
card_text: Tribute 1 Level 4 or higher Dinosaur-Type monster; Special Summon 2 Level 3 or lower Reptile-Type monsters from your hand and/or Graveyard.
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_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMING_END_PHASE)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c)
  	return c:IsLevelAbove(4) and c:IsRace(RACE_DINOSAUR)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	e:SetLabel(1)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, s.cfilter, 1, nil)
  	end
  	local rg = Duel.SelectReleaseGroup(tp, s.cfilter, 1, 1, nil)
  	Duel.Release(rg, REASON_COST)
  end
  function s.spfilter(c, e, tp)
  	return c:IsLevelBelow(3) and c:IsRace(RACE_REPTILE) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		local chkf = (e:GetLabel() == 1)
  		e:SetLabel(0)
  		local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND + LOCATION_GRAVE, 0, 2, nil, e, tp)
  			and ((chkf and ft > 0) or (not chkf and ft > 1))
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 2, tp, LOCATION_HAND + LOCATION_GRAVE)
  	e:SetLabel(0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		return
  	end
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) < 2 then
  		return
  	end
  	local g = Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter), tp, LOCATION_HAND + LOCATION_GRAVE, 0, nil, e, tp)
  	if g:GetCount() > 1 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local sg = g:Select(tp, 2, 2, nil)
  		Duel.SpecialSummon(sg, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  
source_text: Degen-Force
  Tribute 1 Level 4 or higher Dinosaur-Type monster; Special Summon 2 Level 3 or lower Reptile-Type monsters from your hand and/or Graveyard.
target_text: -- Degen-Force
  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_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMING_END_PHASE)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c)
  	return c:IsLevelAbove(4) and c:IsRace(RACE_DINOSAUR)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	e:SetLabel(1)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, s.cfilter, 1, nil)
  	end
  	local rg = Duel.SelectReleaseGroup(tp, s.cfilter, 1, 1, nil)
  	Duel.Release(rg, REASON_COST)
  end
  function s.spfilter(c, e, tp)
  	return c:IsLevelBelow(3) and c:IsRace(RACE_REPTILE) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		local chkf = (e:GetLabel() == 1)
  		e:SetLabel(0)
  		local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND + LOCATION_GRAVE, 0, 2, nil, e, tp)
  			and ((chkf and ft > 0) or (not chkf and ft > 1))
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 2, tp, LOCATION_HAND + LOCATION_GRAVE)
  	e:SetLabel(0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		return
  	end
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) < 2 then
  		return
  	end
  	local g = Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter), tp, LOCATION_HAND + LOCATION_GRAVE, 0, nil, e, tp)
  	if g:GetCount() > 1 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local sg = g:Select(tp, 2, 2, nil)
  		Duel.SpecialSummon(sg, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  