Dinomist
Pendulum Scale = 3
[ Pendulum Effect ]
If another "Dinomist" card(s) you control would be destroyed by battle or an opponent's card effect, you can destroy this card instead.
----------------------------------------
[ Monster Effect ]
If all monsters you control are "Dinomist" monsters (min. 1), and none are "Dinomist Ceratops", you can Special Summon this card (from your hand).
local SETCARD_ID_0 = 0xd8 --Dinomist

local SETCARD_ID_0 = 0xd8 --Dinomist
local s, id, o = GetID()
function s.initial_effect(c)
	--pendulum summon
	aux.EnablePendulumAttribute(c)
	--destroy replace
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
	e2:SetCode(EFFECT_DESTROY_REPLACE)
	e2:SetRange(LOCATION_PZONE)
	e2:SetTarget(s.reptg)
	e2:SetValue(s.repval)
	e2:SetOperation(s.repop)
	c:RegisterEffect(e2)
	--special summon
	local e3 = Effect.CreateEffect(c)
	e3:SetType(EFFECT_TYPE_FIELD)
	e3:SetCode(EFFECT_SPSUMMON_PROC)
	e3:SetProperty(EFFECT_FLAG_UNCOPYABLE)
	e3:SetRange(LOCATION_HAND)
	e3:SetCondition(s.spcon)
	c:RegisterEffect(e3)
end
function s.filter(c, tp)
	return c:IsFaceup()
		and c:IsControler(tp)
		and c:IsOnField()
		and c:IsSetCard(SETCARD_ID_0)
		and (c:IsReason(REASON_BATTLE) or (c:IsReason(REASON_EFFECT) and c:GetReasonPlayer() == 1 - tp))
		and not c:IsReason(REASON_REPLACE)
end
function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
	local c = e:GetHandler()
	if chk == 0 then
		return eg:IsExists(s.filter, 1, c, tp) and c:IsDestructable(e) and not c:IsStatus(STATUS_DESTROY_CONFIRMED)
	end
	return Duel.SelectEffectYesNo(tp, c, 96)
end
function s.repval(e, c)
	return s.filter(c, e:GetHandlerPlayer())
end
function s.repop(e, tp, eg, ep, ev, re, r, rp)
	Duel.Destroy(e:GetHandler(), REASON_EFFECT + REASON_REPLACE)
end
function s.cfilter(c)
	return c:IsFacedown() or c:IsCode(id) or not c:IsSetCard(SETCARD_ID_0)
end
function s.spcon(e, c)
	if c == nil then
		return true
	end
	local tp = c:GetControler()
	return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
		and Duel.GetFieldGroupCount(c:GetControler(), LOCATION_MZONE, 0) > 0
		and not Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
end


Dinomist
Pendulum Scale = 3
[ Pendulum Effect ]
If another "Dinomist" card(s) you control would be destroyed by battle or an opponent's card effect, you can destroy this card instead.
----------------------------------------
[ Monster Effect ]
If all monsters you control are "Dinomist" monsters (min. 1), and none are "Dinomist Ceratops", you can Special Summon this card (from your hand).
-- Dinomist
local SETCARD_ID_0 = 0xd8 --Dinomist
local s, id, o = GetID()
function s.initial_effect(c)
	--pendulum summon
	aux.EnablePendulumAttribute(c)
	--destroy replace
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
	e2:SetCode(EFFECT_DESTROY_REPLACE)
	e2:SetRange(LOCATION_PZONE)
	e2:SetTarget(s.reptg)
	e2:SetValue(s.repval)
	e2:SetOperation(s.repop)
	c:RegisterEffect(e2)
	--special summon
	local e3 = Effect.CreateEffect(c)
	e3:SetType(EFFECT_TYPE_FIELD)
	e3:SetCode(EFFECT_SPSUMMON_PROC)
	e3:SetProperty(EFFECT_FLAG_UNCOPYABLE)
	e3:SetRange(LOCATION_HAND)
	e3:SetCondition(s.spcon)
	c:RegisterEffect(e3)
end
function s.filter(c, tp)
	return c:IsFaceup()
		and c:IsControler(tp)
		and c:IsOnField()
		and c:IsSetCard(SETCARD_ID_0)
		and (c:IsReason(REASON_BATTLE) or (c:IsReason(REASON_EFFECT) and c:GetReasonPlayer() == 1 - tp))
		and not c:IsReason(REASON_REPLACE)
end
function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
	local c = e:GetHandler()
	if chk == 0 then
		return eg:IsExists(s.filter, 1, c, tp) and c:IsDestructable(e) and not c:IsStatus(STATUS_DESTROY_CONFIRMED)
	end
	return Duel.SelectEffectYesNo(tp, c, 96)
end
function s.repval(e, c)
	return s.filter(c, e:GetHandlerPlayer())
end
function s.repop(e, tp, eg, ep, ev, re, r, rp)
	Duel.Destroy(e:GetHandler(), REASON_EFFECT + REASON_REPLACE)
end
function s.cfilter(c)
	return c:IsFacedown() or c:IsCode(id) or not c:IsSetCard(SETCARD_ID_0)
end
function s.spcon(e, c)
	if c == nil then
		return true
	end
	local tp = c:GetControler()
	return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
		and Duel.GetFieldGroupCount(c:GetControler(), LOCATION_MZONE, 0) > 0
		and not Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
end

