name: Mithra
card_text: If this card is in your hand: You can activate this effect; you cannot Special Summon monsters from the Extra Deck for the rest of this turn, also Special Summon this card, and if you do, Special Summon 1 "Vassal Token" (Thunder-Type/LIGHT/Level 1/ATK 800/DEF 1000) to your opponent's field in Defense Position. If this card is Tributed for a Tribute Summon: You can activate this effect; you can Tribute Summon 1 monster during your Main Phase this turn, in addition to your Normal Summon/Set this turn. (You can only gain this effect once per turn.) You can only use each effect of "Mithra the Thunder Vassal" once per turn.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 22404676 --Vassal Token
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 22404676 --Vassal Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--search
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCode(EVENT_RELEASE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCondition(s.sumcon)
  	e2:SetTarget(s.sumtg)
  	e2:SetOperation(s.sumop)
  	c:RegisterEffect(e2)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  			and Duel.GetLocationCount(1 - tp, LOCATION_MZONE) > 0
  			and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 800, 1000, 1, RACE_THUNDER, ATTRIBUTE_LIGHT, POS_FACEUP_DEFENSE)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 2, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		if Duel.SpecialSummonStep(c, 0, tp, tp, false, false, POS_FACEUP) then
  			if
  				Duel.GetLocationCount(1 - tp, LOCATION_MZONE, tp) > 0
  				and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 800, 1000, 1, RACE_THUNDER, ATTRIBUTE_LIGHT, POS_FACEUP_DEFENSE)
  				and not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			then
  				local token = Duel.CreateToken(tp, id + 1)
  				Duel.SpecialSummonStep(token, 0, tp, 1 - tp, false, false, POS_FACEUP_DEFENSE)
  			end
  		end
  		Duel.SpecialSummonComplete()
  	end
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c, sump, sumtype, sumpos, targetp, se)
  	return c:IsLocation(LOCATION_EXTRA)
  end
  function s.sumcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsReason(REASON_SUMMON) and Duel.GetTurnPlayer() == tp
  end
  function s.sumtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanSummon(tp) and Duel.IsPlayerCanAdditionalSummon(tp)
  	end
  end
  function s.sumop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetFlagEffect(tp, id) ~= 0 then
  		return
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetTargetRange(LOCATION_HAND, 0)
  	e1:SetCode(EFFECT_EXTRA_SUMMON_COUNT)
  	e1:SetValue(0x1)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_EXTRA_SET_COUNT)
  	Duel.RegisterEffect(e2, tp)
  	Duel.RegisterFlagEffect(tp, id, RESET_PHASE + PHASE_END, 0, 1)
  end
  
  
source_text: Mithra
  If this card is in your hand: You can activate this effect; you cannot Special Summon monsters from the Extra Deck for the rest of this turn, also Special Summon this card, and if you do, Special Summon 1 "Vassal Token" (Thunder-Type/LIGHT/Level 1/ATK 800/DEF 1000) to your opponent's field in Defense Position. If this card is Tributed for a Tribute Summon: You can activate this effect; you can Tribute Summon 1 monster during your Main Phase this turn, in addition to your Normal Summon/Set this turn. (You can only gain this effect once per turn.) You can only use each effect of "Mithra the Thunder Vassal" once per turn.
target_text: -- Mithra
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 22404676 --Vassal Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--search
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCode(EVENT_RELEASE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCondition(s.sumcon)
  	e2:SetTarget(s.sumtg)
  	e2:SetOperation(s.sumop)
  	c:RegisterEffect(e2)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  			and Duel.GetLocationCount(1 - tp, LOCATION_MZONE) > 0
  			and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 800, 1000, 1, RACE_THUNDER, ATTRIBUTE_LIGHT, POS_FACEUP_DEFENSE)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 2, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		if Duel.SpecialSummonStep(c, 0, tp, tp, false, false, POS_FACEUP) then
  			if
  				Duel.GetLocationCount(1 - tp, LOCATION_MZONE, tp) > 0
  				and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 800, 1000, 1, RACE_THUNDER, ATTRIBUTE_LIGHT, POS_FACEUP_DEFENSE)
  				and not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			then
  				local token = Duel.CreateToken(tp, id + 1)
  				Duel.SpecialSummonStep(token, 0, tp, 1 - tp, false, false, POS_FACEUP_DEFENSE)
  			end
  		end
  		Duel.SpecialSummonComplete()
  	end
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c, sump, sumtype, sumpos, targetp, se)
  	return c:IsLocation(LOCATION_EXTRA)
  end
  function s.sumcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsReason(REASON_SUMMON) and Duel.GetTurnPlayer() == tp
  end
  function s.sumtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanSummon(tp) and Duel.IsPlayerCanAdditionalSummon(tp)
  	end
  end
  function s.sumop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetFlagEffect(tp, id) ~= 0 then
  		return
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetTargetRange(LOCATION_HAND, 0)
  	e1:SetCode(EFFECT_EXTRA_SUMMON_COUNT)
  	e1:SetValue(0x1)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_EXTRA_SET_COUNT)
  	Duel.RegisterEffect(e2, tp)
  	Duel.RegisterFlagEffect(tp, id, RESET_PHASE + PHASE_END, 0, 1)
  end
  
  