Witchcrafter
During the Main Phase (Quick Effect): You can Tribute this card, then discard 1 Spell; Special Summon 1 "Witchcrafter" monster from your Deck, except "Witchcrafter Pittore". You can banish this card from your GY; draw 1 card, then send 1 "Witchcrafter" card from your hand to the GY, or, if you have none, banish your entire hand. You can only use each effect of "Witchcrafter Pittore" once per turn.
local CARD_ID_1 = 83289866 --Witchcrafter Bystreet
local SETCARD_ID_0 = 0x128 --Witchcrafter

local CARD_ID_1 = 83289866 --Witchcrafter Bystreet
local SETCARD_ID_0 = 0x128 --Witchcrafter
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_QUICK_O)
	e1:SetHintTiming(0, TIMING_MAIN_END)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetRange(LOCATION_MZONE)
	e1:SetCountLimit(1, id)
	e1:SetCondition(s.spcon)
	e1:SetCost(s.spcost)
	e1:SetTarget(s.sptg)
	e1:SetOperation(s.spop)
	c:RegisterEffect(e1)
	--draw
	local e2 = Effect.CreateEffect(c)
	e2:SetCategory(CATEGORY_DRAW + CATEGORY_REMOVE + CATEGORY_HANDES)
	e2:SetType(EFFECT_TYPE_IGNITION)
	e2:SetRange(LOCATION_GRAVE)
	e2:SetCountLimit(1, id + 1)
	e2:SetCost(aux.bfgcost)
	e2:SetTarget(s.drtg)
	e2:SetOperation(s.drop)
	c:RegisterEffect(e2)
end
function s.spcon(e, tp, eg, ep, ev, re, r, rp)
	return Duel.GetCurrentPhase() == PHASE_MAIN1 or Duel.GetCurrentPhase() == PHASE_MAIN2
end
function s.costfilter(c, tp)
	if c:IsLocation(LOCATION_HAND) then
		return c:IsType(TYPE_SPELL) and c:IsDiscardable()
	end
	return c:IsFaceup() and c:IsAbleToGraveAsCost() and c:IsHasEffect(CARD_ID_1, tp)
end
function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return e:GetHandler():IsReleasable() and Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_HAND + LOCATION_SZONE, 0, 1, nil, tp)
	end
	local g = Duel.GetMatchingGroup(s.costfilter, tp, LOCATION_HAND + LOCATION_SZONE, 0, nil, tp)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISCARD)
	local tc = g:Select(tp, 1, 1, nil):GetFirst()
	local te = tc:IsHasEffect(CARD_ID_1, tp)
	if te then
		te:UseCountLimit(tp)
		Duel.Release(e:GetHandler(), REASON_COST)
		Duel.SendtoGrave(tc, REASON_COST)
	else
		Duel.Release(e:GetHandler(), REASON_COST)
		Duel.SendtoGrave(tc, REASON_COST + REASON_DISCARD)
	end
end
function s.spfilter(c, e, tp)
	return c:IsSetCard(SETCARD_ID_0) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
end
function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.GetMZoneCount(tp, e:GetHandler()) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp)
	end
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
end
function s.spop(e, tp, eg, ep, ev, re, r, rp)
	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
		return
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
	local g = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp)
	if g:GetCount() > 0 then
		Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
	end
end
function s.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsPlayerCanRemove(tp) and Duel.IsPlayerCanDraw(tp, 1)
	end
	Duel.SetTargetPlayer(tp)
	Duel.SetTargetParam(1)
	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 1)
end
function s.tgfilter(c)
	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToGrave()
end
function s.drop(e, tp, eg, ep, ev, re, r, rp)
	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
	Duel.Draw(p, d, REASON_EFFECT)
	Duel.ShuffleHand(p)
	Duel.BreakEffect()
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
	local g = Duel.SelectMatchingCard(p, s.tgfilter, p, LOCATION_HAND, 0, 1, 1, nil)
	local tg = g:GetFirst()
	if tg then
		if Duel.SendtoGrave(g, REASON_EFFECT) == 0 then
			Duel.ConfirmCards(1 - p, tg)
			Duel.ShuffleHand(p)
		end
	else
		local sg = Duel.GetFieldGroup(p, LOCATION_HAND, 0)
		if Duel.Remove(sg, POS_FACEUP, REASON_EFFECT) == 0 then
			Duel.ConfirmCards(1 - p, sg)
			Duel.ShuffleHand(p)
		end
	end
