Crimson
Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by revealing 3 other "Cubic" cards in your hand with different names, and cannot be Special Summoned by other ways. Unaffected by other monsters' activated effects, whose original ATK is 3000 or less. When this attacking card destroys a monster by battle: You can activate this effect; this card can make a second attack during this Battle Phase. During your End Phase: Each player takes 3000 damage. You can only use this effect of "Crimson Nova the Dark Cubic Lord" once per turn.
local SETCARD_ID_0 = 0xe3 --Cubic

local SETCARD_ID_0 = 0xe3 --Cubic
local s, id, o = GetID()
function s.initial_effect(c)
	c:EnableReviveLimit()
	--cannot special summon
	local e1 = Effect.CreateEffect(c)
	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
	e1:SetType(EFFECT_TYPE_SINGLE)
	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
	c:RegisterEffect(e1)
	--special summon
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_FIELD)
	e2:SetCode(EFFECT_SPSUMMON_PROC)
	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
	e2:SetRange(LOCATION_HAND)
	e2:SetCondition(s.spcon)
	e2:SetTarget(s.sptg)
	e2:SetOperation(s.spop)
	c:RegisterEffect(e2)
	--immune
	local e3 = Effect.CreateEffect(c)
	e3:SetType(EFFECT_TYPE_SINGLE)
	e3:SetCode(EFFECT_IMMUNE_EFFECT)
	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
	e3:SetRange(LOCATION_MZONE)
	e3:SetValue(s.immval)
	c:RegisterEffect(e3)
	--Extra Attack
	local e4 = Effect.CreateEffect(c)
	e4:SetDescription(aux.Stringid(id, 0))
	e4:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e4:SetCode(EVENT_BATTLE_DESTROYING)
	e4:SetCondition(s.atkcon)
	e4:SetTarget(s.atktg)
	e4:SetOperation(s.atkop)
	c:RegisterEffect(e4)
	--Damage
	local e5 = Effect.CreateEffect(c)
	e5:SetDescription(aux.Stringid(id, 1))
	e5:SetCategory(CATEGORY_DAMAGE)
	e5:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
	e5:SetCode(EVENT_PHASE + PHASE_END)
	e5:SetRange(LOCATION_MZONE)
	e5:SetCountLimit(1, id)
	e5:SetCondition(s.damcon)
	e5:SetTarget(s.damtg)
	e5:SetOperation(s.damop)
	c:RegisterEffect(e5)
end
function s.spcfilter(c)
	return c:IsSetCard(SETCARD_ID_0) and not c:IsPublic()
end
function s.spcon(e, c)
	if c == nil then
		return true
	end
	local tp = c:GetControler()
	local hg = Duel.GetMatchingGroup(s.spcfilter, tp, LOCATION_HAND, 0, c)
	return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and hg:GetClassCount(Card.GetCode) >= 3
end
function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
	local g = Duel.GetMatchingGroup(s.spcfilter, tp, LOCATION_HAND, 0, c)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
	aux.GCheckAdditional = aux.dncheck
	local sg = g:SelectSubGroup(tp, aux.TRUE, true, 3, 3)
	aux.GCheckAdditional = nil
	if sg then
		sg:KeepAlive()
		e:SetLabelObject(sg)
		return true
	else
		return false
	end
end
function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
	local rg = e:GetLabelObject()
	Duel.ConfirmCards(1 - tp, rg)
	Duel.ShuffleHand(tp)
	rg:DeleteGroup()
end
function s.immval(e, te)
	return te:GetOwner() ~= e:GetHandler() and te:IsActiveType(TYPE_MONSTER) and te:IsActivated() and te:GetOwner():GetBaseAttack() <= 3000 and te:GetOwner():GetBaseAttack() >= 0
end
function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
	return Duel.GetAttacker() == e:GetHandler() and aux.bdcon(e, tp, eg, ep, ev, re, r, rp)
end
function s.atktg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return e:GetHandler():IsRelateToBattle() and not e:GetHandler():IsHasEffect(EFFECT_EXTRA_ATTACK)
	end
end
function s.atkop(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	if not c:IsRelateToBattle() then
		return
	end
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_SINGLE)
	e1:SetCode(EFFECT_EXTRA_ATTACK)
	e1:SetValue(1)
	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_BATTLE)
	c:RegisterEffect(e1)
end
function s.damcon(e, tp, eg, ep, ev, re, r, rp)
	return Duel.GetTurnPlayer() == tp
end
function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return true
	end
	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, PLAYER_ALL, 3000)
end
function s.damop(e, tp, eg, ep, ev, re, r, rp)
	Duel.Damage(tp, 3000, REASON_EFFECT, true)
	Duel.Damage(1 - tp, 3000, REASON_EFFECT, true)
	Duel.RDComplete()
