name: Morphtronic
card_text: If you control 2 or more face-up "Morphtronic" monsters, select 2 cards your opponent controls. Destroy 1 card of your opponent's choice from those 2.
external_ids: local SETCARD_ID_0 = 0x26 --Morphtronic
  
lua: local SETCARD_ID_0 = 0x26 --Morphtronic
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 2, nil)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField() and chkc:IsControler(1 - tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(aux.TRUE, tp, 0, LOCATION_ONFIELD, 2, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPPO)
  	local g = Duel.SelectTarget(tp, aux.TRUE, tp, 0, LOCATION_ONFIELD, 2, 2, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS)
  	local sg = g:Filter(Card.IsRelateToEffect, nil, e)
  	if sg:GetCount() == 0 then
  		return
  	elseif sg:GetCount() == 1 then
  		Duel.Destroy(sg, REASON_EFFECT)
  	else
  		Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_DESTROY)
  		local dg = sg:Select(1 - tp, 1, 1, nil)
  		Duel.Destroy(dg, REASON_EFFECT)
  	end
  end
  
  
source_text: Morphtronic
  If you control 2 or more face-up "Morphtronic" monsters, select 2 cards your opponent controls. Destroy 1 card of your opponent's choice from those 2.
target_text: -- Morphtronic
  local SETCARD_ID_0 = 0x26 --Morphtronic
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 2, nil)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField() and chkc:IsControler(1 - tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(aux.TRUE, tp, 0, LOCATION_ONFIELD, 2, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPPO)
  	local g = Duel.SelectTarget(tp, aux.TRUE, tp, 0, LOCATION_ONFIELD, 2, 2, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS)
  	local sg = g:Filter(Card.IsRelateToEffect, nil, e)
  	if sg:GetCount() == 0 then
  		return
  	elseif sg:GetCount() == 1 then
  		Duel.Destroy(sg, REASON_EFFECT)
  	else
  		Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_DESTROY)
  		local dg = sg:Select(1 - tp, 1, 1, nil)
  		Duel.Destroy(dg, REASON_EFFECT)
  	end
  end
  
  