name: Steamed
card_text: 2 Level 4 monsters
  You can detach 1 material from this card; destroy 1 Dinosaur monster in your hand or face-up field, then you can change the battle position of 1 monster on the field. At the start of the Damage Step, if your other Dinosaur monster battles: You can destroy this card, and if you do, that Dinosaur monster gains 2000 ATK until the end of the Battle Phase. You can only use each effect of "Steamed Sabersaurus" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 4, 2)
  	c:EnableReviveLimit()
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_POSITION)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.descost)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  	--atk up
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DESTROY + CATEGORY_ATKCHANGE)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_BATTLE_START)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + o)
  	e2:SetCondition(s.atkcon)
  	e2:SetTarget(s.atktg)
  	e2:SetOperation(s.atkop)
  	c:RegisterEffect(e2)
  end
  function s.descost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():CheckRemoveOverlayCard(tp, 1, REASON_COST)
  	end
  	e:GetHandler():RemoveOverlayCard(tp, 1, 1, REASON_COST)
  end
  function s.desfilter(c)
  	return c:IsFaceupEx() and c:IsRace(RACE_DINOSAUR)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.desfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, nil, 1, tp, LOCATION_HAND + LOCATION_MZONE)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local dg = Duel.SelectMatchingCard(tp, s.desfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, 1, nil)
  	if dg:GetCount() > 0 then
  		Duel.HintSelection(dg)
  		if Duel.Destroy(dg, REASON_EFFECT) > 0 and Duel.IsExistingMatchingCard(Card.IsCanChangePosition, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil) and Duel.SelectYesNo(tp, aux.Stringid(id, 2)) then
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_POSCHANGE)
  			local cg = Duel.SelectTarget(tp, Card.IsCanChangePosition, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
  			if cg:GetCount() > 0 then
  				Duel.BreakEffect()
  				Duel.HintSelection(cg)
  				Duel.ChangePosition(cg:GetFirst(), POS_FACEUP_DEFENSE, POS_FACEUP_DEFENSE, POS_FACEUP_ATTACK, POS_FACEUP_ATTACK)
  			end
  		end
  	end
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	local a = Duel.GetAttacker()
  	local d = Duel.GetAttackTarget()
  	if not a:IsControler(tp) then
  		a, d = d, a
  	end
  	if a and a ~= e:GetHandler() and a:IsFaceup() and a:IsControler(tp) and a:IsRace(RACE_DINOSAUR) and a:IsRelateToBattle() then
  		e:SetLabelObject(a)
  		return true
  	end
  	return false
  end
  function s.atktg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, e:GetHandler(), 1, 0, 0)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local a = e:GetLabelObject()
  	if c:IsRelateToEffect(e) and Duel.Destroy(c, REASON_EFFECT) ~= 0 then
  		if not a or not a:IsRelateToBattle() then
  			return
  		end
  		if a:IsFaceup() and a:IsRace(RACE_DINOSAUR) and a:IsType(TYPE_MONSTER) then
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_UPDATE_ATTACK)
  			e1:SetValue(2000)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_BATTLE)
  			a:RegisterEffect(e1)
  		end
  	end
  end
  
  
source_text: Steamed
  2 Level 4 monsters
  You can detach 1 material from this card; destroy 1 Dinosaur monster in your hand or face-up field, then you can change the battle position of 1 monster on the field. At the start of the Damage Step, if your other Dinosaur monster battles: You can destroy this card, and if you do, that Dinosaur monster gains 2000 ATK until the end of the Battle Phase. You can only use each effect of "Steamed Sabersaurus" once per turn.
target_text: -- Steamed
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 4, 2)
  	c:EnableReviveLimit()
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_POSITION)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.descost)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  	--atk up
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DESTROY + CATEGORY_ATKCHANGE)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_BATTLE_START)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + o)
  	e2:SetCondition(s.atkcon)
  	e2:SetTarget(s.atktg)
  	e2:SetOperation(s.atkop)
  	c:RegisterEffect(e2)
  end
  function s.descost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():CheckRemoveOverlayCard(tp, 1, REASON_COST)
  	end
  	e:GetHandler():RemoveOverlayCard(tp, 1, 1, REASON_COST)
  end
  function s.desfilter(c)
  	return c:IsFaceupEx() and c:IsRace(RACE_DINOSAUR)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.desfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, nil, 1, tp, LOCATION_HAND + LOCATION_MZONE)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local dg = Duel.SelectMatchingCard(tp, s.desfilter, tp, LOCATION_HAND + LOCATION_MZONE, 0, 1, 1, nil)
  	if dg:GetCount() > 0 then
  		Duel.HintSelection(dg)
  		if Duel.Destroy(dg, REASON_EFFECT) > 0 and Duel.IsExistingMatchingCard(Card.IsCanChangePosition, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil) and Duel.SelectYesNo(tp, aux.Stringid(id, 2)) then
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_POSCHANGE)
  			local cg = Duel.SelectTarget(tp, Card.IsCanChangePosition, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
  			if cg:GetCount() > 0 then
  				Duel.BreakEffect()
  				Duel.HintSelection(cg)
  				Duel.ChangePosition(cg:GetFirst(), POS_FACEUP_DEFENSE, POS_FACEUP_DEFENSE, POS_FACEUP_ATTACK, POS_FACEUP_ATTACK)
  			end
  		end
  	end
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	local a = Duel.GetAttacker()
  	local d = Duel.GetAttackTarget()
  	if not a:IsControler(tp) then
  		a, d = d, a
  	end
  	if a and a ~= e:GetHandler() and a:IsFaceup() and a:IsControler(tp) and a:IsRace(RACE_DINOSAUR) and a:IsRelateToBattle() then
  		e:SetLabelObject(a)
  		return true
  	end
  	return false
  end
  function s.atktg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, e:GetHandler(), 1, 0, 0)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local a = e:GetLabelObject()
  	if c:IsRelateToEffect(e) and Duel.Destroy(c, REASON_EFFECT) ~= 0 then
  		if not a or not a:IsRelateToBattle() then
  			return
  		end
  		if a:IsFaceup() and a:IsRace(RACE_DINOSAUR) and a:IsType(TYPE_MONSTER) then
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_UPDATE_ATTACK)
  			e1:SetValue(2000)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_BATTLE)
  			a:RegisterEffect(e1)
  		end
  	end
  end
  
  