--[决斗编年史]希望的创造者
function c66666001.initial_effect(c)
	--deck control
	local e1=Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
	e1:SetCode(EVENT_TO_GRAVE)
	e1:SetOperation(c66666001.spreg)
	c:RegisterEffect(e1)
	local e2=Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(66666001,1))
	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
	e2:SetRange(LOCATION_GRAVE)
	e2:SetCode(EVENT_PREDRAW)
	e2:SetCondition(c66666001.spcon2)
	e2:SetCost(c66666001.spcost)
	e2:SetTarget(c66666001.sptg2)
	e2:SetOperation(c66666001.spop2)
	e1:SetLabelObject(e2)
	c:RegisterEffect(e2)
end

function c66666001.spreg(e,tp,eg,ep,ev,re,r,rp)
	local c=e:GetHandler()
	if rp==1-tp and c:IsReason(REASON_DESTROY) then
		e:GetLabelObject():SetLabel(Duel.GetTurnCount()+1)
		local turn = 2
		if Duel.GetTurnPlayer() == tp then turn = 3 end
		c:RegisterFlagEffect(66666001,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,turn)
	end
end

function c66666001.spcon2(e,tp,eg,ep,ev,re,r,rp)
	return Duel.GetTurnPlayer() == tp and Duel.GetLP(tp) < Duel.GetLP(1-tp)
		and e:GetHandler():GetFlagEffect(66666001)>0
end

function c66666001.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
	return Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetCount() > 0
end

function c66666001.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return true end
	Duel.Hint(HINT_MESSAGE,tp,aux.Stringid(66666001,0))
	Duel.Hint(HINT_MESSAGE,1-tp,aux.Stringid(66666001,0))
end

function c66666001.spop2(e,tp,eg,ep,ev,re,r,rp)
	Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(66666001,1))
	local g = Duel.SelectMatchingCard(tp,nil,tp,LOCATION_DECK,0,1,1,nil)
	Duel.ConfirmCards(1-tp,g)
	Duel.MoveSequence(g:GetFirst(),0)
	Duel.RegisterFlagEffect(tp,66666001,0,0,999)
end
















