name: Fire
card_text: Send 1 Pyro monster from your Deck to the GY, then, if you sent a "Volcanic" monster to the GY, you can apply 1 of these effects.
  ● Inflict damage to your opponent equal to its Level x 100.
  ● Special Summon 1 "Bomb Token" (Pyro/FIRE/Level 1/ATK 1000/DEF 1000) to your opponent's field. Each time 1 is destroyed, its controller takes 500 damage.
  You can only activate 1 "Fire Ejection" per turn.
external_ids: local CARD_ID_0 = 11654068 --Bomb Token
  local SETCARD_ID_0 = 0x32 --Volcanic
  
lua: local CARD_ID_0 = 11654068 --Bomb Token
  local SETCARD_ID_0 = 0x32 --Volcanic
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE + CATEGORY_DAMAGE + CATEGORY_DECKDES + CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.tgfilter(c)
  	return c:IsRace(RACE_PYRO) and c:IsAbleToGrave()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	local tc = g:GetFirst()
  	if tc and Duel.SendtoGrave(tc, REASON_EFFECT) > 0 and tc:IsLocation(LOCATION_GRAVE) and tc:IsSetCard(SETCARD_ID_0) then
  		local b1 = tc:GetLevel() > 0
  		local b2 = Duel.GetLocationCount(1 - tp, LOCATION_MZONE, tp) > 0
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 1000, 1000, 1, RACE_PYRO, ATTRIBUTE_FIRE, POS_FACEUP, 1 - tp)
  		local sel = aux.SelectFromOptions(tp, { b1, aux.Stringid(id, 0) }, { b2, aux.Stringid(id, 1) }, { true, aux.Stringid(id, 2) })
  		if sel == 1 then
  			Duel.BreakEffect()
  			local val = tc:GetLevel() * 100
  			Duel.Damage(1 - tp, val, REASON_EFFECT)
  		elseif sel == 2 then
  			Duel.BreakEffect()
  			local token = Duel.CreateToken(tp, id + 1)
  			if Duel.SpecialSummonStep(token, 0, tp, 1 - tp, false, false, POS_FACEUP) then
  				local e1 = Effect.CreateEffect(e:GetHandler())
  				e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  				e1:SetCode(EVENT_LEAVE_FIELD)
  				e1:SetOperation(s.damop)
  				token:RegisterEffect(e1, true)
  			end
  			Duel.SpecialSummonComplete()
  		end
  	end
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsReason(REASON_DESTROY) then
  		Duel.Damage(c:GetPreviousControler(), 500, REASON_EFFECT)
  	end
  	e:Reset()
  end
  
  
source_text: Fire
  Send 1 Pyro monster from your Deck to the GY, then, if you sent a "Volcanic" monster to the GY, you can apply 1 of these effects.
  ● Inflict damage to your opponent equal to its Level x 100.
  ● Special Summon 1 "Bomb Token" (Pyro/FIRE/Level 1/ATK 1000/DEF 1000) to your opponent's field. Each time 1 is destroyed, its controller takes 500 damage.
  You can only activate 1 "Fire Ejection" per turn.
target_text: -- Fire
  local CARD_ID_0 = 11654068 --Bomb Token
  local SETCARD_ID_0 = 0x32 --Volcanic
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE + CATEGORY_DAMAGE + CATEGORY_DECKDES + CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.tgfilter(c)
  	return c:IsRace(RACE_PYRO) and c:IsAbleToGrave()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	local tc = g:GetFirst()
  	if tc and Duel.SendtoGrave(tc, REASON_EFFECT) > 0 and tc:IsLocation(LOCATION_GRAVE) and tc:IsSetCard(SETCARD_ID_0) then
  		local b1 = tc:GetLevel() > 0
  		local b2 = Duel.GetLocationCount(1 - tp, LOCATION_MZONE, tp) > 0
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 1000, 1000, 1, RACE_PYRO, ATTRIBUTE_FIRE, POS_FACEUP, 1 - tp)
  		local sel = aux.SelectFromOptions(tp, { b1, aux.Stringid(id, 0) }, { b2, aux.Stringid(id, 1) }, { true, aux.Stringid(id, 2) })
  		if sel == 1 then
  			Duel.BreakEffect()
  			local val = tc:GetLevel() * 100
  			Duel.Damage(1 - tp, val, REASON_EFFECT)
  		elseif sel == 2 then
  			Duel.BreakEffect()
  			local token = Duel.CreateToken(tp, id + 1)
  			if Duel.SpecialSummonStep(token, 0, tp, 1 - tp, false, false, POS_FACEUP) then
  				local e1 = Effect.CreateEffect(e:GetHandler())
  				e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  				e1:SetCode(EVENT_LEAVE_FIELD)
  				e1:SetOperation(s.damop)
  				token:RegisterEffect(e1, true)
  			end
  			Duel.SpecialSummonComplete()
  		end
  	end
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsReason(REASON_DESTROY) then
  		Duel.Damage(c:GetPreviousControler(), 500, REASON_EFFECT)
  	end
  	e:Reset()
  end
  
  