name: Dark
card_text: 1 non-Link "@Ignister" monster
  If this card is Link Summoned: You can add 1 "Ignister A.I.Land" from your Deck to your hand. When a Cyberse monster with 2300 original ATK activates its effect (Quick Effect): You can move this card to your Main Monster Zone this card points to, then, you can change it to any Attribute until the end of this turn. You can only use each effect of "Dark Infant @Ignister" once per turn.
external_ids: local CARD_ID_0 = 59054773 --Ignister A.I.Land
  local SETCARD_ID_0 = 0x135 --@Ignister
  
lua: local CARD_ID_0 = 59054773 --Ignister A.I.Land
  local SETCARD_ID_0 = 0x135 --@Ignister
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--link summon
  	aux.AddLinkProcedure(c, s.mfilter, 1, 1)
  	c:EnableReviveLimit()
  	--tohand
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.thcon)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--move
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_CHAINING)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCondition(s.seqcon)
  	e2:SetTarget(s.seqtg)
  	e2:SetOperation(s.seqop)
  	c:RegisterEffect(e2)
  end
  function s.mfilter(c)
  	return not c:IsLinkType(TYPE_LINK) and c:IsLinkSetCard(SETCARD_ID_0)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
  end
  function s.thfilter(c)
  	return c:IsCode(CARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  function s.seqcon(e, tp, eg, ep, ev, re, r, rp)
  	local rc = re:GetHandler()
  	return re:IsActiveType(TYPE_MONSTER) and rc:GetBaseAttack() == 2300 and rc:IsRace(RACE_CYBERSE)
  end
  function s.seqtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		local zone = bit.band(e:GetHandler():GetLinkedZone(), 0x1f)
  		return Duel.GetLocationCount(tp, LOCATION_MZONE, PLAYER_NONE, 0, zone) > 0
  	end
  end
  function s.seqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not (c:IsRelateToEffect(e) and c:IsFaceup()) then
  		return
  	end
  	local zone = bit.band(e:GetHandler():GetLinkedZone(tp), 0x1f)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE, PLAYER_NONE, 0, zone) <= 0 then
  		return
  	end
  	local s = zone
  	if s & (s - 1) ~= 0 then
  		local flag = bit.bxor(zone, 0xff)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOZONE)
  		s = Duel.SelectDisableField(tp, 1, LOCATION_MZONE, 0, flag)
  	end
  	local nseq = math.log(s, 2)
  	Duel.MoveSequence(c, nseq)
  	if c:GetSequence() == nseq and Duel.SelectEffectYesNo(tp, c, aux.Stringid(id, 2)) then
  		Duel.BreakEffect()
  		local attr = Duel.AnnounceAttribute(tp, 1, ATTRIBUTE_ALL & ~c:GetAttribute())
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CHANGE_ATTRIBUTE)
  		e1:SetValue(attr)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  	end
  end
  
  
source_text: Dark
  1 non-Link "@Ignister" monster
  If this card is Link Summoned: You can add 1 "Ignister A.I.Land" from your Deck to your hand. When a Cyberse monster with 2300 original ATK activates its effect (Quick Effect): You can move this card to your Main Monster Zone this card points to, then, you can change it to any Attribute until the end of this turn. You can only use each effect of "Dark Infant @Ignister" once per turn.
target_text: -- Dark
  local CARD_ID_0 = 59054773 --Ignister A.I.Land
  local SETCARD_ID_0 = 0x135 --@Ignister
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--link summon
  	aux.AddLinkProcedure(c, s.mfilter, 1, 1)
  	c:EnableReviveLimit()
  	--tohand
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.thcon)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--move
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_CHAINING)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCondition(s.seqcon)
  	e2:SetTarget(s.seqtg)
  	e2:SetOperation(s.seqop)
  	c:RegisterEffect(e2)
  end
  function s.mfilter(c)
  	return not c:IsLinkType(TYPE_LINK) and c:IsLinkSetCard(SETCARD_ID_0)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
  end
  function s.thfilter(c)
  	return c:IsCode(CARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  function s.seqcon(e, tp, eg, ep, ev, re, r, rp)
  	local rc = re:GetHandler()
  	return re:IsActiveType(TYPE_MONSTER) and rc:GetBaseAttack() == 2300 and rc:IsRace(RACE_CYBERSE)
  end
  function s.seqtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		local zone = bit.band(e:GetHandler():GetLinkedZone(), 0x1f)
  		return Duel.GetLocationCount(tp, LOCATION_MZONE, PLAYER_NONE, 0, zone) > 0
  	end
  end
  function s.seqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not (c:IsRelateToEffect(e) and c:IsFaceup()) then
  		return
  	end
  	local zone = bit.band(e:GetHandler():GetLinkedZone(tp), 0x1f)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE, PLAYER_NONE, 0, zone) <= 0 then
  		return
  	end
  	local s = zone
  	if s & (s - 1) ~= 0 then
  		local flag = bit.bxor(zone, 0xff)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOZONE)
  		s = Duel.SelectDisableField(tp, 1, LOCATION_MZONE, 0, flag)
  	end
  	local nseq = math.log(s, 2)
  	Duel.MoveSequence(c, nseq)
  	if c:GetSequence() == nseq and Duel.SelectEffectYesNo(tp, c, aux.Stringid(id, 2)) then
  		Duel.BreakEffect()
  		local attr = Duel.AnnounceAttribute(tp, 1, ATTRIBUTE_ALL & ~c:GetAttribute())
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CHANGE_ATTRIBUTE)
  		e1:SetValue(attr)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  	end
  end
  
  