--[决斗编年史]奇迹的创造者
function c66666003.initial_effect(c)
	local e1=Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_IGNITION)
	e1:SetCountLimit(1)
	e1:SetRange(LOCATION_MZONE)
	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e1:SetCost(c66666003.cost)
	e1:SetTarget(c66666003.target)
	e1:SetOperation(c66666003.activate)
	c:RegisterEffect(e1)
end

function c66666003.cost(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return true end
	Duel.Hint(HINT_MESSAGE,tp,aux.Stringid(66666003,0))
	Duel.Hint(HINT_MESSAGE,1-tp,aux.Stringid(66666003,0))
end
function c66666003.tgfilter(c)
	return c:IsSetCard(0x1048) and c:IsSetCard(0x107f) and c:IsType(TYPE_XYZ) and c:IsFaceup()
end
function c66666003.target(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.IsExistingTarget(c66666003.tgfilter,tp,LOCATION_MZONE,0,1,nil) end
	Duel.SelectTarget(tp,c66666003.tgfilter,tp,LOCATION_MZONE,0,1,1,nil)
end
function c66666003.activate(e,tp,eg,ep,ev,re,r,rp)
	local tc = Duel.GetFirstTarget()
	if tc:IsFaceup() and tc:IsRelateToEffect(e) then
		local e1=Effect.CreateEffect(e:GetHandler())
		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_DIRECT_ATTACK)
		e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
		tc:RegisterEffect(e1)
		local e2=Effect.CreateEffect(tc)
		e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
		e2:SetCode(EVENT_BATTLE_DAMAGE)
		e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
		e2:SetCondition(c66666003.condition)
		e2:SetOperation(c66666003.operation)
		tc:RegisterEffect(e2,true)
	end
end

function c66666003.condition(e,tp,eg,ep,ev,re,r,rp)
	return ep~=tp and Duel.GetAttackTarget()==nil
		and Duel.GetFlagEffect(tp,66666001) ~= 0
		and Duel.GetFlagEffect(tp,66666002) ~= 0
end

function c66666003.operation(e,tp,eg,ep,ev,re,r,rp)
	Duel.SetLP(1-tp,0)
end



















