name: The
card_text: While your LP are higher than your opponent's: You can Tribute this card; inflict damage to your opponent equal to the difference. You must control "The Sanctuary in the Sky" to activate and to resolve this effect. You cannot conduct your Battle Phase the turn you activate this effect.
external_ids: local CARD_ID_0 = 56433456 --The Sanctuary in the Sky
  
lua: local CARD_ID_0 = 56433456 --The Sanctuary in the Sky
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--damage
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DAMAGE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCost(s.damcost)
  	e1:SetTarget(s.damtg)
  	e1:SetOperation(s.damop)
  	c:RegisterEffect(e1)
  end
  function s.damcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetCurrentPhase() ~= PHASE_MAIN2 and e:GetHandler():IsReleasable()
  	end
  	Duel.Release(e:GetHandler(), REASON_COST)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetCode(EFFECT_CANNOT_BP)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetTargetRange(1, 0)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLP(tp) > Duel.GetLP(1 - tp) and Duel.IsEnvironment(CARD_ID_0, tp)
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 0)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	if not Duel.IsEnvironment(CARD_ID_0, tp) then
  		return
  	end
  	local p = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER)
  	local val = Duel.GetLP(1 - p) - Duel.GetLP(p)
  	if val > 0 then
  		Duel.Damage(p, val, REASON_EFFECT)
  	end
  end
  
  
source_text: The
  While your LP are higher than your opponent's: You can Tribute this card; inflict damage to your opponent equal to the difference. You must control "The Sanctuary in the Sky" to activate and to resolve this effect. You cannot conduct your Battle Phase the turn you activate this effect.
target_text: -- The
  local CARD_ID_0 = 56433456 --The Sanctuary in the Sky
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--damage
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DAMAGE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCost(s.damcost)
  	e1:SetTarget(s.damtg)
  	e1:SetOperation(s.damop)
  	c:RegisterEffect(e1)
  end
  function s.damcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetCurrentPhase() ~= PHASE_MAIN2 and e:GetHandler():IsReleasable()
  	end
  	Duel.Release(e:GetHandler(), REASON_COST)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetCode(EFFECT_CANNOT_BP)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetTargetRange(1, 0)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLP(tp) > Duel.GetLP(1 - tp) and Duel.IsEnvironment(CARD_ID_0, tp)
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 0)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	if not Duel.IsEnvironment(CARD_ID_0, tp) then
  		return
  	end
  	local p = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER)
  	local val = Duel.GetLP(1 - p) - Duel.GetLP(p)
  	if val > 0 then
  		Duel.Damage(p, val, REASON_EFFECT)
  	end
  end
  
  