name: Vision
card_text: You can discard 1 other "HERO" monster; Special Summon this card from your hand. If this card is Normal or Special Summoned: You can place 1 "Vision HERO" monster from your Deck, except "Vision HERO Faris", in your Spell & Trap Zone as a face-up Continuous Trap, also you cannot Special Summon monsters from the Extra Deck for the rest of this turn, except "HERO" monsters. You can only use each effect of "Vision HERO Faris" once per turn.
external_ids: local SETCARD_ID_0 = 0x5008 --Vision
  local SETCARD_ID_1 = 0x8 --HERO
  
lua: local SETCARD_ID_0 = 0x5008 --Vision
  local SETCARD_ID_1 = 0x8 --HERO
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	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)
  	--place
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SUMMON_SUCCESS)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetTarget(s.target)
  	e2:SetOperation(s.operation)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  end
  function s.cfilter(c)
  	return c:IsType(TYPE_MONSTER) and c:IsSetCard(SETCARD_ID_1) and c:IsDiscardable()
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_HAND, 0, 1, e:GetHandler())
  	end
  	Duel.DiscardHand(tp, s.cfilter, 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) then
  		Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  function s.filter(c)
  	return c:IsSetCard(SETCARD_ID_1) and c:IsType(TYPE_MONSTER) and not c:IsForbidden() and not c:IsCode(id)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil) and Duel.GetLocationCount(tp, LOCATION_SZONE) > 0
  	end
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOFIELD)
  		local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_DECK, 0, 1, 1, nil)
  		local tc = g:GetFirst()
  		if tc then
  			Duel.MoveToField(tc, tp, tp, LOCATION_SZONE, POS_FACEUP, true)
  			local e1 = Effect.CreateEffect(c)
  			e1:SetCode(EFFECT_CHANGE_TYPE)
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD - RESET_TURN_SET)
  			e1:SetValue(TYPE_TRAP + TYPE_CONTINUOUS)
  			tc:RegisterEffect(e1)
  		end
  	end
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetTargetRange(1, 0)
  	e2:SetTarget(s.splimit)
  	e2:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.splimit(e, c, sump, sumtype, sumpos, targetp, se)
  	return not c:IsSetCard(SETCARD_ID_1) and c:IsLocation(LOCATION_EXTRA)
  end
  
  
source_text: Vision
  You can discard 1 other "HERO" monster; Special Summon this card from your hand. If this card is Normal or Special Summoned: You can place 1 "Vision HERO" monster from your Deck, except "Vision HERO Faris", in your Spell & Trap Zone as a face-up Continuous Trap, also you cannot Special Summon monsters from the Extra Deck for the rest of this turn, except "HERO" monsters. You can only use each effect of "Vision HERO Faris" once per turn.
target_text: -- Vision
  local SETCARD_ID_0 = 0x5008 --Vision
  local SETCARD_ID_1 = 0x8 --HERO
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	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)
  	--place
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SUMMON_SUCCESS)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetTarget(s.target)
  	e2:SetOperation(s.operation)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  end
  function s.cfilter(c)
  	return c:IsType(TYPE_MONSTER) and c:IsSetCard(SETCARD_ID_1) and c:IsDiscardable()
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_HAND, 0, 1, e:GetHandler())
  	end
  	Duel.DiscardHand(tp, s.cfilter, 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) then
  		Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  function s.filter(c)
  	return c:IsSetCard(SETCARD_ID_1) and c:IsType(TYPE_MONSTER) and not c:IsForbidden() and not c:IsCode(id)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil) and Duel.GetLocationCount(tp, LOCATION_SZONE) > 0
  	end
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOFIELD)
  		local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_DECK, 0, 1, 1, nil)
  		local tc = g:GetFirst()
  		if tc then
  			Duel.MoveToField(tc, tp, tp, LOCATION_SZONE, POS_FACEUP, true)
  			local e1 = Effect.CreateEffect(c)
  			e1:SetCode(EFFECT_CHANGE_TYPE)
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD - RESET_TURN_SET)
  			e1:SetValue(TYPE_TRAP + TYPE_CONTINUOUS)
  			tc:RegisterEffect(e1)
  		end
  	end
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetTargetRange(1, 0)
  	e2:SetTarget(s.splimit)
  	e2:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.splimit(e, c, sump, sumtype, sumpos, targetp, se)
  	return not c:IsSetCard(SETCARD_ID_1) and c:IsLocation(LOCATION_EXTRA)
  end
  
  