name: Machina
card_text: Cannot be Normal Summoned/Set. Must be Special Summoned by "Commander Covington". You must pay 1000 LP to declare an attack with this card. You can send this card you control to the GY, then target 1 "Machina Soldier", "Machina Sniper", and "Machina Defender" in your GY; Special Summon those targets.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 23782705 --Machina Sniper
  local CARD_ID_2 = 96384007 --Machina Defender
  local CARD_ID_3 = 60999392 --Machina Soldier
  local CARD_ID_4 = 22666164 --Commander Covington
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 23782705 --Machina Sniper
  local CARD_ID_2 = 96384007 --Machina Defender
  local CARD_ID_3 = 60999392 --Machina Soldier
  local CARD_ID_4 = 22666164 --Commander Covington
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--splimit
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e1:SetValue(s.splimit)
  	c:RegisterEffect(e1)
  	--attack cost
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_ATTACK_COST)
  	e2:SetCost(s.atcost)
  	e2:SetOperation(s.atop)
  	c:RegisterEffect(e2)
  	--special summon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCost(s.spcost)
  	e3:SetTarget(s.sptg)
  	e3:SetOperation(s.spop)
  	c:RegisterEffect(e3)
  end
  s.spchecks = aux.CreateChecks(Card.IsCode, { CARD_ID_3, CARD_ID_1, CARD_ID_2 })
  function s.splimit(e, se, sp, st)
  	return se:GetHandler():IsCode(CARD_ID_4)
  end
  function s.atcost(e, c, tp)
  	return Duel.CheckLPCost(tp, 1000)
  end
  function s.atop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.PayLPCost(tp, 1000)
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToGraveAsCost()
  	end
  	Duel.SendtoGrave(e:GetHandler(), REASON_COST)
  end
  function s.filter(c, code, e, tp)
  	return c:IsCode(code) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptargetfilter(c, e, tp)
  	return c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and c:IsCode(CARD_ID_3, CARD_ID_1, CARD_ID_2) and c:IsCanBeEffectTarget(e)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	local g = Duel.GetMatchingGroup(s.sptargetfilter, tp, LOCATION_GRAVE, 0, nil, e, tp)
  	if chk == 0 then
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) and Duel.GetMZoneCount(tp, e:GetHandler()) >= 3 and g:CheckSubGroupEach(s.spchecks)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local sg = g:SelectSubGroupEach(tp, s.spchecks)
  	Duel.SetTargetCard(sg)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, sg, 3, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		return
  	end
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) < 3 then
  		return
  	end
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS)
  	if g:FilterCount(Card.IsRelateToEffect, nil, e) ~= 3 then
  		return
  	end
  	Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
  end
  
  
source_text: Machina
  Cannot be Normal Summoned/Set. Must be Special Summoned by "Commander Covington". You must pay 1000 LP to declare an attack with this card. You can send this card you control to the GY, then target 1 "Machina Soldier", "Machina Sniper", and "Machina Defender" in your GY; Special Summon those targets.
target_text: -- Machina
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 23782705 --Machina Sniper
  local CARD_ID_2 = 96384007 --Machina Defender
  local CARD_ID_3 = 60999392 --Machina Soldier
  local CARD_ID_4 = 22666164 --Commander Covington
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--splimit
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e1:SetValue(s.splimit)
  	c:RegisterEffect(e1)
  	--attack cost
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_ATTACK_COST)
  	e2:SetCost(s.atcost)
  	e2:SetOperation(s.atop)
  	c:RegisterEffect(e2)
  	--special summon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCost(s.spcost)
  	e3:SetTarget(s.sptg)
  	e3:SetOperation(s.spop)
  	c:RegisterEffect(e3)
  end
  s.spchecks = aux.CreateChecks(Card.IsCode, { CARD_ID_3, CARD_ID_1, CARD_ID_2 })
  function s.splimit(e, se, sp, st)
  	return se:GetHandler():IsCode(CARD_ID_4)
  end
  function s.atcost(e, c, tp)
  	return Duel.CheckLPCost(tp, 1000)
  end
  function s.atop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.PayLPCost(tp, 1000)
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToGraveAsCost()
  	end
  	Duel.SendtoGrave(e:GetHandler(), REASON_COST)
  end
  function s.filter(c, code, e, tp)
  	return c:IsCode(code) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptargetfilter(c, e, tp)
  	return c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and c:IsCode(CARD_ID_3, CARD_ID_1, CARD_ID_2) and c:IsCanBeEffectTarget(e)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	local g = Duel.GetMatchingGroup(s.sptargetfilter, tp, LOCATION_GRAVE, 0, nil, e, tp)
  	if chk == 0 then
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) and Duel.GetMZoneCount(tp, e:GetHandler()) >= 3 and g:CheckSubGroupEach(s.spchecks)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local sg = g:SelectSubGroupEach(tp, s.spchecks)
  	Duel.SetTargetCard(sg)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, sg, 3, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		return
  	end
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) < 3 then
  		return
  	end
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS)
  	if g:FilterCount(Card.IsRelateToEffect, nil, e) ~= 3 then
  		return
  	end
  	Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
  end
  
  