end


Crimson
Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by revealing 3 other "Cubic" cards in your hand with different names, and cannot be Special Summoned by other ways. Unaffected by other monsters' activated effects, whose original ATK is 3000 or less. When this attacking card destroys a monster by battle: You can activate this effect; this card can make a second attack during this Battle Phase. During your End Phase: Each player takes 3000 damage. You can only use this effect of "Crimson Nova the Dark Cubic Lord" once per turn.
-- Crimson
local SETCARD_ID_0 = 0xe3 --Cubic
local s, id, o = GetID()
function s.initial_effect(c)
	c:EnableReviveLimit()
	--cannot special summon
	local e1 = Effect.CreateEffect(c)
	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
	e1:SetType(EFFECT_TYPE_SINGLE)
	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
	c:RegisterEffect(e1)
	--special summon
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_FIELD)
	e2:SetCode(EFFECT_SPSUMMON_PROC)
	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
	e2:SetRange(LOCATION_HAND)
	e2:SetCondition(s.spcon)
	e2:SetTarget(s.sptg)
	e2:SetOperation(s.spop)
	c:RegisterEffect(e2)
	--immune
	local e3 = Effect.CreateEffect(c)
	e3:SetType(EFFECT_TYPE_SINGLE)
	e3:SetCode(EFFECT_IMMUNE_EFFECT)
	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
	e3:SetRange(LOCATION_MZONE)
	e3:SetValue(s.immval)
	c:RegisterEffect(e3)
	--Extra Attack
	local e4 = Effect.CreateEffect(c)
	e4:SetDescription(aux.Stringid(id, 0))
	e4:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e4:SetCode(EVENT_BATTLE_DESTROYING)
	e4:SetCondition(s.atkcon)
	e4:SetTarget(s.atktg)
	e4:SetOperation(s.atkop)
	c:RegisterEffect(e4)
	--Damage
	local e5 = Effect.CreateEffect(c)
	e5:SetDescription(aux.Stringid(id, 1))
	e5:SetCategory(CATEGORY_DAMAGE)
	e5:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
	e5:SetCode(EVENT_PHASE + PHASE_END)
	e5:SetRange(LOCATION_MZONE)
	e5:SetCountLimit(1, id)
	e5:SetCondition(s.damcon)
	e5:SetTarget(s.damtg)
	e5:SetOperation(s.damop)
	c:RegisterEffect(e5)
end
function s.spcfilter(c)
	return c:IsSetCard(SETCARD_ID_0) and not c:IsPublic()
end
function s.spcon(e, c)
	if c == nil then
		return true
	end
	local tp = c:GetControler()
	local hg = Duel.GetMatchingGroup(s.spcfilter, tp, LOCATION_HAND, 0, c)
	return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and hg:GetClassCount(Card.GetCode) >= 3
end
function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
	local g = Duel.GetMatchingGroup(s.spcfilter, tp, LOCATION_HAND, 0, c)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
	aux.GCheckAdditional = aux.dncheck
	local sg = g:SelectSubGroup(tp, aux.TRUE, true, 3, 3)
	aux.GCheckAdditional = nil
	if sg then
		sg:KeepAlive()
		e:SetLabelObject(sg)
		return true
	else
		return false
	end
end
function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
	local rg = e:GetLabelObject()
	Duel.ConfirmCards(1 - tp, rg)
	Duel.ShuffleHand(tp)
	rg:DeleteGroup()
end
function s.immval(e, te)
	return te:GetOwner() ~= e:GetHandler() and te:IsActiveType(TYPE_MONSTER) and te:IsActivated() and te:GetOwner():GetBaseAttack() <= 3000 and te:GetOwner():GetBaseAttack() >= 0
end
function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
	return Duel.GetAttacker() == e:GetHandler() and aux.bdcon(e, tp, eg, ep, ev, re, r, rp)
end
function s.atktg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return e:GetHandler():IsRelateToBattle() and not e:GetHandler():IsHasEffect(EFFECT_EXTRA_ATTACK)
	end
end
function s.atkop(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	if not c:IsRelateToBattle() then
		return
	end
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_SINGLE)
	e1:SetCode(EFFECT_EXTRA_ATTACK)
	e1:SetValue(1)
	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_BATTLE)
	c:RegisterEffect(e1)
end
function s.damcon(e, tp, eg, ep, ev, re, r, rp)
	return Duel.GetTurnPlayer() == tp
end
function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return true
	end
	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, PLAYER_ALL, 3000)
end
function s.damop(e, tp, eg, ep, ev, re, r, rp)
	Duel.Damage(tp, 3000, REASON_EFFECT, true)
	Duel.Damage(1 - tp, 3000, REASON_EFFECT, true)
	Duel.RDComplete()
end

