--混沌龙骑士
local s,id,o=GetID()
function s.initial_effect(c)
	--融合
	c:EnableReviveLimit()
	aux.AddFusionProcCodeFun(c,23995346,s.filter0,1,true,true)
	aux.AddContactFusionProcedure(c,Card.IsReleasable,LOCATION_MZONE,0,Duel.Release,REASON_COST+REASON_MATERIAL)
	--解放特召
	local e1=Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_SINGLE)
	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
	e1:SetValue(s.Value1)
	c:RegisterEffect(e1)
	--贯穿
	local e2=Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_SINGLE)
	e2:SetCode(EFFECT_PIERCE)
	c:RegisterEffect(e2)
	--效果抗性
	local e3=Effect.CreateEffect(c)
	e3:SetType(EFFECT_TYPE_SINGLE)
	e3:SetCode(EFFECT_IMMUNE_EFFECT)
	e3:SetCondition(s.limCondition3)
	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
	e3:SetRange(LOCATION_MZONE)
	e3:SetValue(s.filter3)
	c:RegisterEffect(e3)
	--不能发动
	local e4=Effect.CreateEffect(c)
	e4:SetDescription(aux.Stringid(id,0))
	e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
	e4:SetCode(EVENT_SPSUMMON_SUCCESS)
	e4:SetCondition(s.limCondition4)
	e4:SetTarget(s.limTarget4)
	e4:SetOperation(s.limOperation4)
	c:RegisterEffect(e4)
	--检查
	local e6=Effect.CreateEffect(c)
	e6:SetType(EFFECT_TYPE_SINGLE)
	e6:SetCode(EFFECT_MATERIAL_CHECK)
	e6:SetValue(s.ValueCheck6)
	e6:SetLabelObject(e3)
	c:RegisterEffect(e6)
	--检查
	local e7=e6:Clone()
	e7:SetLabelObject(e4)
	c:RegisterEffect(e7)
end
	--e1=特招
function s.filter0(c)
	return c:IsSetCard(0xcf) and c:IsFusionType(TYPE_RITUAL)
end
function s.Value1(e,se,sp,st)
	return bit.band(st,SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION
end
	--e6=检查
function s.ValueCheck6(e,c)
	local g=c:GetMaterial()
	local ct=g:FilterCount(Card.IsFusionType,nil,TYPE_EFFECT)
	local d=2-ct
	e:GetLabelObject():SetLabel(d)
end
	--e3=效果抗性
function s.limCondition3(e,tp,eg,ep,ev,re,r,rp)
	return e:GetLabel()~=0
end
function s.filter3(e,re)
	return e:GetHandlerPlayer()~=re:GetOwnerPlayer() and re:IsActivated()
end
	--e4=不能发动
function s.limCondition4(e,tp,eg,ep,ev,re,r,rp)
	return e:GetHandler():IsSummonType(SUMMON_TYPE_SPECIAL) and e:GetLabel()==2
end
function s.limTarget4(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return true end
	Duel.SetChainLimit(s.chainLimit)
end
function s.chainLimit(e,rp,tp)
	return tp==rp
end
function s.limOperation4(e,tp,eg,ep,ev,re,r,rp)
	local e5=Effect.CreateEffect(e:GetHandler())
	e5:SetType(EFFECT_TYPE_FIELD)
	e5:SetCode(EFFECT_CANNOT_ACTIVATE)
	e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
	e5:SetTargetRange(0,1)
	e5:SetValue(s.aclimit5)
	e5:SetReset(RESET_PHASE+PHASE_END)
	Duel.RegisterEffect(e5,tp)
end
function s.aclimit5(e,re,tp)
	return re:GetHandler():IsOnField() or re:IsHasType(EFFECT_TYPE_ACTIVATE)
end