Scripts/DrakTharonKeep: update Trollgore

Closes #10453

Signed-off-by: joschiwald <joschiwald@online.de>
This commit is contained in:
MitchesD
2013-08-08 00:25:53 +02:00
committed by joschiwald
parent fa9144fa39
commit 8f50e30904
2 changed files with 166 additions and 122 deletions

View File

@@ -15,10 +15,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Comment: @todo spawn troll waves
*/
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
@@ -37,10 +33,9 @@ enum Spells
SPELL_SUMMON_INVADER_A = 49456,
SPELL_SUMMON_INVADER_B = 49457,
//SPELL_SUMMON_INVADER_C = 49458, // can't find any sniffs
SPELL_SUMMON_INVADER_C = 49458, // can't find any sniffs
H_SPELL_CORPSE_EXPLODE = 59807,
H_SPELL_CONSUME = 59803,
SPELL_INVADER_TAUNT = 49405
};
#define SPELL_CONSUME_BUFF_HELPER DUNGEON_MODE<uint32>(SPELL_CONSUME_BUFF, SPELL_CONSUME_BUFF_H)
@@ -56,147 +51,164 @@ enum Yells
enum Misc
{
DATA_CONSUMPTION_JUNCTION = 1
DATA_CONSUMPTION_JUNCTION = 1,
POINT_LANDING = 1
};
Position AddSpawnPoint = { -260.493011f, -622.968018f, 26.605301f, 3.036870f };
enum Events
{
EVENT_CONSUME = 1,
EVENT_CRUSH,
EVENT_INFECTED_WOUND,
EVENT_CORPSE_EXPLODE,
EVENT_SPAWN
};
Position const Landing = { -263.0534f, -660.8658f, 26.50903f, 0.0f };
class boss_trollgore : public CreatureScript
{
public:
boss_trollgore() : CreatureScript("boss_trollgore") { }
public:
boss_trollgore() : CreatureScript("boss_trollgore") { }
struct boss_trollgoreAI : public ScriptedAI
{
boss_trollgoreAI(Creature* creature) : ScriptedAI(creature), lSummons(me)
struct boss_trollgoreAI : public BossAI
{
instance = creature->GetInstanceScript();
}
boss_trollgoreAI(Creature* creature) : BossAI(creature, DATA_TROLLGORE) { }
uint32 uiConsumeTimer;
uint32 uiAuraCountTimer;
uint32 uiCrushTimer;
uint32 uiInfectedWoundTimer;
uint32 uiExplodeCorpseTimer;
uint32 uiSpawnTimer;
bool consumptionJunction;
SummonList lSummons;
InstanceScript* instance;
void Reset() OVERRIDE
{
uiConsumeTimer = 15*IN_MILLISECONDS;
uiAuraCountTimer = 15500;
uiCrushTimer = urand(1*IN_MILLISECONDS, 5*IN_MILLISECONDS);
uiInfectedWoundTimer = urand(10*IN_MILLISECONDS, 60*IN_MILLISECONDS);
uiExplodeCorpseTimer = 3*IN_MILLISECONDS;
uiSpawnTimer = urand(30*IN_MILLISECONDS, 40*IN_MILLISECONDS);
consumptionJunction = true;
lSummons.DespawnAll();
me->RemoveAura(SPELL_CONSUME_BUFF_HELPER);
instance->SetBossState(DATA_TROLLGORE, NOT_STARTED);
}
void EnterCombat(Unit* /*who*/) OVERRIDE
{
Talk(SAY_AGGRO);
instance->SetBossState(DATA_TROLLGORE, IN_PROGRESS);
}
void UpdateAI(uint32 diff) OVERRIDE
{
//Return since we have no target
if (!UpdateVictim())
return;
if (uiSpawnTimer <= diff)
void Reset() OVERRIDE
{
uint32 spawnNumber = urand(2, DUNGEON_MODE(3, 5));
for (uint8 i = 0; i < spawnNumber; ++i)
DoSummon(RAND(NPC_DRAKKARI_INVADER_A, NPC_DRAKKARI_INVADER_B), AddSpawnPoint, 0, TEMPSUMMON_DEAD_DESPAWN);
uiSpawnTimer = urand(30*IN_MILLISECONDS, 40*IN_MILLISECONDS);
} else uiSpawnTimer -= diff;
if (uiConsumeTimer <= diff)
{
Talk(SAY_CONSUME);
DoCast(SPELL_CONSUME);
uiConsumeTimer = 15*IN_MILLISECONDS;
} else uiConsumeTimer -= diff;
if (consumptionJunction)
{
Aura* ConsumeAura = me->GetAura(SPELL_CONSUME_BUFF_HELPER);
if (ConsumeAura && ConsumeAura->GetStackAmount() > 9)
consumptionJunction = false;
_Reset();
_consumptionJunction = true;
}
if (uiCrushTimer <= diff)
void EnterCombat(Unit* /*who*/) OVERRIDE
{
DoCastVictim(SPELL_CRUSH);
uiCrushTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS);
} else uiCrushTimer -= diff;
_EnterCombat();
Talk(SAY_AGGRO);
if (uiInfectedWoundTimer <= diff)
events.ScheduleEvent(EVENT_CONSUME, 15000);
events.ScheduleEvent(EVENT_CRUSH, urand(1000, 5000));
events.ScheduleEvent(EVENT_INFECTED_WOUND, urand(10000, 60000));
events.ScheduleEvent(EVENT_CORPSE_EXPLODE, 3000);
events.ScheduleEvent(EVENT_SPAWN, urand(30000, 40000));
}
void UpdateAI(uint32 diff) OVERRIDE
{
DoCastVictim(SPELL_INFECTED_WOUND);
uiInfectedWoundTimer = urand(25*IN_MILLISECONDS, 35*IN_MILLISECONDS);
} else uiInfectedWoundTimer -= diff;
if (!UpdateVictim())
return;
if (uiExplodeCorpseTimer <= diff)
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_CONSUME:
Talk(SAY_CONSUME);
DoCastAOE(SPELL_CONSUME);
events.ScheduleEvent(EVENT_CONSUME, 15000);
break;
case EVENT_CRUSH:
DoCastVictim(SPELL_CRUSH);
events.ScheduleEvent(EVENT_CRUSH, urand(10000, 15000));
break;
case EVENT_INFECTED_WOUND:
DoCastVictim(SPELL_INFECTED_WOUND);
events.ScheduleEvent(EVENT_INFECTED_WOUND, urand(25000, 35000));
break;
case EVENT_CORPSE_EXPLODE:
Talk(SAY_EXPLODE);
DoCastAOE(SPELL_CORPSE_EXPLODE);
events.ScheduleEvent(EVENT_CORPSE_EXPLODE, urand(15000, 19000));
break;
case EVENT_SPAWN:
for (uint8 i = 0; i < 3; ++i)
if (Creature* trigger = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TROLLGORE_INVADER_SUMMONER_1 + i)))
trigger->CastSpell(trigger, RAND(SPELL_SUMMON_INVADER_A, SPELL_SUMMON_INVADER_B, SPELL_SUMMON_INVADER_C), true, NULL, NULL, me->GetGUID());
events.ScheduleEvent(EVENT_SPAWN, urand(30000, 40000));
break;
default:
break;
}
}
if (_consumptionJunction)
{
Aura* ConsumeAura = me->GetAura(SPELL_CONSUME_BUFF_HELPER);
if (ConsumeAura && ConsumeAura->GetStackAmount() > 9)
_consumptionJunction = false;
}
DoMeleeAttackIfReady();
}
void JustDied(Unit* /*killer*/) OVERRIDE
{
DoCast(SPELL_CORPSE_EXPLODE);
Talk(SAY_EXPLODE);
uiExplodeCorpseTimer = urand(15*IN_MILLISECONDS, 19*IN_MILLISECONDS);
} else uiExplodeCorpseTimer -= diff;
_JustDied();
Talk(SAY_DEATH);
}
DoMeleeAttackIfReady();
}
uint32 GetData(uint32 type) const OVERRIDE
{
if (type == DATA_CONSUMPTION_JUNCTION)
return _consumptionJunction ? 1 : 0;
void JustDied(Unit* /*killer*/) OVERRIDE
return 0;
}
void KilledUnit(Unit* victim) OVERRIDE
{
if (victim->GetTypeId() != TYPEID_PLAYER)
return;
Talk(SAY_KILL);
}
void JustSummoned(Creature* summon) OVERRIDE
{
summon->GetMotionMaster()->MovePoint(POINT_LANDING, Landing);
summons.Summon(summon);
}
private:
bool _consumptionJunction;
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
Talk(SAY_DEATH);
lSummons.DespawnAll();
instance->SetBossState(DATA_TROLLGORE, DONE);
return GetDrakTharonKeepAI<boss_trollgoreAI>(creature);
}
};
uint32 GetData(uint32 type) const OVERRIDE
class npc_drakkari_invader : public CreatureScript
{
public:
npc_drakkari_invader() : CreatureScript("npc_drakkari_invader") { }
struct npc_drakkari_invaderAI : public ScriptedAI
{
if (type == DATA_CONSUMPTION_JUNCTION)
return consumptionJunction ? 1 : 0;
npc_drakkari_invaderAI(Creature* creature) : ScriptedAI(creature) { }
return 0;
}
void MovementInform(uint32 type, uint32 pointId) OVERRIDE
{
if (type == POINT_MOTION_TYPE && pointId == POINT_LANDING)
{
me->Dismount();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
DoCastAOE(SPELL_INVADER_TAUNT);
}
}
};
void KilledUnit(Unit* victim) OVERRIDE
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
if (victim->GetTypeId() != TYPEID_PLAYER)
return;
Talk(SAY_KILL);
return GetDrakTharonKeepAI<npc_drakkari_invaderAI>(creature);
}
void JustSummoned(Creature* summon) OVERRIDE
{
lSummons.Summon(summon);
if (summon->AI())
summon->AI()->AttackStart(me);
}
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return GetDrakTharonKeepAI<boss_trollgoreAI>(creature);
}
};
// 49380, 59803 - Consume
@@ -335,6 +347,7 @@ class achievement_consumption_junction : public AchievementCriteriaScript
void AddSC_boss_trollgore()
{
new boss_trollgore();
new npc_drakkari_invader();
new spell_trollgore_consume();
new spell_trollgore_corpse_explode();
new spell_trollgore_invader_taunt();