Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only when a Gemini monster that is treated as an Effect Monster is destroyed by battle. Destroy all monsters your opponent controls.
--二重の落とし穴
--Gemini Trap Hole
local s,id=GetID()
function s.initial_effect(c)
	--Activate
	local e1=Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_DESTROY)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_BATTLE_DESTROYED)
	e1:SetCondition(s.condition)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
	aux.GlobalCheck(s,function()
		local ge1=Effect.CreateEffect(c)
		ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
		ge1:SetCode(EVENT_BATTLED)
		ge1:SetOperation(s.checkop)
		Duel.RegisterEffect(ge1,0)
	end)
end
s.listed_card_types={TYPE_GEMINI}
function s.gmreg(c)
	if c and c:IsGeminiStatus() and c:IsStatus(STATUS_BATTLE_DESTROYED) then
		c:RegisterFlagEffect(id,RESET_PHASE|PHASE_DAMAGE,0,1)
	end
end
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
	s.gmreg(Duel.GetAttacker())
	s.gmreg(Duel.GetAttackTarget())
end
function s.filter(c)
	return c:GetFlagEffect(id)~=0
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
	return eg:IsExists(s.filter,1,nil)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
	local g=Duel.GetMatchingGroup(nil,tp,0,LOCATION_MZONE,nil)
	if chk==0 then return #g>0 end
	Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
	local g=Duel.GetMatchingGroup(nil,tp,0,LOCATION_MZONE,nil)
	if #g>0 then
		Duel.Destroy(g,REASON_EFFECT)
	end
end