name: Garmr
card_text: If this card battles a Level 4 or lower monster, after damage calculation: You can return that monster to the hand.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_BATTLED)
  	e1:SetCondition(s.retcon)
  	e1:SetTarget(s.rettg)
  	e1:SetOperation(s.retop)
  	c:RegisterEffect(e1)
  end
  function s.retcon(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetAttacker()
  	if tc == e:GetHandler() then
  		tc = Duel.GetAttackTarget()
  	end
  	if not tc then
  		return false
  	end
  	e:SetLabelObject(tc)
  	return tc:IsLevelBelow(4) and not tc:IsStatus(STATUS_BATTLE_DESTROYED)
  end
  function s.rettg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetLabelObject():IsAbleToHand()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, e:GetLabelObject(), 0, 0, 0)
  end
  function s.retop(e, tp, eg, ep, ev, re, r, rp)
  	if e:GetLabelObject():IsRelateToBattle() then
  		Duel.SendtoHand(e:GetLabelObject(), nil, REASON_EFFECT)
  	end
  end
  
  
source_text: Garmr
  If this card battles a Level 4 or lower monster, after damage calculation: You can return that monster to the hand.
target_text: -- Garmr
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_BATTLED)
  	e1:SetCondition(s.retcon)
  	e1:SetTarget(s.rettg)
  	e1:SetOperation(s.retop)
  	c:RegisterEffect(e1)
  end
  function s.retcon(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetAttacker()
  	if tc == e:GetHandler() then
  		tc = Duel.GetAttackTarget()
  	end
  	if not tc then
  		return false
  	end
  	e:SetLabelObject(tc)
  	return tc:IsLevelBelow(4) and not tc:IsStatus(STATUS_BATTLE_DESTROYED)
  end
  function s.rettg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetLabelObject():IsAbleToHand()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, e:GetLabelObject(), 0, 0, 0)
  end
  function s.retop(e, tp, eg, ep, ev, re, r, rp)
  	if e:GetLabelObject():IsRelateToBattle() then
  		Duel.SendtoHand(e:GetLabelObject(), nil, REASON_EFFECT)
  	end
  end
  
  