name: Phantom
card_text: 1 "Yubel" monster + 1 Fiend monster with 0 ATK/DEF
  Must be Special Summoned (from your Extra Deck) by shuffling the above cards from your hand, field, and/or GY into the Deck/Extra Deck. Cannot be used as Fusion Material. Cannot be destroyed by battle, also you take no damage from battles involving this card. When your opponent activates a monster effect (Quick Effect): You can Tribute this card; the activated effect becomes "Your opponent destroys 1 "Yubel" monster in their hand, Deck, or field". You can only use this effect of "Phantom of Yubel" once per turn.
external_ids: local SETCARD_ID_0 = 0x1a5 --Yubel
  
lua: local SETCARD_ID_0 = 0x1a5 --Yubel
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	aux.AddFusionProcFunFun(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), s.ffilter, 1, true)
  	aux.AddContactFusionProcedure(c, s.cfilter, LOCATION_HAND + LOCATION_MZONE + LOCATION_GRAVE, 0, aux.ContactFusionSendToDeck(c))
  	--
  	local e0 = Effect.CreateEffect(c)
  	e0:SetType(EFFECT_TYPE_SINGLE)
  	e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e0:SetCode(EFFECT_SPSUMMON_CONDITION)
  	c:RegisterEffect(e0)
  	--
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
  	e1:SetValue(1)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
  	c:RegisterEffect(e3)
  	--
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetType(EFFECT_TYPE_QUICK_O)
  	e4:SetCode(EVENT_CHAINING)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1, id)
  	e4:SetCondition(s.chcon)
  	e4:SetCost(s.chcost)
  	e4:SetTarget(s.chtg)
  	e4:SetOperation(s.chop)
  	c:RegisterEffect(e4)
  end
  function s.ffilter(c)
  	return c:IsRace(RACE_FIEND) and c:IsAttack(0) and c:IsDefense(0)
  end
  function s.cfilter(c)
  	return c:IsType(TYPE_MONSTER) and c:IsAbleToDeckOrExtraAsCost()
  end
  function s.chcon(e, tp, eg, ep, ev, re, r, rp)
  	return rp == 1 - tp and re:IsActiveType(TYPE_MONSTER)
  end
  function s.chcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsReleasable()
  	end
  	Duel.Release(e:GetHandler(), REASON_COST)
  end
  function s.filter(c)
  	return c:IsType(TYPE_MONSTER) and c:IsSetCard(SETCARD_ID_0) and c:IsFaceupEx()
  end
  function s.chtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, rp, 0, LOCATION_HAND + LOCATION_MZONE + LOCATION_DECK, 1, e:GetHandler())
  	end
  end
  function s.chop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Group.CreateGroup()
  	Duel.ChangeTargetCard(ev, g)
  	Duel.ChangeChainOperation(ev, s.repop)
  end
  function s.repop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_DESTROY)
  	local g = Duel.SelectMatchingCard(1 - tp, s.filter, tp, 0, LOCATION_HAND + LOCATION_MZONE + LOCATION_DECK, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.Destroy(g, REASON_EFFECT)
  	end
  end
  
  
source_text: Phantom
  1 "Yubel" monster + 1 Fiend monster with 0 ATK/DEF
  Must be Special Summoned (from your Extra Deck) by shuffling the above cards from your hand, field, and/or GY into the Deck/Extra Deck. Cannot be used as Fusion Material. Cannot be destroyed by battle, also you take no damage from battles involving this card. When your opponent activates a monster effect (Quick Effect): You can Tribute this card; the activated effect becomes "Your opponent destroys 1 "Yubel" monster in their hand, Deck, or field". You can only use this effect of "Phantom of Yubel" once per turn.
target_text: -- Phantom
  local SETCARD_ID_0 = 0x1a5 --Yubel
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	aux.AddFusionProcFunFun(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), s.ffilter, 1, true)
  	aux.AddContactFusionProcedure(c, s.cfilter, LOCATION_HAND + LOCATION_MZONE + LOCATION_GRAVE, 0, aux.ContactFusionSendToDeck(c))
  	--
  	local e0 = Effect.CreateEffect(c)
  	e0:SetType(EFFECT_TYPE_SINGLE)
  	e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e0:SetCode(EFFECT_SPSUMMON_CONDITION)
  	c:RegisterEffect(e0)
  	--
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
  	e1:SetValue(1)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
  	c:RegisterEffect(e3)
  	--
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetType(EFFECT_TYPE_QUICK_O)
  	e4:SetCode(EVENT_CHAINING)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1, id)
  	e4:SetCondition(s.chcon)
  	e4:SetCost(s.chcost)
  	e4:SetTarget(s.chtg)
  	e4:SetOperation(s.chop)
  	c:RegisterEffect(e4)
  end
  function s.ffilter(c)
  	return c:IsRace(RACE_FIEND) and c:IsAttack(0) and c:IsDefense(0)
  end
  function s.cfilter(c)
  	return c:IsType(TYPE_MONSTER) and c:IsAbleToDeckOrExtraAsCost()
  end
  function s.chcon(e, tp, eg, ep, ev, re, r, rp)
  	return rp == 1 - tp and re:IsActiveType(TYPE_MONSTER)
  end
  function s.chcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsReleasable()
  	end
  	Duel.Release(e:GetHandler(), REASON_COST)
  end
  function s.filter(c)
  	return c:IsType(TYPE_MONSTER) and c:IsSetCard(SETCARD_ID_0) and c:IsFaceupEx()
  end
  function s.chtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, rp, 0, LOCATION_HAND + LOCATION_MZONE + LOCATION_DECK, 1, e:GetHandler())
  	end
  end
  function s.chop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Group.CreateGroup()
  	Duel.ChangeTargetCard(ev, g)
  	Duel.ChangeChainOperation(ev, s.repop)
  end
  function s.repop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_DESTROY)
  	local g = Duel.SelectMatchingCard(1 - tp, s.filter, tp, 0, LOCATION_HAND + LOCATION_MZONE + LOCATION_DECK, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.Destroy(g, REASON_EFFECT)
  	end
  end
  
  