name: Phantasmal
card_text: You can Tribute this card; add 1 "Uria, Lord of Searing Flames", "Hamon, Lord of Striking Thunder" or "Raviel, Lord of Phantasms" from your Deck or GY to your hand, then you can Special Summon 1 Level 10 Pyro, Thunder, or Fiend monster from your hand whose ATK equals its own DEF, ignoring its Summoning conditions, but it cannot attack directly this turn. You can banish this card from your GY; add 1 "Dimension Fusion Destruction" from your Deck to your hand. You can only use each effect of "Phantasmal Summoning Beast" once per turn.
external_ids: local CARD_ID_0 = 69890967 --Raviel, Lord of Phantasms
  local CARD_ID_1 = 32491822 --Hamon, Lord of Striking Thunder
  local CARD_ID_2 = 6007213 --Uria, Lord of Searing Flames
  local CARD_ID_3 = 89190953 --Dimension Fusion Destruction
  
lua: local CARD_ID_0 = 69890967 --Raviel, Lord of Phantasms
  local CARD_ID_1 = 32491822 --Hamon, Lord of Striking Thunder
  local CARD_ID_2 = 6007213 --Uria, Lord of Searing Flames
  local CARD_ID_3 = 89190953 --Dimension Fusion Destruction
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_2, CARD_ID_1, CARD_ID_0)
  	--to hand
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.thcost)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--Search
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id + o)
  	e2:SetCost(aux.bfgcost)
  	e2:SetTarget(s.thtg2)
  	e2:SetOperation(s.thop2)
  	c:RegisterEffect(e2)
  end
  function s.thcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:IsReleasable()
  	end
  	Duel.Release(c, REASON_COST)
  end
  function s.thfilter(c)
  	return c:IsCode(CARD_ID_2, CARD_ID_1, CARD_ID_0) and c:IsAbleToHand()
  end
  function s.spfilter(c, e, tp)
  	local atk = c:GetTextAttack()
  	local def = c:GetTextDefense()
  	return atk >= 0 and def >= 0 and atk == def and c:IsRace(RACE_FIEND + RACE_PYRO + RACE_THUNDER) and c:IsLevel(10) and c:IsCanBeSpecialSummoned(e, 0, tp, true, false)
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK + LOCATION_GRAVE)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, 1, nil)
  	if g:GetCount() > 0 and Duel.SendtoHand(g, nil, REASON_EFFECT) > 0 then
  		Duel.ConfirmCards(1 - tp, g)
  		Duel.ShuffleHand(tp)
  		if Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND, 0, 1, nil, e, tp) and Duel.GetMZoneCount(tp) > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 2)) then
  			local sc = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_HAND, 0, 1, 1, nil, e, tp):GetFirst()
  			if Duel.SpecialSummonStep(sc, 0, tp, tp, true, false, POS_FACEUP) then
  				local e1 = Effect.CreateEffect(e:GetHandler())
  				e1:SetType(EFFECT_TYPE_SINGLE)
  				e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  				e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
  				e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  				sc:RegisterEffect(e1)
  				Duel.SpecialSummonComplete()
  			end
  		end
  	end
  end
  function s.thfilter2(c)
  	return c:IsCode(CARD_ID_3) and c:IsAbleToHand()
  end
  function s.thtg2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter2, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop2(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter2, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  
source_text: Phantasmal
  You can Tribute this card; add 1 "Uria, Lord of Searing Flames", "Hamon, Lord of Striking Thunder" or "Raviel, Lord of Phantasms" from your Deck or GY to your hand, then you can Special Summon 1 Level 10 Pyro, Thunder, or Fiend monster from your hand whose ATK equals its own DEF, ignoring its Summoning conditions, but it cannot attack directly this turn. You can banish this card from your GY; add 1 "Dimension Fusion Destruction" from your Deck to your hand. You can only use each effect of "Phantasmal Summoning Beast" once per turn.
target_text: -- Phantasmal
  local CARD_ID_0 = 69890967 --Raviel, Lord of Phantasms
  local CARD_ID_1 = 32491822 --Hamon, Lord of Striking Thunder
  local CARD_ID_2 = 6007213 --Uria, Lord of Searing Flames
  local CARD_ID_3 = 89190953 --Dimension Fusion Destruction
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_2, CARD_ID_1, CARD_ID_0)
  	--to hand
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.thcost)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--Search
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id + o)
  	e2:SetCost(aux.bfgcost)
  	e2:SetTarget(s.thtg2)
  	e2:SetOperation(s.thop2)
  	c:RegisterEffect(e2)
  end
  function s.thcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:IsReleasable()
  	end
  	Duel.Release(c, REASON_COST)
  end
  function s.thfilter(c)
  	return c:IsCode(CARD_ID_2, CARD_ID_1, CARD_ID_0) and c:IsAbleToHand()
  end
  function s.spfilter(c, e, tp)
  	local atk = c:GetTextAttack()
  	local def = c:GetTextDefense()
  	return atk >= 0 and def >= 0 and atk == def and c:IsRace(RACE_FIEND + RACE_PYRO + RACE_THUNDER) and c:IsLevel(10) and c:IsCanBeSpecialSummoned(e, 0, tp, true, false)
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK + LOCATION_GRAVE)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, 1, nil)
  	if g:GetCount() > 0 and Duel.SendtoHand(g, nil, REASON_EFFECT) > 0 then
  		Duel.ConfirmCards(1 - tp, g)
  		Duel.ShuffleHand(tp)
  		if Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_HAND, 0, 1, nil, e, tp) and Duel.GetMZoneCount(tp) > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 2)) then
  			local sc = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_HAND, 0, 1, 1, nil, e, tp):GetFirst()
  			if Duel.SpecialSummonStep(sc, 0, tp, tp, true, false, POS_FACEUP) then
  				local e1 = Effect.CreateEffect(e:GetHandler())
  				e1:SetType(EFFECT_TYPE_SINGLE)
  				e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  				e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
  				e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  				sc:RegisterEffect(e1)
  				Duel.SpecialSummonComplete()
  			end
  		end
  	end
  end
  function s.thfilter2(c)
  	return c:IsCode(CARD_ID_3) and c:IsAbleToHand()
  end
  function s.thtg2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter2, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop2(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter2, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  