Ojama
If this card is sent from the hand or field to the GY: You can activate this effect; each player draws 1 card, then each player discards 1 card, then, if you discarded an "Ojama" card, you can choose 1 opponent's unused Monster Zone, and it cannot be used until the end of your opponent's turn. You can only use this effect of "Ojama Pink" once per turn.
local SETCARD_ID_0 = 0xf --Ojama

local SETCARD_ID_0 = 0xf --Ojama
local s, id, o = GetID()
function s.initial_effect(c)
	--draw
	local e1 = Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(id, 1))
	e1:SetCategory(CATEGORY_HANDES + CATEGORY_DRAW)
	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DELAY)
	e1:SetCode(EVENT_TO_GRAVE)
	e1:SetCountLimit(1, id)
	e1:SetCondition(s.thcon)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
end
function s.thcon(e, tp, eg, ep, ev, re, r, rp)
	return e:GetHandler():IsPreviousLocation(LOCATION_HAND + LOCATION_ONFIELD)
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsPlayerCanDraw(tp, 1) and Duel.IsPlayerCanDraw(1 - tp, 1)
	end
	Duel.SetOperationInfo(0, CATEGORY_HANDES, nil, 0, PLAYER_ALL, 1)
	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, PLAYER_ALL, 1)
end
function s.activate(e, tp, eg, ep, ev, re, r, rp)
	local h1 = Duel.Draw(tp, 1, REASON_EFFECT)
	local h2 = Duel.Draw(1 - tp, 1, REASON_EFFECT)
	if h1 > 0 or h2 > 0 then
		Duel.BreakEffect()
	end
	local groundcollapse = false
	if h1 > 0 then
		Duel.ShuffleHand(tp)
		Duel.DiscardHand(tp, aux.TRUE, 1, 1, REASON_EFFECT + REASON_DISCARD)
		local dc = Duel.GetOperatedGroup():GetFirst()
		if dc:IsSetCard(SETCARD_ID_0) then
			groundcollapse = true
		end
	end
	if h2 > 0 then
		Duel.ShuffleHand(1 - tp)
		Duel.DiscardHand(1 - tp, aux.TRUE, 1, 1, REASON_EFFECT + REASON_DISCARD)
	end
	if groundcollapse and Duel.GetLocationCount(1 - tp, LOCATION_MZONE) > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
		Duel.BreakEffect()
		local zone = Duel.SelectDisableField(tp, 1, 0, LOCATION_MZONE, 0)
		if tp == 1 then
			zone = ((zone & 0xffff) << 16) | ((zone >> 16) & 0xffff)
		end
		local e1 = Effect.CreateEffect(e:GetHandler())
		e1:SetType(EFFECT_TYPE_FIELD)
		e1:SetCode(EFFECT_DISABLE_FIELD)
		e1:SetValue(zone)
		e1:SetReset(RESET_PHASE + PHASE_END + RESET_OPPO_TURN)
		Duel.RegisterEffect(e1, tp)
	end
end


Ojama
If this card is sent from the hand or field to the GY: You can activate this effect; each player draws 1 card, then each player discards 1 card, then, if you discarded an "Ojama" card, you can choose 1 opponent's unused Monster Zone, and it cannot be used until the end of your opponent's turn. You can only use this effect of "Ojama Pink" once per turn.
-- Ojama
local SETCARD_ID_0 = 0xf --Ojama
local s, id, o = GetID()
function s.initial_effect(c)
	--draw
	local e1 = Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(id, 1))
	e1:SetCategory(CATEGORY_HANDES + CATEGORY_DRAW)
	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DELAY)
	e1:SetCode(EVENT_TO_GRAVE)
	e1:SetCountLimit(1, id)
	e1:SetCondition(s.thcon)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
end
function s.thcon(e, tp, eg, ep, ev, re, r, rp)
	return e:GetHandler():IsPreviousLocation(LOCATION_HAND + LOCATION_ONFIELD)
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsPlayerCanDraw(tp, 1) and Duel.IsPlayerCanDraw(1 - tp, 1)
	end
	Duel.SetOperationInfo(0, CATEGORY_HANDES, nil, 0, PLAYER_ALL, 1)
	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, PLAYER_ALL, 1)
end
function s.activate(e, tp, eg, ep, ev, re, r, rp)
	local h1 = Duel.Draw(tp, 1, REASON_EFFECT)
	local h2 = Duel.Draw(1 - tp, 1, REASON_EFFECT)
	if h1 > 0 or h2 > 0 then
		Duel.BreakEffect()
	end
	local groundcollapse = false
	if h1 > 0 then
		Duel.ShuffleHand(tp)
		Duel.DiscardHand(tp, aux.TRUE, 1, 1, REASON_EFFECT + REASON_DISCARD)
		local dc = Duel.GetOperatedGroup():GetFirst()
		if dc:IsSetCard(SETCARD_ID_0) then
			groundcollapse = true
		end
	end
	if h2 > 0 then
		Duel.ShuffleHand(1 - tp)
		Duel.DiscardHand(1 - tp, aux.TRUE, 1, 1, REASON_EFFECT + REASON_DISCARD)
	end
	if groundcollapse and Duel.GetLocationCount(1 - tp, LOCATION_MZONE) > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
		Duel.BreakEffect()
		local zone = Duel.SelectDisableField(tp, 1, 0, LOCATION_MZONE, 0)
		if tp == 1 then
			zone = ((zone & 0xffff) << 16) | ((zone >> 16) & 0xffff)
		end
		local e1 = Effect.CreateEffect(e:GetHandler())
		e1:SetType(EFFECT_TYPE_FIELD)
		e1:SetCode(EFFECT_DISABLE_FIELD)
		e1:SetValue(zone)
		e1:SetReset(RESET_PHASE + PHASE_END + RESET_OPPO_TURN)
		Duel.RegisterEffect(e1, tp)
	end
end

