name: Metalfoes
card_text: Pendulum Scale = 8
  [ Pendulum Effect ]
  Once per turn: You can target 1 other face-up card you control; destroy it, and if you do, Set 1 "Metalfoes" Spell/Trap directly from your Deck.
  ----------------------------------------
  [ Monster Effect ]
  Cool iron bodies meet burning metal machines and man/machine combine. Burn up the soul - Metalfoes Fusion!!
external_ids: local SETCARD_ID_0 = 0xe1 --Metalfoes
  
lua: local SETCARD_ID_0 = 0xe1 --Metalfoes
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--pendulum summon
  	aux.EnablePendulumAttribute(c)
  	--destroy and set
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_PZONE)
  	e1:SetCountLimit(1)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.desfilter(c, tp)
  	if c:IsFacedown() then
  		return false
  	end
  	return Duel.GetSZoneCount(tp, c) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil, true)
  end
  function s.filter(c, ignore)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsSSetable(ignore)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField() and chkc:IsControler(tp) and s.desfilter(chkc, tp) and chkc ~= e:GetHandler()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.desfilter, tp, LOCATION_ONFIELD, 0, 1, e:GetHandler(), tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, s.desfilter, tp, LOCATION_ONFIELD, 0, 1, 1, e:GetHandler(), tp)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and Duel.Destroy(tc, REASON_EFFECT) ~= 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SET)
  		local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_DECK, 0, 1, 1, nil, false)
  		if g:GetCount() > 0 then
  			Duel.SSet(tp, g:GetFirst())
  		end
  	end
  end
  
  
source_text: Metalfoes
  Pendulum Scale = 8
  [ Pendulum Effect ]
  Once per turn: You can target 1 other face-up card you control; destroy it, and if you do, Set 1 "Metalfoes" Spell/Trap directly from your Deck.
  ----------------------------------------
  [ Monster Effect ]
  Cool iron bodies meet burning metal machines and man/machine combine. Burn up the soul - Metalfoes Fusion!!
target_text: -- Metalfoes
  local SETCARD_ID_0 = 0xe1 --Metalfoes
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--pendulum summon
  	aux.EnablePendulumAttribute(c)
  	--destroy and set
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_PZONE)
  	e1:SetCountLimit(1)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.desfilter(c, tp)
  	if c:IsFacedown() then
  		return false
  	end
  	return Duel.GetSZoneCount(tp, c) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil, true)
  end
  function s.filter(c, ignore)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsSSetable(ignore)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField() and chkc:IsControler(tp) and s.desfilter(chkc, tp) and chkc ~= e:GetHandler()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.desfilter, tp, LOCATION_ONFIELD, 0, 1, e:GetHandler(), tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, s.desfilter, tp, LOCATION_ONFIELD, 0, 1, 1, e:GetHandler(), tp)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and Duel.Destroy(tc, REASON_EFFECT) ~= 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SET)
  		local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_DECK, 0, 1, 1, nil, false)
  		if g:GetCount() > 0 then
  			Duel.SSet(tp, g:GetFirst())
  		end
  	end
  end
  
  