name: Pacifis,
card_text: (This card's name is always treated as "Umi".)
  You cannot Normal or Special Summon Effect Monsters the turn you activate either of this card's effects (even if this card leaves the field). Once per turn, if you Normal or Special Summon exactly 1 Normal Monster (and no other cards): Add 1 "Phantasm Spiral" card from your Deck to your hand. If your opponent activates a card or effect (except during the Damage Step), and you control no Tokens: You can Special Summon 1 "Phantasm Spiral Token" (Wyrm-Type/WATER/Level 8/ATK 2000/DEF 2000).
external_ids: local CARD_ID_0 = 2819436 --Phantasm Spiral Token
  local SETCARD_ID_0 = 0xfa --Phantasm
  
lua: local CARD_ID_0 = 2819436 --Phantasm Spiral Token
  local SETCARD_ID_0 = 0xfa --Phantasm
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--to hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCode(EVENT_SUMMON_SUCCESS)
  	e2:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetCondition(s.thcon)
  	e2:SetCost(s.cost)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  	--token
  	local e6 = Effect.CreateEffect(c)
  	e6:SetDescription(aux.Stringid(id, 1))
  	e6:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e6:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e6:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_ACTIVATE_CONDITION)
  	e6:SetCode(EVENT_CHAINING)
  	e6:SetRange(LOCATION_FZONE)
  	e6:SetCountLimit(1, EFFECT_COUNT_CODE_CHAIN)
  	e6:SetCondition(s.spcon)
  	e6:SetCost(s.cost)
  	e6:SetTarget(s.sptg)
  	e6:SetOperation(s.spop)
  	c:RegisterEffect(e6)
  	--
  	Duel.AddCustomActivityCounter(id, ACTIVITY_SUMMON, s.counterfilter)
  	Duel.AddCustomActivityCounter(id, ACTIVITY_SPSUMMON, s.counterfilter)
  end
  function s.counterfilter(c)
  	return not c:IsType(TYPE_EFFECT)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetCustomActivityCount(id, tp, ACTIVITY_SUMMON) == 0 and Duel.GetCustomActivityCount(id, tp, ACTIVITY_SPSUMMON) == 0
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetCode(EFFECT_CANNOT_SUMMON)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.splimit(e, c, sump, sumtype, sumpos, targetp, se)
  	return c:IsType(TYPE_EFFECT)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	local tc = eg:GetFirst()
  	return eg:GetCount() == 1 and tc:IsSummonPlayer(tp) and tc:IsFaceup() and tc:IsType(TYPE_NORMAL)
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  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.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return rp == 1 - tp and not aux.tkfcon(e, tp)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, SETCARD_ID_0, TYPES_TOKEN_MONSTER, 2000, 2000, 6, RACE_WYRM, ATTRIBUTE_WATER)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 0, 0)
  	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	if not Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, SETCARD_ID_0, TYPES_TOKEN_MONSTER, 2000, 2000, 6, RACE_WYRM, ATTRIBUTE_WATER) then
  		return
  	end
  	local token = Duel.CreateToken(tp, id + 1)
  	Duel.SpecialSummon(token, 0, tp, tp, false, false, POS_FACEUP)
  end
  
  
source_text: Pacifis,
  (This card's name is always treated as "Umi".)
  You cannot Normal or Special Summon Effect Monsters the turn you activate either of this card's effects (even if this card leaves the field). Once per turn, if you Normal or Special Summon exactly 1 Normal Monster (and no other cards): Add 1 "Phantasm Spiral" card from your Deck to your hand. If your opponent activates a card or effect (except during the Damage Step), and you control no Tokens: You can Special Summon 1 "Phantasm Spiral Token" (Wyrm-Type/WATER/Level 8/ATK 2000/DEF 2000).
target_text: -- Pacifis,
  local CARD_ID_0 = 2819436 --Phantasm Spiral Token
  local SETCARD_ID_0 = 0xfa --Phantasm
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--to hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCode(EVENT_SUMMON_SUCCESS)
  	e2:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetCondition(s.thcon)
  	e2:SetCost(s.cost)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  	--token
  	local e6 = Effect.CreateEffect(c)
  	e6:SetDescription(aux.Stringid(id, 1))
  	e6:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e6:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e6:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_ACTIVATE_CONDITION)
  	e6:SetCode(EVENT_CHAINING)
  	e6:SetRange(LOCATION_FZONE)
  	e6:SetCountLimit(1, EFFECT_COUNT_CODE_CHAIN)
  	e6:SetCondition(s.spcon)
  	e6:SetCost(s.cost)
  	e6:SetTarget(s.sptg)
  	e6:SetOperation(s.spop)
  	c:RegisterEffect(e6)
  	--
  	Duel.AddCustomActivityCounter(id, ACTIVITY_SUMMON, s.counterfilter)
  	Duel.AddCustomActivityCounter(id, ACTIVITY_SPSUMMON, s.counterfilter)
  end
  function s.counterfilter(c)
  	return not c:IsType(TYPE_EFFECT)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetCustomActivityCount(id, tp, ACTIVITY_SUMMON) == 0 and Duel.GetCustomActivityCount(id, tp, ACTIVITY_SPSUMMON) == 0
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetCode(EFFECT_CANNOT_SUMMON)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.splimit(e, c, sump, sumtype, sumpos, targetp, se)
  	return c:IsType(TYPE_EFFECT)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	local tc = eg:GetFirst()
  	return eg:GetCount() == 1 and tc:IsSummonPlayer(tp) and tc:IsFaceup() and tc:IsType(TYPE_NORMAL)
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  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.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return rp == 1 - tp and not aux.tkfcon(e, tp)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, SETCARD_ID_0, TYPES_TOKEN_MONSTER, 2000, 2000, 6, RACE_WYRM, ATTRIBUTE_WATER)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 0, 0)
  	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	if not Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, SETCARD_ID_0, TYPES_TOKEN_MONSTER, 2000, 2000, 6, RACE_WYRM, ATTRIBUTE_WATER) then
  		return
  	end
  	local token = Duel.CreateToken(tp, id + 1)
  	Duel.SpecialSummon(token, 0, tp, tp, false, false, POS_FACEUP)
  end
  
  