--溟界神-阿图姆拉
function c114514509.initial_effect(c)
	--spsummon
	local e0=aux.AddThisCardInGraveAlreadyCheck(c)
	local e1=Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(114514509,0))
	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
	e1:SetCode(EVENT_TO_GRAVE)
	e1:SetRange(LOCATION_GRAVE)
	e1:SetCountLimit(1,114514509)
	e1:SetProperty(EFFECT_FLAG_DELAY)
	e1:SetLabelObject(e0)
	e1:SetCondition(c114514509.spcon)
	e1:SetTarget(c114514509.sptg)
	e1:SetOperation(c114514509.spop)
	c:RegisterEffect(e1)  
	--atkup
	local e2=Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(114514509,1))
	e2:SetCategory(CATEGORY_ATKCHANGE)
	e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
	e2:SetCountLimit(1,114514510)
	e2:SetCondition(c114514509.atkcon)
	e2:SetTarget(c114514509.target)
	e2:SetOperation(c114514509.operation)
	c:RegisterEffect(e2)  
end
function c114514509.cfilter(c,se)
	return c:IsType(TYPE_MONSTER) and c:IsPreviousLocation(LOCATION_MZONE)
		and (se==nil or c:GetReasonEffect()~=se)
end
function c114514509.spcon(e,tp,eg,ep,ev,re,r,rp)
	local se=e:GetLabelObject():GetLabelObject()
	return eg:IsExists(c114514509.cfilter,1,e:GetHandler(),se)
end
function c114514509.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
	local c=e:GetHandler()
	if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
		and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
	Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end
function c114514509.spop(e,tp,eg,ep,ev,re,r,rp)
	local c=e:GetHandler()
	if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end
	local e1=Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_FIELD)
	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
	e1:SetTargetRange(1,0)
	e1:SetTarget(c114514509.splim)
	e1:SetReset(RESET_PHASE+PHASE_END,2)
	Duel.RegisterEffect(e1,tp)
end
function c114514509.splim(e,c)
	return not c:IsRace(RACE_REPTILE)
end
function c114514509.mfilter(c)
	return c:IsFaceup() and c:IsRace(RACE_REPTILE)
end
function c114514509.mfilter1(c)
	return c:IsAttribute(ATTRIBUTE_DARK)
end
function c114514509.mfilter2(c)
	return c:IsAttribute(ATTRIBUTE_LIGHT)
end
function c114514509.fselect(g)
	return aux.gffcheck(g,c114514509.mfilter1,nil,c114514509.mfilter2,nil)
end
function c114514509.atkcon(e,tp,eg,ep,ev,re,r,rp)
	local g=Duel.GetMatchingGroup(c114514509.mfilter,tp,LOCATION_GRAVE,0,nil)
   return e:GetHandler():IsPreviousLocation(LOCATION_GRAVE) and g:CheckSubGroup(c114514509.fselect,2,2)
end 
function c114514509.target(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return true end
end
function c114514509.operation(e,tp,eg,ep,ev,re,r,rp)
	local c=e:GetHandler()
	local e1=Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_FIELD)
	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
	e1:SetCode(EFFECT_CANNOT_ACTIVATE)
	e1:SetTargetRange(0,1)
	e1:SetValue(c114514509.aclimit)
	e1:SetReset(RESET_PHASE+PHASE_END,2)
	Duel.RegisterEffect(e1,tp)
end
function c114514509.aclimit(e,re,tp)
	return re:GetActivateLocation()==LOCATION_GRAVE
end