name: Swordsoul
card_text: If a card(s) is banished (except during the Damage Step): You can banish 1 Wyrm Synchro Monster or 1 "Swordsoul" card from your hand, Deck, GY, or that is face-up on either field. If this card is banished: You can Special Summon 1 "Swordsoul Token" (Wyrm/Tuner/WATER/Level 4/ATK 0/DEF 0). While that Token is in the Monster Zone, the player who Summoned it cannot Special Summon monsters from the Extra Deck, except Synchro Monsters. You can only use each effect of "Swordsoul Strife" once per turn.
external_ids: local CARD_ID_0 = 99137267 --Swordsoul Token
  local CARD_ID_1 = 20001444 --Swordsoul Token
  local SETCARD_ID_0 = 0x16b --Swordsoul
  
lua: local CARD_ID_0 = 99137267 --Swordsoul Token
  local CARD_ID_1 = 20001444 --Swordsoul Token
  local SETCARD_ID_0 = 0x16b --Swordsoul
  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)
  	--remove
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_REMOVE)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCode(EVENT_REMOVE)
  	e2:SetCountLimit(1, id)
  	e2:SetTarget(s.remtg)
  	e2:SetOperation(s.remop)
  	c:RegisterEffect(e2)
  	--token
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetProperty(EFFECT_FLAG_DELAY)
  	e3:SetCode(EVENT_REMOVE)
  	e3:SetCountLimit(1, id + 1)
  	e3:SetTarget(s.sptg)
  	e3:SetOperation(s.spop)
  	c:RegisterEffect(e3)
  end
  function s.rmfilter(c)
  	return (c:IsType(TYPE_SYNCHRO) and c:IsRace(RACE_WYRM) or c:IsSetCard(SETCARD_ID_0)) and c:IsAbleToRemove() and (c:IsFaceup() or not c:IsOnField())
  end
  function s.remtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.rmfilter, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE + LOCATION_DECK, LOCATION_ONFIELD, nil)
  	if chk == 0 then
  		return g:GetCount() > 0
  	end
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, 1, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE + LOCATION_DECK)
  end
  function s.remop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, s.rmfilter, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE + LOCATION_DECK, LOCATION_ONFIELD, 1, 1, nil)
  	if #g > 0 then
  		Duel.Remove(g, POS_FACEUP, REASON_EFFECT)
  	end
  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,
  			CARD_ID_1,
  			SETCARD_ID_0,
  			TYPES_TOKEN_MONSTER + TYPE_TUNER,
  			0,
  			0,
  			4,
  			RACE_WYRM,
  			ATTRIBUTE_WATER
  		)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsPlayerCanSpecialSummonMonster(tp, CARD_ID_1, SETCARD_ID_0, TYPES_TOKEN_MONSTER + TYPE_TUNER, 0, 0, 4, RACE_WYRM, ATTRIBUTE_WATER) then
  		local token = Duel.CreateToken(tp, id + 1)
  		Duel.SpecialSummonStep(token, 0, tp, tp, false, false, POS_FACEUP)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD)
  		e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  		e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  		e1:SetRange(LOCATION_MZONE)
  		e1:SetAbsoluteRange(tp, 1, 0)
  		e1:SetTarget(s.splimit)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		token:RegisterEffect(e1, true)
  		Duel.SpecialSummonComplete()
  	end
  end
  function s.splimit(e, c)
  	return not c:IsType(TYPE_SYNCHRO) and c:IsLocation(LOCATION_EXTRA)
  end
  
  
source_text: Swordsoul
  If a card(s) is banished (except during the Damage Step): You can banish 1 Wyrm Synchro Monster or 1 "Swordsoul" card from your hand, Deck, GY, or that is face-up on either field. If this card is banished: You can Special Summon 1 "Swordsoul Token" (Wyrm/Tuner/WATER/Level 4/ATK 0/DEF 0). While that Token is in the Monster Zone, the player who Summoned it cannot Special Summon monsters from the Extra Deck, except Synchro Monsters. You can only use each effect of "Swordsoul Strife" once per turn.
target_text: -- Swordsoul
  local CARD_ID_0 = 99137267 --Swordsoul Token
  local CARD_ID_1 = 20001444 --Swordsoul Token
  local SETCARD_ID_0 = 0x16b --Swordsoul
  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)
  	--remove
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_REMOVE)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCode(EVENT_REMOVE)
  	e2:SetCountLimit(1, id)
  	e2:SetTarget(s.remtg)
  	e2:SetOperation(s.remop)
  	c:RegisterEffect(e2)
  	--token
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetProperty(EFFECT_FLAG_DELAY)
  	e3:SetCode(EVENT_REMOVE)
  	e3:SetCountLimit(1, id + 1)
  	e3:SetTarget(s.sptg)
  	e3:SetOperation(s.spop)
  	c:RegisterEffect(e3)
  end
  function s.rmfilter(c)
  	return (c:IsType(TYPE_SYNCHRO) and c:IsRace(RACE_WYRM) or c:IsSetCard(SETCARD_ID_0)) and c:IsAbleToRemove() and (c:IsFaceup() or not c:IsOnField())
  end
  function s.remtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.rmfilter, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE + LOCATION_DECK, LOCATION_ONFIELD, nil)
  	if chk == 0 then
  		return g:GetCount() > 0
  	end
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, 1, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE + LOCATION_DECK)
  end
  function s.remop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, s.rmfilter, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE + LOCATION_DECK, LOCATION_ONFIELD, 1, 1, nil)
  	if #g > 0 then
  		Duel.Remove(g, POS_FACEUP, REASON_EFFECT)
  	end
  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,
  			CARD_ID_1,
  			SETCARD_ID_0,
  			TYPES_TOKEN_MONSTER + TYPE_TUNER,
  			0,
  			0,
  			4,
  			RACE_WYRM,
  			ATTRIBUTE_WATER
  		)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsPlayerCanSpecialSummonMonster(tp, CARD_ID_1, SETCARD_ID_0, TYPES_TOKEN_MONSTER + TYPE_TUNER, 0, 0, 4, RACE_WYRM, ATTRIBUTE_WATER) then
  		local token = Duel.CreateToken(tp, id + 1)
  		Duel.SpecialSummonStep(token, 0, tp, tp, false, false, POS_FACEUP)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD)
  		e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  		e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  		e1:SetRange(LOCATION_MZONE)
  		e1:SetAbsoluteRange(tp, 1, 0)
  		e1:SetTarget(s.splimit)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		token:RegisterEffect(e1, true)
  		Duel.SpecialSummonComplete()
  	end
  end
  function s.splimit(e, c)
  	return not c:IsType(TYPE_SYNCHRO) and c:IsLocation(LOCATION_EXTRA)
  end
  
  