Merge pull request #8755 from krofna/crofixes

Script/AQ: Implement Buru the Gorger
This commit is contained in:
blub
2013-01-07 14:04:53 -08:00
3 changed files with 260 additions and 11 deletions

View File

@@ -0,0 +1,23 @@
UPDATE `creature_template` SET ScriptName='npc_buru_egg' WHERE entry=15514;
UPDATE `creature_template` SET `faction_A`=16,`faction_H`=16 WHERE `entry` IN (15514,15370);
DELETE FROM `creature` WHERE `id`=15521; -- because **** you, thats why
SET @GUID :=xxx; -- Change me plz
DELETE FROM `creature` WHERE `id`=15514;
INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `MovementType`) VALUES
(@GUID, 15514, 509, 1, 1, -9270.393, 1243.896, -63.76731, 2.722714, 7200, 0, 0),
(@GUID+1, 15514, 509, 1, 1, -9300.067, 1305.085, -63.69709, 4.18879, 7200, 0, 0),
(@GUID+2, 15514, 509, 1, 1, -9263.014, 1295.236, -63.80813, 1.797689, 7200, 0, 0),
(@GUID+3, 15514, 509, 1, 1, -9243.427, 1280.498, -63.59377, 3.822271, 7200, 0, 0),
(@GUID+4, 15514, 509, 1, 1, -9234.326, 1243.826, -63.52806, 3.490659, 7200, 0, 0),
(@GUID+5, 15514, 509, 1, 1, -9300.189, 1266.665, -63.74272, 0.2617994, 7200, 0, 0);
DELETE FROM `linked_respawn` WHERE `linkedGuid`=90873;
INSERT INTO `linked_respawn` (`guid`, `linkedGuid`, `linkType`) VALUES
(@GUID, 90873, 0),
(@GUID+1, 90873, 0),
(@GUID+2, 90873, 0),
(@GUID+3, 90873, 0),
(@GUID+4, 90873, 0),
(@GUID+5, 90873, 0);
DELETE FROM `spell_script_names` WHERE `spell_id`=19593;
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(19593, 'spell_egg_explosion');

View File

