name: Swordsoul
card_text: You can discard 1 other "Swordsoul" card or 1 other Wyrm monster; Special Summon this card from your hand, then 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 from the Extra Deck, except Synchro Monsters. If this card is sent to the GY as Synchro Material: You can inflict 1200 damage to your opponent. You can only use each effect of "Swordsoul Strategist Longyuan" once per turn.
external_ids: local CARD_ID_0 = 93490857 --Swordsoul Token
  local CARD_ID_1 = 20001444 --Swordsoul Token
  local SETCARD_ID_0 = 0x16b --Swordsoul
  
lua: local CARD_ID_0 = 93490857 --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)
  	--special summon (self)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--damage
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOGRAVE)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCode(EVENT_BE_MATERIAL)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCondition(s.damcon)
  	e2:SetTarget(s.damtg)
  	e2:SetOperation(s.damop)
  	c:RegisterEffect(e2)
  end
  function s.costfilter(c)
  	return (c:IsSetCard(SETCARD_ID_0) or (c:IsRace(RACE_WYRM) and c:IsType(TYPE_MONSTER))) and c:IsDiscardable()
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_HAND, 0, 1, e:GetHandler())
  	end
  	Duel.DiscardHand(tp, s.costfilter, 1, 1, REASON_COST + REASON_DISCARD, e:GetHandler())
  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 e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP) ~= 0 then
  		local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  		if
  			ft > 0
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, CARD_ID_1, SETCARD_ID_0, TYPES_TOKEN_MONSTER + TYPE_TUNER, 0, 0, 4, RACE_WYRM, ATTRIBUTE_WATER)
  			and Duel.SelectYesNo(tp, aux.Stringid(id, 2))
  		then
  			Duel.BreakEffect()
  			local token = Duel.CreateToken(tp, id + 1)
  			Duel.SpecialSummonStep(token, 0, tp, tp, false, false, POS_FACEUP)
  			local e1 = Effect.CreateEffect(c)
  			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
  end
  function s.splimit(e, c)
  	return not c:IsType(TYPE_SYNCHRO) and c:IsLocation(LOCATION_EXTRA)
  end
  function s.damcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsLocation(LOCATION_GRAVE) and r == REASON_SYNCHRO
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(1200)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 1200)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  
  
source_text: Swordsoul
  You can discard 1 other "Swordsoul" card or 1 other Wyrm monster; Special Summon this card from your hand, then 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 from the Extra Deck, except Synchro Monsters. If this card is sent to the GY as Synchro Material: You can inflict 1200 damage to your opponent. You can only use each effect of "Swordsoul Strategist Longyuan" once per turn.
target_text: -- Swordsoul
  local CARD_ID_0 = 93490857 --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)
  	--special summon (self)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--damage
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOGRAVE)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCode(EVENT_BE_MATERIAL)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCondition(s.damcon)
  	e2:SetTarget(s.damtg)
  	e2:SetOperation(s.damop)
  	c:RegisterEffect(e2)
  end
  function s.costfilter(c)
  	return (c:IsSetCard(SETCARD_ID_0) or (c:IsRace(RACE_WYRM) and c:IsType(TYPE_MONSTER))) and c:IsDiscardable()
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_HAND, 0, 1, e:GetHandler())
  	end
  	Duel.DiscardHand(tp, s.costfilter, 1, 1, REASON_COST + REASON_DISCARD, e:GetHandler())
  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 e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP) ~= 0 then
  		local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  		if
  			ft > 0
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, CARD_ID_1, SETCARD_ID_0, TYPES_TOKEN_MONSTER + TYPE_TUNER, 0, 0, 4, RACE_WYRM, ATTRIBUTE_WATER)
  			and Duel.SelectYesNo(tp, aux.Stringid(id, 2))
  		then
  			Duel.BreakEffect()
  			local token = Duel.CreateToken(tp, id + 1)
  			Duel.SpecialSummonStep(token, 0, tp, tp, false, false, POS_FACEUP)
  			local e1 = Effect.CreateEffect(c)
  			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
  end
  function s.splimit(e, c)
  	return not c:IsType(TYPE_SYNCHRO) and c:IsLocation(LOCATION_EXTRA)
  end
  function s.damcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsLocation(LOCATION_GRAVE) and r == REASON_SYNCHRO
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(1200)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 1200)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  
  