[WIP] Garalon for 3.3.5a

I’m going to create new boss for 3.3.5a based on MoP boss Garalon. I will post my pieces of code to make sure that everything is fine and working and to make it better with you help. I’m new in c++ and just looking for some help.

This is how i start:

/*

  • Copyright © 2008-2012 TrinityCore http://www.trinitycore.org/
  • Copyright © 2011-2012 Darki73 https://github.com/darki73/
  • This program is free software; you can redistribute it and/or modify it
  • under the terms of the GNU General Public License as published by the
  • Free Software Foundation; either version 2 of the License, or (at your
  • option) any later version.
  • This program is distributed in the hope that it will be useful, but WITHOUT
  • ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  • FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  • more details.
  • You should have received a copy of the GNU General Public License along
  • with this program. If not, see http://www.gnu.org/licenses/.
    */

/* ScriptData
SDName: Garalon
SD%Complete: 0
SDComment: Boss from HoF for TC 3.3.5a
SDCategory: Heart of Fear
EndScriptData */

#include “ObjectMgr.h”
#include “ScriptMgr.h”
#include “ScriptedCreature.h”
#include “ScriptedGossip.h”
#include “Player.h”

enum Yells
{
SAY_AGGRO = -20000,
SAY_ON_KILL = -20001,
SAY_SPIT = -20002,
SAY_KNEEL = -20003,
SAY_BERSERK = -20004,
SAY_LEG_BROKEN = -20005,
SAY_TWO_LEGS_BROKEN = -20006,
SAY_THREE_LEGS_BROKEN = -20007,
SAY_FOUR_LEGS_BROKEN = -20008,
SAY_NO_LEGS = -20009,
SAY_PHASE = -,
SAY_EVADE = -,
};

enum Spells // Still looking for suitable spells for boss (suggest one if you have something)
{
// Garalon
SPELL_FURIOUS_SWIPE = ,
SPELL_FURY = ,
SPELL_CRUSH = ,
SPELL_PHEROMONES = ,
SPELL_PHEROMONE_TRAIL = ,
SPELL_WEAK_POINT = ,
SPELL_BERSERK = ,
SPELL_PLEASED = ,
};

enum MovementPoints
{
POINT_FLY_IN = 1,
POINT_LAND = 2,
POINT_AIR_PHASE = 3,
POINT_FLY_AWAY = 4,
};

Position const FlyPos = {0.0f, 0.0f, 0.0f, 0.0f};
Position const LandPos = {0.0f, 0.0f, 0.0f, 0.0f};
Position const AirPhasePos = {0.0f, 0.0f, 0.0f, 0.0f};
Position const FlyAwayPos = {0.0f, 0.0f, 0.0f, 0.0f};

enum Phases
{
PHASE_INTRO = 1, // Flyes from one place to another
PHASE_ONE = 2,
PHASE_TWO = ,
PHASE_THREE = ,
PHASE_FOUR = ,
PHASE_OUTRO = , // If HEROIC difficulty, he flews away (just in case if you want to add him somewhere later)
};

class boss_garalon : public CreatureScript
{
public:
boss_garalon() : CreatureScript(“boss_garalon”) {}

		struct boss_garalonAI : public BossAI
		{
			boss_garalonAI(Creature* creature) : BossAI(creature, DATA_GARALON)
			{
			}
			
			void Reset()
			{
				_Reset();
			}
			
			void EnterCombat(Unit* target)
			{
				DoZoneInCombat();
				
				events.SetPhase(PHASE_ONE);
				events.ScheduleEvent(EVENT_CHOOSE_FOR_PHEROMONES, urand(60000, 80000), 0, PHASE_ONE);
				
				if(IsHeroic())
					events.SchedueEvent(EVENT_FLY_AWAY, 720000, 0, PHASE_OUTRO);
					
			}
			
			void KilledUnit(Unit* victim)
			{
				if (victim->GetTypeId() == TYPEID_PLAYER)
					Talk(SAY_ON_KILL);
			}
			
			void ReceiveEmote(Player* /*player*/, uint32 uiTextEmote)
			{
				me->HandleEmoteCommand(uiTextEmote);

				switch (uiTextEmote)
				{
					case TEXT_EMOTE_SPIT:
						DoScriptText(SAY_SPIT, me);
						DoCast(me, SPELL_BERSERK);
                    break;
					case TEXT_EMOTE_KNEEL:
						DoScriptText(SAY_KNEEL, me);
						DoCast(me, SPELL_PLEASED);
                    break;
				}
			}
			
			void JustSummoned(Creature* summon)
			{
				switch (summon->GetEntry())
				{
					case EVENT_CHOOSE_FOR_PHEROMONES:
						Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
						DoCast(target, SPELL_PHEROMONES);
						events.ScheduleEvent(EVENT_CHOOSE_FOR_PHEROMONES, urand(60000, 80000), 0, PHASE_ONE);
						break;
					
					case PHEROMONES_CIRCLE:
						summons.Summon(summon);
					// Not finished yet	
				}
			}
			
			void DoAction(int32 const action)
			{
				switch (action)
				{
					case ACTION_ONE_LEG_BROKEN:
						Talk(SAY_LEG_BROKEN);
						if (!isHeroic)
						{
							me->SetSpeed(MOVE_WALK, _baseSpeed*0.8f, true);
						}
						else
						{
							me->SetSpeed(MOVE_WALK, _baseSpeed*0.6f, true);
						}
					break;
					
					case ACTION_TWO_LEGS_BROKEN:
						Talk(SAY_TWO_LEGS_BROKEN);
						if (!isHeroic)
						{
							me->SetSpeed(MOVE_WALK, _baseSpeed*0.7f, true);
						}
						else
						{
							me->SetSpeed(MOVE_WALK, _baseSpeed*0.6f, true);
						}
					break;
					
					case ACTION_THREE_LEGS_BROKEN:
						Talk(SAY_THREE_LEGS_BROKEN);
						if (!isHeroic)
						{
							me->SetSpeed(MOVE_WALK, _baseSpeed*0.4f, true);
						}
						else
						{
							me->SetSpeed(MOVE_WALK, _baseSpeed*0.2f, true);
						}
					break;
					
					case ACTION_FOUR_LEGS_BROKEN:
						Talk(SAY_FOUR_LEGS_BROKEN);
						me->SetSpeed(MOVE_WALK, _baseSpeed*0.0f, true);
						me->AttackStop();
						
						switch (_phase)
						{
							case PHASE_ONE:
								SetPhase(PHASE_TWO);
								Talk(SAY_NO_LEGS);
							break;
						}
					break;
				}
			} is it correct so far?

P.S. Emote handler added mostly for fun, because many players like to do some nasty stuff why they fighting with boss