name: Ancient
card_text: 1 LIGHT Tuner + 1 or more non-Tuner monsters
  While your LP is higher than your opponent's, this card gains ATK equal to the difference. While your LP is lower than your opponent's, this card loses ATK equal to the difference. When this card is destroyed by battle and sent to the Graveyard: You can pay 1000 LP; Special Summon this card.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro summon
  	aux.AddSynchroProcedure(c, aux.FilterBoolFunction(Card.IsAttribute, ATTRIBUTE_LIGHT), aux.NonTuner(nil), 1)
  	c:EnableReviveLimit()
  	--Atk update
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetValue(s.atkval)
  	c:RegisterEffect(e1)
  	--spsummon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_TRIGGER_O + EFFECT_TYPE_SINGLE)
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetCode(EVENT_BATTLE_DESTROYED)
  	e2:SetCondition(s.sumcon)
  	e2:SetCost(s.sumcost)
  	e2:SetTarget(s.sumtg)
  	e2:SetOperation(s.sumop)
  	c:RegisterEffect(e2)
  end
  function s.atkval(e, c)
  	local cont = c:GetControler()
  	return Duel.GetLP(cont) - Duel.GetLP(1 - cont)
  end
  function s.sumcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE)
  end
  function s.sumcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 1000)
  	end
  	Duel.PayLPCost(tp, 1000)
  end
  function s.sumtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.sumop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 or not c:IsRelateToEffect(e) then
  		return
  	end
  	Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  end
  
  
source_text: Ancient
  1 LIGHT Tuner + 1 or more non-Tuner monsters
  While your LP is higher than your opponent's, this card gains ATK equal to the difference. While your LP is lower than your opponent's, this card loses ATK equal to the difference. When this card is destroyed by battle and sent to the Graveyard: You can pay 1000 LP; Special Summon this card.
target_text: -- Ancient
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro summon
  	aux.AddSynchroProcedure(c, aux.FilterBoolFunction(Card.IsAttribute, ATTRIBUTE_LIGHT), aux.NonTuner(nil), 1)
  	c:EnableReviveLimit()
  	--Atk update
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetValue(s.atkval)
  	c:RegisterEffect(e1)
  	--spsummon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_TRIGGER_O + EFFECT_TYPE_SINGLE)
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetCode(EVENT_BATTLE_DESTROYED)
  	e2:SetCondition(s.sumcon)
  	e2:SetCost(s.sumcost)
  	e2:SetTarget(s.sumtg)
  	e2:SetOperation(s.sumop)
  	c:RegisterEffect(e2)
  end
  function s.atkval(e, c)
  	local cont = c:GetControler()
  	return Duel.GetLP(cont) - Duel.GetLP(1 - cont)
  end
  function s.sumcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE)
  end
  function s.sumcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckLPCost(tp, 1000)
  	end
  	Duel.PayLPCost(tp, 1000)
  end
  function s.sumtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.sumop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 or not c:IsRelateToEffect(e) then
  		return
  	end
  	Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  end
  
  