--[决斗编年史]阴阳神 葛之叶
function c20150001.initial_effect(c)
	--pendulum summon
	aux.EnablePendulumAttribute(c)
	--pendulum effect
	local e0=Effect.CreateEffect(c)
	e0:SetDescription(aux.Stringid(20150001,0))
	e0:SetType(EFFECT_TYPE_IGNITION)
	e0:SetRange(LOCATION_PZONE)
	e0:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e0:SetCountLimit(1,20150001)
	e0:SetTarget(c20150001.mkcost)
	e0:SetTarget(c20150001.mktg)
	e0:SetOperation(c20150001.mkop)
	c:RegisterEffect(e0)
	--summon with 3 tribute
	local e1=Effect.CreateEffect(c)
	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
	e1:SetType(EFFECT_TYPE_SINGLE)
	e1:SetCode(EFFECT_LIMIT_SUMMON_PROC)
	e1:SetCondition(c20150001.ttcon)
	e1:SetOperation(c20150001.ttop)
	e1:SetValue(SUMMON_TYPE_ADVANCE)
	c:RegisterEffect(e1)
	local e2=Effect.CreateEffect(c)
	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
	e2:SetType(EFFECT_TYPE_SINGLE)
	e2:SetCode(EFFECT_LIMIT_SET_PROC)
	e2:SetCondition(c20150001.ttcon)
	e2:SetOperation(c20150001.ttop)
	e2:SetValue(SUMMON_TYPE_ADVANCE)
	c:RegisterEffect(e2)
	--tribute limit
	local e3=Effect.CreateEffect(c)
	e3:SetType(EFFECT_TYPE_SINGLE)
	e3:SetCode(EFFECT_TRIBUTE_LIMIT)
	e3:SetValue(c20150001.tlimit)
	c:RegisterEffect(e3)
	--match kill
	local e4=Effect.CreateEffect(c)
	e4:SetType(EFFECT_TYPE_SINGLE)
	e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
	e4:SetCode(EFFECT_MATCH_KILL)
	e4:SetCondition(c20150001.mkcon)
	c:RegisterEffect(e4)
	--spsummon condition
	local e5=Effect.CreateEffect(c)
	e5:SetType(EFFECT_TYPE_SINGLE)
	e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
	e5:SetCode(EFFECT_SPSUMMON_CONDITION)
	e5:SetValue(aux.penlimit)
	c:RegisterEffect(e5)
end
function c20150001.mkcon(e,c)
	return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==1
end
function c20150001.ttcon(e,c,minc)
	if c==nil then return true end
	return minc<=3 and Duel.CheckTribute(c,3)
end
function c20150001.ttop(e,tp,eg,ep,ev,re,r,rp,c)
	local g=Duel.SelectTribute(tp,c,3,3)
	c:SetMaterial(g)
	Duel.Release(g,REASON_SUMMON+REASON_MATERIAL)
end
function c20150001.tlimit(e,c)
	return not c:IsRace(RACE_BEAST)
end
function c20150001.mkcostfilter(c)
	return c:IsFaceup() and c:IsType(TYPE_PENDULUM)
		and c:IsRace(RACE_BEAST) and c:IsAbleToRemoveAsCost()
end
function c20150001.mkcostfilter2(c,e,tp)
	return c:IsFaceup() and c:IsType(TYPE_PENDULUM) and c:IsCanBeEffectTarget(e) and
		Duel.IsExistingMatchingCard(c20150001.mkcostfilter,tp,LOCATION_MZONE,0,3,c)
end
function c20150001.mktgfilter(c,e,tp)
	return c:IsFaceup() and c:IsType(TYPE_PENDULUM)
end
function c20150001.mkcost(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.IsExistingMatchingCard(c20150001.mkcostfilter2,tp,LOCATION_MZONE,0,1,nil,e,tp) end
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
	local c=Duel.SelectMatchingCard(c20150001.mkcostfilter2,tp,LOCATION_MZONE,0,1,nil,e,tp)
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
	local g=Duel.SelectMatchingCard(c20150001.mkcostfilter,tp,LOCATION_MZONE,0,3,c)
	Duel.Remove(g,POS_FACEUP,REASON_COST)
	e:SetLabel(1)
	e:SetLabelObject(c)
end
function c20150001.mktg(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then
		return e:GetLabel()==1 or
			Duel.IsExistingTarget(c20150001.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(c20150001.mktgfilter,tp,LOCATION_MZONE,0,3,c)
	end
end
function c20150001.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