name: Fiend's
card_text: Special Summon 1 "Metal Fiend Token" (Fiend/DARK/Level 1/ATK 0/DEF 0). It cannot attack, also the opponent takes any battle damage its controller would have taken from battles involving it. Once per turn, during its controller's Standby Phase, they pay 1000 LP or destroy this Token.
external_ids: local CARD_ID_0 = 24874631 --Metal Fiend Token
  
lua: local CARD_ID_0 = 24874631 --Metal Fiend Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_FIEND, ATTRIBUTE_DARK)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 or not Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_FIEND, ATTRIBUTE_DARK) then
  		return
  	end
  	local token = Duel.CreateToken(tp, id + 1)
  	Duel.SpecialSummon(token, 0, tp, tp, false, false, POS_FACEUP)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_CANNOT_ATTACK)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  	token:RegisterEffect(e1, true)
  	local e2 = Effect.CreateEffect(e:GetHandler())
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_REFLECT_BATTLE_DAMAGE)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e2:SetValue(1)
  	e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  	token:RegisterEffect(e2, true)
  	local e3 = Effect.CreateEffect(e:GetHandler())
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e3:SetCountLimit(1)
  	e3:SetCondition(s.descon)
  	e3:SetOperation(s.desop)
  	e3:SetReset(RESET_EVENT + RESETS_STANDARD)
  	token:RegisterEffect(e3, true)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.CheckLPCost(tp, 1000) and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  		Duel.PayLPCost(tp, 1000)
  	else
  		Duel.Destroy(e:GetHandler(), REASON_COST)
  	end
  end
  
  
source_text: Fiend's
  Special Summon 1 "Metal Fiend Token" (Fiend/DARK/Level 1/ATK 0/DEF 0). It cannot attack, also the opponent takes any battle damage its controller would have taken from battles involving it. Once per turn, during its controller's Standby Phase, they pay 1000 LP or destroy this Token.
target_text: -- Fiend's
  local CARD_ID_0 = 24874631 --Metal Fiend Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_FIEND, ATTRIBUTE_DARK)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 or not Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_FIEND, ATTRIBUTE_DARK) then
  		return
  	end
  	local token = Duel.CreateToken(tp, id + 1)
  	Duel.SpecialSummon(token, 0, tp, tp, false, false, POS_FACEUP)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_CANNOT_ATTACK)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  	token:RegisterEffect(e1, true)
  	local e2 = Effect.CreateEffect(e:GetHandler())
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_REFLECT_BATTLE_DAMAGE)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e2:SetValue(1)
  	e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  	token:RegisterEffect(e2, true)
  	local e3 = Effect.CreateEffect(e:GetHandler())
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e3:SetCountLimit(1)
  	e3:SetCondition(s.descon)
  	e3:SetOperation(s.desop)
  	e3:SetReset(RESET_EVENT + RESETS_STANDARD)
  	token:RegisterEffect(e3, true)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.CheckLPCost(tp, 1000) and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  		Duel.PayLPCost(tp, 1000)
  	else
  		Duel.Destroy(e:GetHandler(), REASON_COST)
  	end
  end
  
  