--[决斗编年史]极刀之武者 左京
function c20150002.initial_effect(c)
	--pendulum summon
	aux.EnablePendulumAttribute(c)
	--pendulum effect
	local e0=Effect.CreateEffect(c)
	e0:SetDescription(aux.Stringid(20150002,0))
	e0:SetType(EFFECT_TYPE_IGNITION)
	e0:SetRange(LOCATION_PZONE)
	e0:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e0:SetCountLimit(1,20150002)
	e0:SetTarget(c20150002.mkcost)
	e0:SetTarget(c20150002.mktg)
	e0:SetOperation(c20150002.mkop)
	c:RegisterEffect(e0)
end

function c20150002.mkcostfilter(c)
	return c:IsFaceup() and c:IsType(TYPE_PENDULUM)
		and c:IsRace(RACE_WARRIOR) and c:IsAbleToRemoveAsCost()
end
function c20150002.mkcostfilter2(c,e,tp)
	return c:IsFaceup() and c:IsType(TYPE_PENDULUM) and c:IsCanBeEffectTarget(e) and
		Duel.IsExistingMatchingCard(c20150002.mkcostfilter,tp,LOCATION_MZONE,0,3,c)
end
function c20150002.mktgfilter(c,e,tp)
	return c:IsFaceup() and c:IsType(TYPE_PENDULUM)
end
function c20150002.mkcost(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.IsExistingMatchingCard(c20150002.mkcostfilter2,tp,LOCATION_MZONE,0,1,nil,e,tp) end
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
	local c=Duel.SelectMatchingCard(c20150002.mkcostfilter2,tp,LOCATION_MZONE,0,1,nil,e,tp)
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
	local g=Duel.SelectMatchingCard(c20150002.mkcostfilter,tp,LOCATION_MZONE,0,3,c)
	Duel.Remove(g,POS_FACEUP,REASON_COST)
	e:SetLabel(1)
	e:SetLabelObject(c)
end
function c20150002.mktg(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then
		return e:GetLabel()==1 or
			Duel.IsExistingTarget(c20150002.mktgfilter,tp,LOCATION_MZONE,0,1,nil)
	end
	local g=nil
	if e:GetLabel()==1 then
		g=Duel.SetTargetCard(e:GetLabelObject())
	else
		Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
		g=Duel.SelectTarget(c20150002.mktgfilter,tp,LOCATION_MZONE,0,3,c)
	end
end
function c20150002.mkop(e,tp,eg,ep,ev,re,r,rp)
	local tc=Duel.GetFirstTarget()
	if not tc or not tc:IsRelateToEffect(e) then return end
	--match kill
	local e1=Effect.CreateEffect(e:GetHandler())
	e1:SetType(EFFECT_TYPE_SINGLE)
	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
	e1:SetCode(EFFECT_MATCH_KILL)
	e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
	tc:RegisterEffect(e1)
end