name: Phantom
card_text: If you're Tributing a "Phantom Beast" monster or "Gazelle the King of Mythical Beasts", this card can be Normal Summoned with 1 Tribute. When this card destroys a monster by battle, inflict 500 damage to your opponent. When this card is destroyed and sent to the Graveyard by an opponent's card effect, inflict 2000 damage to your opponent.
external_ids: local SETCARD_ID_0 = 0x1b --Phantom
  
lua: local SETCARD_ID_0 = 0x1b --Phantom
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--summon with 1 tribute
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_SUMMON_PROC)
  	e1:SetCondition(s.otcon)
  	e1:SetOperation(s.otop)
  	e1:SetValue(SUMMON_TYPE_ADVANCE)
  	c:RegisterEffect(e1)
  	--damage1
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DAMAGE)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCode(EVENT_BATTLE_DESTROYING)
  	e2:SetTarget(s.damtg1)
  	e2:SetOperation(s.damop)
  	c:RegisterEffect(e2)
  	--damage2
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 2))
  	e2:SetCategory(CATEGORY_DAMAGE)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCode(EVENT_TO_GRAVE)
  	e2:SetCondition(s.damcon2)
  	e2:SetTarget(s.damtg2)
  	e2:SetOperation(s.damop)
  	c:RegisterEffect(e2)
  end
  function s.otfilter(c, tp)
  	return c:IsSetCard(SETCARD_ID_0) and (c:IsControler(tp) or c:IsFaceup())
  end
  function s.otcon(e, c, minc)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	local mg = Duel.GetMatchingGroup(s.otfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil, tp)
  	return c:IsLevelAbove(7) and minc <= 1 and Duel.CheckTribute(c, 1, 1, mg)
  end
  function s.otop(e, tp, eg, ep, ev, re, r, rp, c)
  	local mg = Duel.GetMatchingGroup(s.otfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil, tp)
  	local sg = Duel.SelectTribute(tp, c, 1, 1, mg)
  	c:SetMaterial(sg)
  	Duel.Release(sg, REASON_SUMMON + REASON_MATERIAL)
  end
  function s.damtg1(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(500)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 500)
  end
  function s.damcon2(e, tp, eg, ep, ev, re, r, rp)
  	return bit.band(r, 0x41) == 0x41 and rp == 1 - tp and e:GetHandler():IsPreviousControler(tp)
  end
  function s.damtg2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(2000)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 2000)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  
  
source_text: Phantom
  If you're Tributing a "Phantom Beast" monster or "Gazelle the King of Mythical Beasts", this card can be Normal Summoned with 1 Tribute. When this card destroys a monster by battle, inflict 500 damage to your opponent. When this card is destroyed and sent to the Graveyard by an opponent's card effect, inflict 2000 damage to your opponent.
target_text: -- Phantom
  local SETCARD_ID_0 = 0x1b --Phantom
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--summon with 1 tribute
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_SUMMON_PROC)
  	e1:SetCondition(s.otcon)
  	e1:SetOperation(s.otop)
  	e1:SetValue(SUMMON_TYPE_ADVANCE)
  	c:RegisterEffect(e1)
  	--damage1
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DAMAGE)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCode(EVENT_BATTLE_DESTROYING)
  	e2:SetTarget(s.damtg1)
  	e2:SetOperation(s.damop)
  	c:RegisterEffect(e2)
  	--damage2
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 2))
  	e2:SetCategory(CATEGORY_DAMAGE)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCode(EVENT_TO_GRAVE)
  	e2:SetCondition(s.damcon2)
  	e2:SetTarget(s.damtg2)
  	e2:SetOperation(s.damop)
  	c:RegisterEffect(e2)
  end
  function s.otfilter(c, tp)
  	return c:IsSetCard(SETCARD_ID_0) and (c:IsControler(tp) or c:IsFaceup())
  end
  function s.otcon(e, c, minc)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	local mg = Duel.GetMatchingGroup(s.otfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil, tp)
  	return c:IsLevelAbove(7) and minc <= 1 and Duel.CheckTribute(c, 1, 1, mg)
  end
  function s.otop(e, tp, eg, ep, ev, re, r, rp, c)
  	local mg = Duel.GetMatchingGroup(s.otfilter, tp, LOCATION_MZONE, LOCATION_MZONE, nil, tp)
  	local sg = Duel.SelectTribute(tp, c, 1, 1, mg)
  	c:SetMaterial(sg)
  	Duel.Release(sg, REASON_SUMMON + REASON_MATERIAL)
  end
  function s.damtg1(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(500)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 500)
  end
  function s.damcon2(e, tp, eg, ep, ev, re, r, rp)
  	return bit.band(r, 0x41) == 0x41 and rp == 1 - tp and e:GetHandler():IsPreviousControler(tp)
  end
  function s.damtg2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(2000)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 2000)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  
  