name: Urubonus,
card_text: Monsters your opponent controls lose 300 ATK/DEF. You can only use each of the following effects of "Urubonus, the Avatar of Malice" once per turn. You can Tribute 1 Reptile monster; Special Summon this card from your hand. You can Tribute 1 monster; all monsters your opponent currently controls lose ATK/DEF equal to the original ATK of the Tributed monster, until the end of this turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--atk/def
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(0, LOCATION_MZONE)
  	e2:SetValue(-300)
  	c:RegisterEffect(e2)
  	local e3 = Effect.Clone(e2)
  	e3:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e3)
  	--change
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetCategory(CATEGORY_ATKCHANGE)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1, id + 1)
  	e4:SetCost(s.thcost)
  	e4:SetTarget(s.thtg)
  	e4:SetOperation(s.thop)
  	c:RegisterEffect(e4)
  end
  function s.cfilter(c, tp)
  	return c:IsRace(RACE_REPTILE) and Duel.GetMZoneCount(tp, c) > 0 and (c:IsControler(tp) or c:IsFaceup())
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, s.cfilter, 1, nil, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local g = Duel.SelectReleaseGroup(tp, s.cfilter, 1, 1, nil, tp)
  	Duel.Release(g, REASON_COST)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, c, 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  function s.rfilter(c, tp)
  	return c:GetTextAttack() > 0 and (c:IsControler(tp) or c:IsFaceup())
  end
  function s.thcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, s.rfilter, 1, nil, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local g = Duel.SelectReleaseGroup(tp, s.rfilter, 1, 1, nil, tp)
  	Duel.Release(g, REASON_COST)
  	local tc = g:GetFirst()
  	local atk = tc:GetBaseAttack()
  	e:SetLabel(atk)
  end
  function s.adfilter(c)
  	return c:IsFaceup() and c:GetAttack() > 0 or c:GetDefense() > 0
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.adfilter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local atk = e:GetLabel()
  	local g = Duel.GetMatchingGroup(Card.IsFaceup, tp, 0, LOCATION_MZONE, nil)
  	local tc = g:GetFirst()
  	while tc do
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetValue(-atk)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_UPDATE_DEFENSE)
  		tc:RegisterEffect(e2)
  		tc = g:GetNext()
  	end
  end
  
  
source_text: Urubonus,
  Monsters your opponent controls lose 300 ATK/DEF. You can only use each of the following effects of "Urubonus, the Avatar of Malice" once per turn. You can Tribute 1 Reptile monster; Special Summon this card from your hand. You can Tribute 1 monster; all monsters your opponent currently controls lose ATK/DEF equal to the original ATK of the Tributed monster, until the end of this turn.
target_text: -- Urubonus,
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--atk/def
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(0, LOCATION_MZONE)
  	e2:SetValue(-300)
  	c:RegisterEffect(e2)
  	local e3 = Effect.Clone(e2)
  	e3:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e3)
  	--change
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetCategory(CATEGORY_ATKCHANGE)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1, id + 1)
  	e4:SetCost(s.thcost)
  	e4:SetTarget(s.thtg)
  	e4:SetOperation(s.thop)
  	c:RegisterEffect(e4)
  end
  function s.cfilter(c, tp)
  	return c:IsRace(RACE_REPTILE) and Duel.GetMZoneCount(tp, c) > 0 and (c:IsControler(tp) or c:IsFaceup())
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, s.cfilter, 1, nil, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local g = Duel.SelectReleaseGroup(tp, s.cfilter, 1, 1, nil, tp)
  	Duel.Release(g, REASON_COST)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, c, 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  function s.rfilter(c, tp)
  	return c:GetTextAttack() > 0 and (c:IsControler(tp) or c:IsFaceup())
  end
  function s.thcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, s.rfilter, 1, nil, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local g = Duel.SelectReleaseGroup(tp, s.rfilter, 1, 1, nil, tp)
  	Duel.Release(g, REASON_COST)
  	local tc = g:GetFirst()
  	local atk = tc:GetBaseAttack()
  	e:SetLabel(atk)
  end
  function s.adfilter(c)
  	return c:IsFaceup() and c:GetAttack() > 0 or c:GetDefense() > 0
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.adfilter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local atk = e:GetLabel()
  	local g = Duel.GetMatchingGroup(Card.IsFaceup, tp, 0, LOCATION_MZONE, nil)
  	local tc = g:GetFirst()
  	while tc do
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetValue(-atk)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_UPDATE_DEFENSE)
  		tc:RegisterEffect(e2)
  		tc = g:GetNext()
  	end
  end
  
  