name: Handigallop
card_text: Cannot attack directly. Gains ATK equal to the difference between your LP and your opponent's. If your LP are higher than your opponent's, you take any battle damage your opponent would have taken from battles involving this attacking card, instead.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--cannot direct attack
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
  	c:RegisterEffect(e1)
  	--atk update
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetValue(s.atkval)
  	c:RegisterEffect(e2)
  	--damage
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_REFLECT_BATTLE_DAMAGE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e3:SetTargetRange(0, 1)
  	e3:SetCondition(s.rfcon)
  	c:RegisterEffect(e3)
  end
  function s.atkval(e, c)
  	return math.abs(Duel.GetLP(0) - Duel.GetLP(1))
  end
  function s.rfcon(e)
  	local tp = e:GetHandlerPlayer()
  	return Duel.GetLP(tp) > Duel.GetLP(1 - tp) and Duel.GetAttacker() == e:GetHandler()
  end
  
  
source_text: Handigallop
  Cannot attack directly. Gains ATK equal to the difference between your LP and your opponent's. If your LP are higher than your opponent's, you take any battle damage your opponent would have taken from battles involving this attacking card, instead.
target_text: -- Handigallop
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--cannot direct attack
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
  	c:RegisterEffect(e1)
  	--atk update
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetValue(s.atkval)
  	c:RegisterEffect(e2)
  	--damage
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_REFLECT_BATTLE_DAMAGE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e3:SetTargetRange(0, 1)
  	e3:SetCondition(s.rfcon)
  	c:RegisterEffect(e3)
  end
  function s.atkval(e, c)
  	return math.abs(Duel.GetLP(0) - Duel.GetLP(1))
  end
  function s.rfcon(e)
  	local tp = e:GetHandlerPlayer()
  	return Duel.GetLP(tp) > Duel.GetLP(1 - tp) and Duel.GetAttacker() == e:GetHandler()
  end
  
  