name: Performapal
card_text: 1 "Performapal" monster + 1 Level 5 or higher DARK monster
  If this card is Fusion Summoned: You can inflict 200 damage to your opponent for each card on the field, then, if this card was Fusion Summoned using a Pendulum Monster as material, destroy 1 monster your opponent controls, and if you do, inflict damage to your opponent equal to that monster's original ATK. You can only use this effect of "Performapal Gatlinghoul" once per turn.
external_ids: local SETCARD_ID_0 = 0x9f --Performapal
  
lua: local SETCARD_ID_0 = 0x9f --Performapal
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcFun2(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), aux.FilterBoolFunction(s.ffilter), true)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_DAMAGE)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.damcon)
  	e1:SetTarget(s.damtg)
  	e1:SetOperation(s.damop)
  	c:RegisterEffect(e1)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_MATERIAL_CHECK)
  	e2:SetValue(s.valcheck)
  	e2:SetLabelObject(e1)
  	c:RegisterEffect(e2)
  end
  function s.ffilter(c)
  	return c:IsFusionAttribute(ATTRIBUTE_DARK) and c:IsLevelAbove(5)
  end
  function s.damcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetFieldGroupCount(tp, LOCATION_ONFIELD, LOCATION_ONFIELD) > 0
  	end
  	local ct = Duel.GetFieldGroupCount(tp, LOCATION_ONFIELD, LOCATION_ONFIELD)
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, ct * 200)
  	if e:GetLabel() == 1 then
  		local g = Duel.GetFieldGroup(tp, 0, LOCATION_MZONE)
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  	end
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER)
  	local ct = Duel.GetFieldGroupCount(tp, LOCATION_ONFIELD, LOCATION_ONFIELD)
  	if ct > 0 and Duel.Damage(p, ct * 200, REASON_EFFECT) > 0 then
  		if e:GetLabel() == 1 then
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  			local g = Duel.SelectMatchingCard(tp, nil, tp, 0, LOCATION_MZONE, 1, 1, nil)
  			if g:GetCount() > 0 then
  				Duel.BreakEffect()
  				Duel.HintSelection(g)
  				if Duel.Destroy(g, REASON_EFFECT) ~= 0 then
  					local dam = g:GetFirst():GetBaseAttack()
  					Duel.Damage(p, dam, REASON_EFFECT)
  				end
  			end
  		end
  	end
  end
  function s.valcheck(e, c)
  	local g = c:GetMaterial()
  	if g:IsExists(Card.IsFusionType, 1, nil, TYPE_PENDULUM) then
  		e:GetLabelObject():SetLabel(1)
  	else
  		e:GetLabelObject():SetLabel(0)
  	end
  end
  
  
source_text: Performapal
  1 "Performapal" monster + 1 Level 5 or higher DARK monster
  If this card is Fusion Summoned: You can inflict 200 damage to your opponent for each card on the field, then, if this card was Fusion Summoned using a Pendulum Monster as material, destroy 1 monster your opponent controls, and if you do, inflict damage to your opponent equal to that monster's original ATK. You can only use this effect of "Performapal Gatlinghoul" once per turn.
target_text: -- Performapal
  local SETCARD_ID_0 = 0x9f --Performapal
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcFun2(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), aux.FilterBoolFunction(s.ffilter), true)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_DAMAGE)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.damcon)
  	e1:SetTarget(s.damtg)
  	e1:SetOperation(s.damop)
  	c:RegisterEffect(e1)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_MATERIAL_CHECK)
  	e2:SetValue(s.valcheck)
  	e2:SetLabelObject(e1)
  	c:RegisterEffect(e2)
  end
  function s.ffilter(c)
  	return c:IsFusionAttribute(ATTRIBUTE_DARK) and c:IsLevelAbove(5)
  end
  function s.damcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetFieldGroupCount(tp, LOCATION_ONFIELD, LOCATION_ONFIELD) > 0
  	end
  	local ct = Duel.GetFieldGroupCount(tp, LOCATION_ONFIELD, LOCATION_ONFIELD)
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, ct * 200)
  	if e:GetLabel() == 1 then
  		local g = Duel.GetFieldGroup(tp, 0, LOCATION_MZONE)
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  	end
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER)
  	local ct = Duel.GetFieldGroupCount(tp, LOCATION_ONFIELD, LOCATION_ONFIELD)
  	if ct > 0 and Duel.Damage(p, ct * 200, REASON_EFFECT) > 0 then
  		if e:GetLabel() == 1 then
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  			local g = Duel.SelectMatchingCard(tp, nil, tp, 0, LOCATION_MZONE, 1, 1, nil)
  			if g:GetCount() > 0 then
  				Duel.BreakEffect()
  				Duel.HintSelection(g)
  				if Duel.Destroy(g, REASON_EFFECT) ~= 0 then
  					local dam = g:GetFirst():GetBaseAttack()
  					Duel.Damage(p, dam, REASON_EFFECT)
  				end
  			end
  		end
  	end
  end
  function s.valcheck(e, c)
  	local g = c:GetMaterial()
  	if g:IsExists(Card.IsFusionType, 1, nil, TYPE_PENDULUM) then
  		e:GetLabelObject():SetLabel(1)
  	else
  		e:GetLabelObject():SetLabel(0)
  	end
  end
  
  