end


Witchcrafter
During the Main Phase (Quick Effect): You can Tribute this card, then discard 1 Spell; Special Summon 1 "Witchcrafter" monster from your Deck, except "Witchcrafter Pittore". You can banish this card from your GY; draw 1 card, then send 1 "Witchcrafter" card from your hand to the GY, or, if you have none, banish your entire hand. You can only use each effect of "Witchcrafter Pittore" once per turn.
-- Witchcrafter
local CARD_ID_1 = 83289866 --Witchcrafter Bystreet
local SETCARD_ID_0 = 0x128 --Witchcrafter
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_QUICK_O)
	e1:SetHintTiming(0, TIMING_MAIN_END)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetRange(LOCATION_MZONE)
	e1:SetCountLimit(1, id)
	e1:SetCondition(s.spcon)
	e1:SetCost(s.spcost)
	e1:SetTarget(s.sptg)
	e1:SetOperation(s.spop)
	c:RegisterEffect(e1)
	--draw
	local e2 = Effect.CreateEffect(c)
	e2:SetCategory(CATEGORY_DRAW + CATEGORY_REMOVE + CATEGORY_HANDES)
	e2:SetType(EFFECT_TYPE_IGNITION)
	e2:SetRange(LOCATION_GRAVE)
	e2:SetCountLimit(1, id + 1)
	e2:SetCost(aux.bfgcost)
	e2:SetTarget(s.drtg)
	e2:SetOperation(s.drop)
	c:RegisterEffect(e2)
end
function s.spcon(e, tp, eg, ep, ev, re, r, rp)
	return Duel.GetCurrentPhase() == PHASE_MAIN1 or Duel.GetCurrentPhase() == PHASE_MAIN2
end
function s.costfilter(c, tp)
	if c:IsLocation(LOCATION_HAND) then
		return c:IsType(TYPE_SPELL) and c:IsDiscardable()
	end
	return c:IsFaceup() and c:IsAbleToGraveAsCost() and c:IsHasEffect(CARD_ID_1, tp)
end
function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return e:GetHandler():IsReleasable() and Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_HAND + LOCATION_SZONE, 0, 1, nil, tp)
	end
	local g = Duel.GetMatchingGroup(s.costfilter, tp, LOCATION_HAND + LOCATION_SZONE, 0, nil, tp)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISCARD)
	local tc = g:Select(tp, 1, 1, nil):GetFirst()
	local te = tc:IsHasEffect(CARD_ID_1, tp)
	if te then
		te:UseCountLimit(tp)
		Duel.Release(e:GetHandler(), REASON_COST)
		Duel.SendtoGrave(tc, REASON_COST)
	else
		Duel.Release(e:GetHandler(), REASON_COST)
		Duel.SendtoGrave(tc, REASON_COST + REASON_DISCARD)
	end
end
function s.spfilter(c, e, tp)
	return c:IsSetCard(SETCARD_ID_0) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
end
function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.GetMZoneCount(tp, e:GetHandler()) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp)
	end
	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
end
function s.spop(e, tp, eg, ep, ev, re, r, rp)
	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
		return
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
	local g = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp)
	if g:GetCount() > 0 then
		Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
	end
end
function s.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsPlayerCanRemove(tp) and Duel.IsPlayerCanDraw(tp, 1)
	end
	Duel.SetTargetPlayer(tp)
	Duel.SetTargetParam(1)
	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 1)
end
function s.tgfilter(c)
	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToGrave()
end
function s.drop(e, tp, eg, ep, ev, re, r, rp)
	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
	Duel.Draw(p, d, REASON_EFFECT)
	Duel.ShuffleHand(p)
	Duel.BreakEffect()
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
	local g = Duel.SelectMatchingCard(p, s.tgfilter, p, LOCATION_HAND, 0, 1, 1, nil)
	local tg = g:GetFirst()
	if tg then
		if Duel.SendtoGrave(g, REASON_EFFECT) == 0 then
			Duel.ConfirmCards(1 - p, tg)
			Duel.ShuffleHand(p)
		end
	else
		local sg = Duel.GetFieldGroup(p, LOCATION_HAND, 0)
		if Duel.Remove(sg, POS_FACEUP, REASON_EFFECT) == 0 then
			Duel.ConfirmCards(1 - p, sg)
			Duel.ShuffleHand(p)
		end
	end
end

