name: Ultimate
card_text: (This card is always treated as an "Ursarctic" and "Drytron" card.)
  Must be Special Summoned with "Ursarctic Drytron". Once per turn, if another Effect Monster is Special Summoned to your field (except during the Damage Step): You can add 1 "Ursarctic" or "Drytron" monster from your Deck to your hand. Once per turn: You can target 1 of your banished "Ursarctic" or "Drytron" monsters; add it to your hand.
external_ids: local CARD_ID_0 = 89771220 --Ursarctic Drytron
  local SETCARD_ID_0 = 0x163 --Ursarctic
  
lua: local CARD_ID_0 = 89771220 --Ursarctic Drytron
  local SETCARD_ID_0 = 0x163 --Ursarctic
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--spsummon restriction
  	local e0 = Effect.CreateEffect(c)
  	e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e0:SetType(EFFECT_TYPE_SINGLE)
  	e0:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e0:SetValue(s.splimit)
  	c:RegisterEffect(e0)
  	--to hand (deck)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.thcon1)
  	e1:SetTarget(s.thtg1)
  	e1:SetOperation(s.thop1)
  	c:RegisterEffect(e1)
  	--to hand (remove)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOHAND)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetTarget(s.thtg2)
  	e2:SetOperation(s.thop2)
  	c:RegisterEffect(e2)
  end
  function s.splimit(e, se, sp, st)
  	return se:GetHandler():IsCode(CARD_ID_0)
  end
  function s.cfilter1(c, tp)
  	return c:IsFaceup() and c:IsType(TYPE_EFFECT) and c:IsControler(tp)
  end
  function s.thcon1(e, tp, eg, ep, ev, re, r, rp)
  	return not eg:IsContains(e:GetHandler()) and eg:IsExists(s.cfilter1, 1, nil, tp)
  end
  function s.thfilter1(c)
  	return c:IsSetCard(SETCARD_ID_0, 0x154) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
  end
  function s.thtg1(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter1, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop1(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter1, 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.thfilter2(c)
  	return s.thfilter1(c) and c:IsFaceup()
  end
  function s.thtg2(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.thfilter2(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.thfilter2, tp, LOCATION_REMOVED, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectTarget(tp, s.thfilter2, tp, LOCATION_REMOVED, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, 1, 0, 0)
  end
  function s.thop2(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  	end
  end
  
  
source_text: Ultimate
  (This card is always treated as an "Ursarctic" and "Drytron" card.)
  Must be Special Summoned with "Ursarctic Drytron". Once per turn, if another Effect Monster is Special Summoned to your field (except during the Damage Step): You can add 1 "Ursarctic" or "Drytron" monster from your Deck to your hand. Once per turn: You can target 1 of your banished "Ursarctic" or "Drytron" monsters; add it to your hand.
target_text: -- Ultimate
  local CARD_ID_0 = 89771220 --Ursarctic Drytron
  local SETCARD_ID_0 = 0x163 --Ursarctic
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--spsummon restriction
  	local e0 = Effect.CreateEffect(c)
  	e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e0:SetType(EFFECT_TYPE_SINGLE)
  	e0:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e0:SetValue(s.splimit)
  	c:RegisterEffect(e0)
  	--to hand (deck)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.thcon1)
  	e1:SetTarget(s.thtg1)
  	e1:SetOperation(s.thop1)
  	c:RegisterEffect(e1)
  	--to hand (remove)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOHAND)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetTarget(s.thtg2)
  	e2:SetOperation(s.thop2)
  	c:RegisterEffect(e2)
  end
  function s.splimit(e, se, sp, st)
  	return se:GetHandler():IsCode(CARD_ID_0)
  end
  function s.cfilter1(c, tp)
  	return c:IsFaceup() and c:IsType(TYPE_EFFECT) and c:IsControler(tp)
  end
  function s.thcon1(e, tp, eg, ep, ev, re, r, rp)
  	return not eg:IsContains(e:GetHandler()) and eg:IsExists(s.cfilter1, 1, nil, tp)
  end
  function s.thfilter1(c)
  	return c:IsSetCard(SETCARD_ID_0, 0x154) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
  end
  function s.thtg1(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter1, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop1(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter1, 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.thfilter2(c)
  	return s.thfilter1(c) and c:IsFaceup()
  end
  function s.thtg2(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.thfilter2(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.thfilter2, tp, LOCATION_REMOVED, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectTarget(tp, s.thfilter2, tp, LOCATION_REMOVED, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, 1, 0, 0)
  end
  function s.thop2(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  	end
  end
  
  