name: Diplexer
card_text: 2 Cyberse monsters
  Once per turn: You can Tribute 1 Cyberse monster; Spell/Trap Cards, and their effects, cannot be activated during the Battle Phase of this turn. If this Fusion Summoned card is sent to your GY: You can target 1 "Cynet Fusion" and 1 Cyberse monster in your GY, except this card; add them to your hand. You can only use this effect of "Diplexer Chimera" once per turn.
external_ids: local CARD_ID_0 = 65801012 --Cynet Fusion
  
lua: local CARD_ID_0 = 65801012 --Cynet Fusion
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	aux.AddFusionProcFunRep(c, aux.FilterBoolFunction(Card.IsRace, RACE_CYBERSE), 2, true)
  	c:EnableReviveLimit()
  	--lock
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.con)
  	e1:SetCost(s.cost)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--search
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOHAND)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_TO_GRAVE)
  	e2:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_CARD_TARGET)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.thcon)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  end
  function s.con(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsAbleToEnterBP()
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, Card.IsRace, 1, nil, RACE_CYBERSE)
  	end
  	local g = Duel.SelectReleaseGroup(tp, Card.IsRace, 1, 1, nil, RACE_CYBERSE)
  	Duel.Release(g, REASON_COST)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(1, 1)
  	e1:SetCondition(s.accon)
  	e1:SetValue(s.aclimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.accon(e)
  	local ph = Duel.GetCurrentPhase()
  	return ph >= PHASE_BATTLE_START and ph <= PHASE_BATTLE
  end
  function s.aclimit(e, re, tp)
  	return re:IsActiveType(TYPE_SPELL + TYPE_TRAP)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsPreviousLocation(LOCATION_MZONE) and c:IsSummonType(SUMMON_TYPE_FUSION)
  end
  function s.filter1(c)
  	return c:IsRace(RACE_CYBERSE) and c:IsAbleToHand()
  end
  function s.filter2(c)
  	return c:IsCode(CARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter1, tp, LOCATION_GRAVE, 0, 1, e:GetHandler()) and Duel.IsExistingTarget(s.filter2, tp, LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g1 = Duel.SelectTarget(tp, s.filter1, tp, LOCATION_GRAVE, 0, 1, 1, e:GetHandler())
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g2 = Duel.SelectTarget(tp, s.filter2, tp, LOCATION_GRAVE, 0, 1, 1, nil)
  	g1:Merge(g2)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g1, 2, 0, 0)
  end
  function s.thop(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
  		Duel.SendtoHand(sg, nil, REASON_EFFECT)
  	end
  end
  
  
source_text: Diplexer
  2 Cyberse monsters
  Once per turn: You can Tribute 1 Cyberse monster; Spell/Trap Cards, and their effects, cannot be activated during the Battle Phase of this turn. If this Fusion Summoned card is sent to your GY: You can target 1 "Cynet Fusion" and 1 Cyberse monster in your GY, except this card; add them to your hand. You can only use this effect of "Diplexer Chimera" once per turn.
target_text: -- Diplexer
  local CARD_ID_0 = 65801012 --Cynet Fusion
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	aux.AddFusionProcFunRep(c, aux.FilterBoolFunction(Card.IsRace, RACE_CYBERSE), 2, true)
  	c:EnableReviveLimit()
  	--lock
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.con)
  	e1:SetCost(s.cost)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--search
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOHAND)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_TO_GRAVE)
  	e2:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_CARD_TARGET)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.thcon)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  end
  function s.con(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsAbleToEnterBP()
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, Card.IsRace, 1, nil, RACE_CYBERSE)
  	end
  	local g = Duel.SelectReleaseGroup(tp, Card.IsRace, 1, 1, nil, RACE_CYBERSE)
  	Duel.Release(g, REASON_COST)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(1, 1)
  	e1:SetCondition(s.accon)
  	e1:SetValue(s.aclimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.accon(e)
  	local ph = Duel.GetCurrentPhase()
  	return ph >= PHASE_BATTLE_START and ph <= PHASE_BATTLE
  end
  function s.aclimit(e, re, tp)
  	return re:IsActiveType(TYPE_SPELL + TYPE_TRAP)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsPreviousLocation(LOCATION_MZONE) and c:IsSummonType(SUMMON_TYPE_FUSION)
  end
  function s.filter1(c)
  	return c:IsRace(RACE_CYBERSE) and c:IsAbleToHand()
  end
  function s.filter2(c)
  	return c:IsCode(CARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter1, tp, LOCATION_GRAVE, 0, 1, e:GetHandler()) and Duel.IsExistingTarget(s.filter2, tp, LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g1 = Duel.SelectTarget(tp, s.filter1, tp, LOCATION_GRAVE, 0, 1, 1, e:GetHandler())
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g2 = Duel.SelectTarget(tp, s.filter2, tp, LOCATION_GRAVE, 0, 1, 1, nil)
  	g1:Merge(g2)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g1, 2, 0, 0)
  end
  function s.thop(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
  		Duel.SendtoHand(sg, nil, REASON_EFFECT)
  	end
  end
  
  