@@ -16,20 +16,48 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Boss_Buru
SD%Complete: 0
SDComment: Place Holder
SDCategory: Ruins of Ahn'Qiraj
EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "ruins_of_ahnqiraj.h"
enum Yells
enum Emotes
{
EMOTE_TARGET = 0
EMOTE_TARGET = 0
};
enum Spells
{
SPELL_CREEPING_PLAGUE = 20512,
SPELL_DISMEMBER = 96,
SPELL_GATHERING_SPEED = 1834,
SPELL_FULL_SPEED = 1557,
SPELL_THORNS = 25640,
SPELL_BURU_TRANSFORM = 24721,
SPELL_SUMMON_HATCHLING = 1881,
SPELL_EXPLODE = 19593,
SPELL_EXPLODE_2 = 5255,
SPELL_BURU_EGG_TRIGGER = 26646
};
enum Events
{
EVENT_DISMEMBER = 0,
EVENT_GATHERING_SPEED = 1,
EVENT_FULL_SPEED = 2,
EVENT_CREEPING_PLAGUE = 3,
EVENT_RESPAWN_EGG = 4
};
enum Phases
{
PHASE_EGG = 0,
PHASE_TRANSFORM = 1
};
enum Actions
{
ACTION_EXPLODE = 0
};
class boss_buru : public CreatureScript
@@ -37,11 +65,125 @@ class boss_buru : public CreatureScript
public:
boss_buru() : CreatureScript("boss_buru") { }
struct boss_buruAI : public ScriptedAI
struct boss_buruAI : public BossAI
{
boss_buruAI(Creature* creature) : ScriptedAI(creature)
boss_buruAI(Creature* creature) : BossAI(creature, DATA_BURU)
{
}
void EnterEvadeMode()
{
BossAI::EnterEvadeMode();
for (std::list<uint64>::iterator i = Eggs.begin(); i != Eggs.end(); ++i)
if (Creature* egg = me->GetMap()->GetCreature(*Eggs.begin()))
egg->Respawn();
Eggs.clear();
}
void EnterCombat(Unit* who)
{
_EnterCombat();
Talk(EMOTE_TARGET, who->GetGUID());
DoCast(me, SPELL_THORNS);
events.ScheduleEvent(EVENT_DISMEMBER, 5000);
events.ScheduleEvent(EVENT_GATHERING_SPEED, 9000);
events.ScheduleEvent(EVENT_FULL_SPEED, 60000);
_phase = PHASE_EGG;
}
void DoAction(int32 const action)
{
if (action == ACTION_EXPLODE)
if (_phase == PHASE_EGG)
me->DealDamage(me, 45000);
}
void KilledUnit(Unit* victim)
{
if (victim->GetTypeId() == TYPEID_PLAYER)
ChaseNewVictim();
}
void ChaseNewVictim()
{
if (_phase != PHASE_EGG)
return;
me->RemoveAurasDueToSpell(SPELL_FULL_SPEED);
me->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED);
events.ScheduleEvent(EVENT_GATHERING_SPEED, 9000);
events.ScheduleEvent(EVENT_FULL_SPEED, 60000);
if (Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
{
DoResetThreat();
AttackStart(victim);
Talk(EMOTE_TARGET, victim->GetGUID());
}
}
void ManageRespawn(uint64 EggGUID)
{
ChaseNewVictim();
Eggs.push_back(EggGUID);
events.ScheduleEvent(EVENT_RESPAWN_EGG, 100000);
}
void UpdateAI(uint32 const diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_DISMEMBER:
DoCastVictim(SPELL_DISMEMBER);
events.ScheduleEvent(EVENT_DISMEMBER, 5000);
break;
case EVENT_GATHERING_SPEED:
DoCast(me, SPELL_GATHERING_SPEED);
events.ScheduleEvent(EVENT_GATHERING_SPEED, 9000);
break;
case EVENT_FULL_SPEED:
DoCast(me, SPELL_FULL_SPEED);
break;
case EVENT_CREEPING_PLAGUE:
DoCast(me, SPELL_CREEPING_PLAGUE);
events.ScheduleEvent(EVENT_CREEPING_PLAGUE, 6000);
break;
case EVENT_RESPAWN_EGG:
if (Creature* egg = me->GetMap()->GetCreature(*Eggs.begin()))
{
egg->Respawn();
Eggs.pop_front();
}
break;
default:
break;
}
}
if (me->GetHealthPct() < 20.0f && _phase == PHASE_EGG)
{
DoCast(me, SPELL_BURU_TRANSFORM); // Enrage
DoCast(me, SPELL_FULL_SPEED, true);
me->RemoveAurasDueToSpell(SPELL_THORNS);
_phase = PHASE_TRANSFORM;
}
DoMeleeAttackIfReady();
}
private:
uint8 _phase;
std::list<uint64> Eggs;
};
CreatureAI* GetAI(Creature* creature) const
@@ -50,7 +192,90 @@ class boss_buru : public CreatureScript
}
};
class npc_buru_egg : public CreatureScript
{
public:
npc_buru_egg() : CreatureScript("npc_buru_egg") { }
struct npc_buru_eggAI : public Scripted_NoMovementAI
{
npc_buru_eggAI(Creature* creature) : Scripted_NoMovementAI(creature)
{
_instance = me->GetInstanceScript();
}
void EnterCombat(Unit* attacker)
{
if (Creature* buru = me->GetMap()->GetCreature(_instance->GetData64(DATA_BURU)))
if (!buru->isInCombat())
buru->AI()->AttackStart(attacker);
}
void JustSummoned(Creature* who)
{
if (who->GetEntry() == NPC_HATCHLING)
if (Creature* buru = me->GetMap()->GetCreature(_instance->GetData64(DATA_BURU)))
if (Unit* target = buru->AI()->SelectTarget(SELECT_TARGET_RANDOM))
who->AI()->AttackStart(target);
}
void JustDied(Unit* /*killer*/)
{
DoCastAOE(SPELL_EXPLODE, true);
DoCastAOE(SPELL_EXPLODE_2, true); // Unknown purpose
DoCast(me, SPELL_SUMMON_HATCHLING, true);
if (Creature* buru = me->GetMap()->GetCreature(_instance->GetData64(DATA_BURU)))
if (boss_buru::boss_buruAI* buruAI = dynamic_cast<boss_buru::boss_buruAI*>(buru->AI()))
buruAI->ManageRespawn(me->GetGUID());
}
private:
InstanceScript* _instance;
};
CreatureAI* GetAI(Creature* creature) const
{
return new npc_buru_eggAI(creature);
}
};
class spell_egg_explosion : public SpellScriptLoader
{
public:
spell_egg_explosion() : SpellScriptLoader("spell_egg_explosion") { }
class spell_egg_explosion_SpellScript : public SpellScript
{
PrepareSpellScript(spell_egg_explosion_SpellScript);
void HandleAfterCast()
{
if (Creature* buru = GetCaster()->FindNearestCreature(NPC_BURU, 5.f))
buru->AI()->DoAction(ACTION_EXPLODE);
}
void HandleDummyHitTarget(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
GetCaster()->DealDamage(target, -16 * GetCaster()->GetDistance(target) + 500);
}
void Register()
{
AfterCast += SpellCastFn(spell_egg_explosion_SpellScript::HandleAfterCast);
OnEffectHitTarget += SpellEffectFn(spell_egg_explosion_SpellScript::HandleDummyHitTarget, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_egg_explosion_SpellScript();
}
};
void AddSC_boss_buru()
{
new boss_buru();
new npc_buru_egg();
new spell_egg_explosion();
}

View File

@@ -42,6 +42,7 @@ enum Creatures
NPC_HIVEZARA_LARVA = 15555,
NPC_SAND_VORTEX = 15428,
NPC_OSSIRIAN_TRIGGER = 15590,
NPC_HATCHLING = 15521
};
enum GameObjects