name: Masquerade
card_text: 1 "Despia" monster + 1 LIGHT or DARK monster
  While you control this Fusion Summoned card, your opponent must pay 600 LP to activate cards or effects. If your opponent controls a Ritual, Fusion, Synchro, Xyz, or Link Monster, while this card is in your GY (Quick Effect): You can Special Summon this card, but banish it when it leaves the field. You can only use this effect of "Masquerade the Blazing Dragon" once per turn.
external_ids: local SETCARD_ID_0 = 0x164 --Despia
  
lua: local SETCARD_ID_0 = 0x164 --Despia
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion summon
  	c:EnableReviveLimit()
  	aux.AddFusionProcFun2(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), s.matfilter, true)
  	--activate cost
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_ACTIVATE_COST)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(0, 1)
  	e1:SetCondition(s.costcon)
  	e1:SetCost(s.costchk)
  	e1:SetOperation(s.costop)
  	c:RegisterEffect(e1)
  	--accumulate
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_FLAG_EFFECT + id)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCondition(s.costcon)
  	e2:SetTargetRange(0, 1)
  	c:RegisterEffect(e2)
  	--spsummon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e3:SetType(EFFECT_TYPE_QUICK_O)
  	e3:SetCode(EVENT_FREE_CHAIN)
  	e3:SetRange(LOCATION_GRAVE)
  	e3:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e3:SetCountLimit(1, id)
  	e3:SetCondition(s.spcon)
  	e3:SetTarget(s.sptg)
  	e3:SetOperation(s.spop)
  	c:RegisterEffect(e3)
  end
  function s.matfilter(c)
  	return c:IsFusionAttribute(ATTRIBUTE_LIGHT + ATTRIBUTE_DARK)
  end
  function s.costcon(e)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
  end
  function s.costchk(e, te_or_c, tp)
  	local ct = Duel.GetFlagEffect(tp, id)
  	return Duel.CheckLPCost(tp, ct * 600)
  end
  function s.costop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.PayLPCost(tp, 600)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsType(TYPE_RITUAL + TYPE_FUSION + TYPE_SYNCHRO + TYPE_XYZ + TYPE_LINK)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, 0, LOCATION_MZONE, 1, nil)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, c, 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and Duel.SpecialSummonStep(c, 0, tp, tp, false, false, POS_FACEUP) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_REDIRECT)
  		e1:SetValue(LOCATION_REMOVED)
  		c:RegisterEffect(e1)
  	end
  	Duel.SpecialSummonComplete()
  end
  
  
source_text: Masquerade
  1 "Despia" monster + 1 LIGHT or DARK monster
  While you control this Fusion Summoned card, your opponent must pay 600 LP to activate cards or effects. If your opponent controls a Ritual, Fusion, Synchro, Xyz, or Link Monster, while this card is in your GY (Quick Effect): You can Special Summon this card, but banish it when it leaves the field. You can only use this effect of "Masquerade the Blazing Dragon" once per turn.
target_text: -- Masquerade
  local SETCARD_ID_0 = 0x164 --Despia
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion summon
  	c:EnableReviveLimit()
  	aux.AddFusionProcFun2(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), s.matfilter, true)
  	--activate cost
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_ACTIVATE_COST)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(0, 1)
  	e1:SetCondition(s.costcon)
  	e1:SetCost(s.costchk)
  	e1:SetOperation(s.costop)
  	c:RegisterEffect(e1)
  	--accumulate
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_FLAG_EFFECT + id)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCondition(s.costcon)
  	e2:SetTargetRange(0, 1)
  	c:RegisterEffect(e2)
  	--spsummon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e3:SetType(EFFECT_TYPE_QUICK_O)
  	e3:SetCode(EVENT_FREE_CHAIN)
  	e3:SetRange(LOCATION_GRAVE)
  	e3:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e3:SetCountLimit(1, id)
  	e3:SetCondition(s.spcon)
  	e3:SetTarget(s.sptg)
  	e3:SetOperation(s.spop)
  	c:RegisterEffect(e3)
  end
  function s.matfilter(c)
  	return c:IsFusionAttribute(ATTRIBUTE_LIGHT + ATTRIBUTE_DARK)
  end
  function s.costcon(e)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
  end
  function s.costchk(e, te_or_c, tp)
  	local ct = Duel.GetFlagEffect(tp, id)
  	return Duel.CheckLPCost(tp, ct * 600)
  end
  function s.costop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.PayLPCost(tp, 600)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsType(TYPE_RITUAL + TYPE_FUSION + TYPE_SYNCHRO + TYPE_XYZ + TYPE_LINK)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, 0, LOCATION_MZONE, 1, nil)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, c, 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and Duel.SpecialSummonStep(c, 0, tp, tp, false, false, POS_FACEUP) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_REDIRECT)
  		e1:SetValue(LOCATION_REMOVED)
  		c:RegisterEffect(e1)
  	end
  	Duel.SpecialSummonComplete()
  end
  
  