"Attention pavé"
/* Copyright (C) 2006 - 2010 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* ScriptData
SDName: boss_lord_marrowgar
SD%Complete: 20%
SDComment: Bones spikes scripting are in mob_bone_spike.cpp
SDCategory: Icecrown Citadel
SDAuthor: Me
EndScriptData */
#include "precompiled.h"
#include "instance_icecrown_citadel.h"
enum {
SAY_INTRO = -1631000,
SAY_AGGRO = -1631001,
SAY_BONESTORM = -1631002,
SAY_BONESPIKE1 = -1631003,
SAY_BONESPIKE2 = -1631004,
SAY_BONESPIKE3 = -1631005,
SAY_KILL1 = -1631006,
SAY_KILL2 = -1631007,
SAY_ENRAGE = -1631008,
SAY_DEATH = -1631009,
SPELL_IMPALED = 69065,
SPELL_BONE_STORM_10N = 69075,
SPELL_BONE_STORM_10H = 70835,
SPELL_BONE_STORM_25N = 70835,
SPELL_BONE_STORM_25H = 70836,
SPELL_BONE_STORM_VIS = 69076,
SPELL_BONE_SLICE_10N = 69055,
SPELL_BONE_SLICE_10H = 69055,
SPELL_BONE_SLICE_25N = 70814,
SPELL_BONE_SLICE_25H = 70814,
SPELL_COLD_FLAME_10N = 69146,
SPELL_COLD_FLAME_10H = 70824,
SPELL_COLD_FLAME_25N = 70823,
SPELL_COLD_FLAME_25H = 70825,
SPELL_ENRAGE = 26662,
SUMMON_BONE_SPIKE = 38711,
SUMMON_COLD_FLAME = 36672
};
struct MANGOS_DLL_DECL boss_marrowgarAI : public ScriptedAI
{
void SelectSpellsAccordingToMode(Difficulty Mode)
{
switch (Mode)
{
case RAID_DIFFICULTY_10MAN_NORMAL:
m_BONE_SLICE_USE = SPELL_BONE_SLICE_10N;
m_BONE_STORM_USE = SPELL_BONE_STORM_10N;
m_COLD_FLAME_USE = SPELL_COLD_FLAME_10N;
BoneSpikeWhenBoneStorming = false;
break;
case RAID_DIFFICULTY_10MAN_HEROIC:
m_BONE_SLICE_USE = SPELL_BONE_SLICE_10H;
m_BONE_STORM_USE = SPELL_BONE_STORM_10H;
m_COLD_FLAME_USE = SPELL_COLD_FLAME_10H;
BoneSpikeWhenBoneStorming = true;
break;
case RAID_DIFFICULTY_25MAN_NORMAL:
m_BONE_SLICE_USE = SPELL_BONE_SLICE_25N;
m_BONE_STORM_USE = SPELL_BONE_STORM_25N;
m_COLD_FLAME_USE = SPELL_COLD_FLAME_25N;
BoneSpikeWhenBoneStorming = false;
break;
case RAID_DIFFICULTY_25MAN_HEROIC:
m_BONE_SLICE_USE = SPELL_BONE_SLICE_25H;
m_BONE_STORM_USE = SPELL_BONE_STORM_25H;
m_COLD_FLAME_USE = SPELL_COLD_FLAME_25H;
BoneSpikeWhenBoneStorming = true;
break;
}
}
boss_marrowgarAI(Creature* pCreature) : ScriptedAI(pCreature)
{
m_pInstance = (ScriptedInstance*)pCreature->GetInstanceData();
m_bDifficulty = pCreature->GetMap()->GetDifficulty();
SelectSpellsAccordingToMode(m_bDifficulty);
Reset();
}
ScriptedInstance* m_pInstance;
Difficulty m_bDifficulty;
bool IntroText;
bool AggroText;
bool BoneSpikeWhenBoneStorming;
bool BoneStorming;
//timers
uint32 m_uiBoneSpikeTimer; // 90 secondes
uint32 m_uiBoneStormTimer; // 30 secondes
uint32 m_uiColdFlameTimer; // 15 secondes
uint32 m_uiBoneSliceTimer; // 1 seconde
uint32 m_uiBerserkTimer; // 10 minutes
//Spell Vars
uint32 m_BONE_SLICE_USE;
uint32 m_BONE_STORM_USE;
uint32 m_COLD_FLAME_USE;
void Reset()
{
uint32 m_uiBoneSpikeTimer = 90000; // Every 1 min 30
uint32 m_uiBoneStormTimer = 45000; // Every 30 secondes
uint32 m_uiColdFlameTimer = 15000; // Every 15 secondes
uint32 m_uiBoneSliceTimer = 1000; // Every second
uint32 m_uiBerserkTimer = 600000;
IntroText = true;
AggroText = true;
if (m_creature->isAlive()) m_pInstance->SetData(TYPE_MARROWGAR, NOT_STARTED);
}
void JustSummoned(Creature* summoned)
{
if(!m_pInstance || !summoned) return;
summoned->SetCreatorGuid(m_creature->GetObjectGuid());
}
void Aggro(Unit* pWho)
{
if(AggroText)
{
DoScriptText(SAY_AGGRO, m_creature);
AggroText = false;
}
if (m_pInstance)
m_pInstance->SetData(TYPE_MARROWGAR, IN_PROGRESS);
}
void JustDied(Unit* pKiller)
{
DoScriptText(SAY_DEATH, m_creature);
if (m_pInstance)
m_pInstance->SetData(TYPE_MARROWGAR, DONE);
}
void JustReachedHome()
{
if (m_pInstance)
{
m_pInstance->SetData(TYPE_MARROWGAR, FAIL);
}
}
void KilledUnit(Unit* pVictim)
{
switch(urand(0, 1))
{
case 0: DoScriptText(SAY_KILL1, m_creature); break;
case 1: DoScriptText(SAY_KILL2, m_creature); break;
}
}
void MoveInLineOfSight(Unit* pWho)
{
if (IntroText && m_creature->IsWithinDistInMap(pWho, 100.0f))
{
DoScriptText(SAY_INTRO, m_creature);
IntroText = false;
}
}
//Hackish function to implement bone spikes since currently the spell is bugged. Whe have to pop a bone spike, make it attack a player, and
// add the Impaled debuff te the player.
void doSummonSpike(Unit* pTarget)
{
if (!pTarget || !pTarget->isAlive()) return;
float fPosX, fPosY, fPosZ;
pTarget->GetPosition(fPosX, fPosY, fPosZ);
if (Unit* pSpike = m_creature->SummonCreature(SUMMON_BONE_SPIKE, fPosX, fPosY, fPosZ + 0.5f, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 900000))
{
pSpike->SetOwnerGuid(m_creature->GetObjectGuid());
pSpike->SetInCombatWith(pTarget);
pSpike->AddThreat(pTarget, 1000.0f);
switch(urand(0,2))
{
case 0: DoScriptText(SAY_BONESPIKE1, m_creature);break;
case 1: DoScriptText(SAY_BONESPIKE2, m_creature);break;
case 2: DoScriptText(SAY_BONESPIKE3, m_creature);break;
}
}
}
void doSummonColdFlameMob(float PosX, float PosY, float PosZ)
{
if (Unit* pSpike = m_creature->SummonCreature(SUMMON_COLD_FLAME, PosX, PosY, PosZ, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 900000))
{
pSpike->SetOwnerGuid(m_creature->GetObjectGuid());
}
}
void UpdateAI(const uint32 uiDiff)
{
//Do nothing if there is no target
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
/*if(m_uiBoneStormTimer < uiDiff)
{
BoneStorming = true;
m_creature->CastSpell(m_creature, SPELL_BONE_STORM_VIS, true);
m_creature->SetSpeedRate(MOVE_RUN, 10);
m_creature->SetSpeedRate(MOVE_WALK, 10);
m_creature->SetSpeedRate(MOVE_RUN_BACK, 10);
}
else
{
m_uiBoneStormTimer -= uiDiff;
BoneStorming = false;
}*/
// Check if it is time to bone spike a player
if (m_uiBoneSpikeTimer < uiDiff)
{
if(Unit* randomTargetToBS = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1))
{
// No bonespike if normal bonestorming
if(!BoneStorming)
{
doSummonSpike(randomTargetToBS);
// If there is an issue with the bone spike, refer to mob_bone_spike.cpp
}
m_uiBoneSpikeTimer = 90000;
}
}
else
m_uiBoneSpikeTimer -= uiDiff;
//Check for the berserck
/*if (m_uiBerserkTimer < uiDiff)
{
m_creature->CastSpell(m_creature, SPELL_ENRAGE, true);
//150% moving speed
m_creature->SetSpeedRate(MOVE_RUN, 10);
m_creature->SetSpeedRate(MOVE_WALK, 10);
m_creature->SetSpeedRate(MOVE_RUN_BACK, 10);
m_uiBerserkTimer = 600000;
}
else
{
m_uiBerserkTimer -= uiDiff;
}*/
//Now, it is time to work out the Cold Flame !
//We have to summon four of them, make them walk and each ?? meter, cast the cold flame spell.
//Ofc, they will be despawned
//So summoning them is here, and the spell is in their AI
// STAGE 1 : Summon them
// They have to be near marrowgar.
// First we have to get the coordinates of Marrowgar.
float MarrowgarX, MarrowgarY, MarrowgarZ;
m_creature->GetPosition(MarrowgarX, MarrowgarY, MarrowgarZ);
// Now, we have to see the radius of is target zone. (This is done ingame)
// Note it has nothing to do with the hitbox. It's just the red circle on the ground around him, plus a few meters.
// Computed value : 13
// Now, we have to select an angle between 0 and 90 degrees.
float angleFirst = urand(0,90)*M_PI/180;
// According to this angle, we determine the coordinates, using sin and cos and adding the result to Marrowgar's coords
float CFlameX = cos(angleFirst) * 13 + MarrowgarX; // This is the origin X
float CFlameY = sin(angleFirst) * 13 + MarrowgarY; // This is the origin Y
float CFlameZ = 0.05f + MarrowgarX; // Add some Z in case of undermap
// Summon it
doSummonColdFlameMob(CFlameX, CFlameY, CFlameZ);
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_boss_lord_marrowgar(Creature* pCreature)
{
return new boss_marrowgarAI(pCreature);
}
void AddSC_boss_lord_marrowgar()
{
Script* pNewScript;
pNewScript = new Script;
pNewScript->Name = "boss_lord_marrowgar";
pNewScript->GetAI = &GetAI_boss_lord_marrowgar;
pNewScript->RegisterSelf();
}