local Halazzi = DBM:NewBossMod("Halazzi", DBM_HALAZZI_NAME, DBM_HALAZZI_DESCRIPTION, DBM_ZULAMAN, DBM_ZULAMAN_TAB, 4);

Halazzi.Version	= "1.0";
Halazzi.Author	= "Tandanu";

local counter = 0;

Halazzi:RegisterEvents(
	"CHAT_MSG_MONSTER_YELL",
	"SPELL_AURA_APPLIED",
	"SPELL_CAST_START",
	"SPELL_SUMMON"
)

Halazzi:RegisterCombat("YELL", DBM_HALAZZI_YELL_PULL)

Halazzi:AddOption("Frenzy", true, DBM_HALAZZI_OPTION_FRENZY)
Halazzi:AddOption("Totem", true, DBM_HALAZZI_OPTION_TOTEM)

Halazzi:AddBarOption("Totem")

function Halazzi:OnCombatStart()
	counter = 0;
end

function Halazzi:OnCombatEnd()
	counter = 0;
end

function Halazzi:OnEvent(event, arg1)
	if event == "CHAT_MSG_MONSTER_YELL" then
		if arg1 == DBM_HALAZZI_YELL_SPIRIT then
			self:StartStatusBarTimer(13, "Totem", "Interface\\Icons\\Inv_Waepon_Bow_Zulgrub_d_02")
			self:Announce(DBM_HALAZZI_WARN_SPIRIT, 1)
		elseif arg1 == DBM_HALAZZI_YELL_SPIRIT_DESP then
			self:Announce(DBM_HALAZZI_WARN_SPIRIT_DESP, 1)
			counter = counter + 1;
			self:EndStatusBarTimer("Totem");
			if counter == 3 then
				self:StartStatusBarTimer(13, "Totem", "Interface\\Icons\\Inv_Waepon_Bow_Zulgrub_d_02");
			end
		end
	elseif event == "SPELL_CAST_START" then
		if arg1.spellId == DBM_HALAZZI_SPELLID_TOTEM and self.Options.Totem then
			self:Announce(DBM_HALAZZI_WARN_TOTEM, 2)
		end
	elseif event == "SPELL_SUMMON" then
		if arg1.spellId == 43302 then
			self:StartStatusBarTimer(20, "Totem", "Interface\\Icons\\Inv_Waepon_Bow_Zulgrub_d_02")
		end
	elseif event == "SPELL_AURA_APPLIED" then
		if arg1.spellId == 43139 then
			self:Announce(DBM_HALAZZI_WARN_FRENZY, 3)
		end
	end	
end
