Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
- index 89064a5..4231a1e 100644
- --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
- +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
- @@ -34,6 +34,18 @@ enum Spells
- SPELL_POISONOUS_MUSHROOM_VISUAL_AREA = 61566, // Self
- SPELL_POISONOUS_MUSHROOM_VISUAL_AURA = 56741, // Self
- SPELL_PUTRID_MUSHROOM = 31690, // To make the mushrooms visible
- + SPELL_POWER_MUSHROOM_VISUAL_AURA = 56740,
- +};
- +
- +enum event
- +{
- + EVENT_SPAWN = 1,
- + EVENT_MINI,
- + EVENT_ROOT,
- + EVENT_BASH,
- + EVENT_BOLT,
- + EVENT_AURA,
- + EVENT_DEATH
- };
- enum Creatures
- @@ -47,33 +59,21 @@ class boss_amanitar : public CreatureScript
- public:
- boss_amanitar() : CreatureScript("boss_amanitar") { }
- - struct boss_amanitarAI : public ScriptedAI
- + struct boss_amanitarAI : public BossAI
- {
- - boss_amanitarAI(Creature* creature) : ScriptedAI(creature)
- + boss_amanitarAI(Creature* creature) : BossAI(creature, DATA_AMANITAR)
- {
- instance = creature->GetInstanceScript();
- bFirstTime = true;
- }
- InstanceScript* instance;
- -
- - uint32 uiRootTimer;
- - uint32 uiBashTimer;
- - uint32 uiBoltTimer;
- - uint32 uiSpawnTimer;
- + EventMap events;
- bool bFirstTime;
- void Reset()
- {
- - uiRootTimer = urand(5*IN_MILLISECONDS, 9*IN_MILLISECONDS);
- - uiBashTimer = urand(10*IN_MILLISECONDS, 14*IN_MILLISECONDS);
- - uiBoltTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- - uiSpawnTimer = 0;
- -
- - me->SetMeleeDamageSchool(SPELL_SCHOOL_NATURE);
- - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true);
- -
- if (instance)
- {
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI);
- @@ -82,6 +82,18 @@ public:
- else
- bFirstTime = false;
- }
- +
- + events.Reset();
- + events.ScheduleEvent(EVENT_ROOT, urand(5,9)*IN_MILLISECONDS);
- + events.ScheduleEvent(EVENT_BASH, urand(10,14)*IN_MILLISECONDS);
- + events.ScheduleEvent(EVENT_BOLT, urand(15,20)*IN_MILLISECONDS);
- + events.ScheduleEvent(EVENT_MINI, urand(12,18)*IN_MILLISECONDS);
- + events.ScheduleEvent(EVENT_SPAWN, 5 *IN_MILLISECONDS);
- +
- + me->SetMeleeDamageSchool(SPELL_SCHOOL_NATURE);
- + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true);
- +
- + summons.DespawnAll();
- }
- void JustDied(Unit* /*killer*/)
- @@ -90,11 +102,13 @@ public:
- {
- instance->SetData(DATA_AMANITAR_EVENT, DONE);
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI);
- + summons.DespawnAll();
- }
- }
- void EnterCombat(Unit* /*who*/)
- {
- + me->SetInCombatWithZone();
- if (instance)
- instance->SetData(DATA_AMANITAR_EVENT, IN_PROGRESS);
- @@ -111,6 +125,7 @@ public:
- {
- Position pos;
- victim->GetPosition(&pos);
- + //pos.m_positionZ = me->GetMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), MAX_HEIGHT) + 2.0f;
- me->GetRandomNearPosition(pos, float(urand(5, 80)));
- me->SummonCreature(NPC_POISONOUS_MUSHROOM, pos, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30*IN_MILLISECONDS);
- me->GetRandomNearPosition(pos, float(urand(5, 80)));
- @@ -121,36 +136,40 @@ public:
- void UpdateAI(const uint32 diff)
- {
- - //Return since we have no target
- if (!UpdateVictim())
- return;
- - if (uiSpawnTimer <= diff)
- - {
- - SpawnAdds();
- - uiSpawnTimer = urand(35*IN_MILLISECONDS, 40*IN_MILLISECONDS);
- - } else uiSpawnTimer -= diff;
- -
- - if (uiRootTimer <= diff)
- - {
- - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- - DoCast(target, SPELL_ENTANGLING_ROOTS);
- - uiRootTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- - } else uiRootTimer -= diff;
- + events.Update(diff);
- - if (uiBashTimer <= diff)
- - {
- - DoCastVictim(SPELL_BASH);
- - uiBashTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- - } else uiBashTimer -= diff;
- + if (me->HasUnitState(UNIT_STATE_CASTING))
- + return;
- - if (uiBoltTimer <= diff)
- + while (uint32 eventId = events.ExecuteEvent())
- {
- - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- - DoCast(target, SPELL_VENOM_BOLT_VOLLEY);
- - uiBoltTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- - } else uiBoltTimer -= diff;
- -
- + switch (eventId)
- + {
- + case EVENT_SPAWN:
- + SpawnAdds();
- + events.ScheduleEvent(EVENT_SPAWN, urand(35,40)*IN_MILLISECONDS);
- + break;
- + case EVENT_MINI:
- + DoCast(SPELL_MINI);
- + events.ScheduleEvent(EVENT_BASH, urand(25,30)*IN_MILLISECONDS);
- + break;
- + case EVENT_ROOT:
- + DoCast(SelectTarget(SELECT_TARGET_RANDOM,0, 100, true),SPELL_ENTANGLING_ROOTS);
- + events.ScheduleEvent(EVENT_ROOT, urand(10,5)*IN_MILLISECONDS);
- + break;
- + case EVENT_BASH:
- + DoCastVictim(SPELL_BASH);
- + events.ScheduleEvent(EVENT_BASH, urand(7,12)*IN_MILLISECONDS);
- + break;
- + case EVENT_BOLT:
- + DoCast(SelectTarget(SELECT_TARGET_RANDOM,0, 100, true),SPELL_VENOM_BOLT_VOLLEY);
- + events.ScheduleEvent(EVENT_BASH, urand(18,22)*IN_MILLISECONDS);
- + break;
- + }
- + }
- DoMeleeAttackIfReady();
- }
- };
- @@ -170,18 +189,20 @@ public:
- {
- mob_amanitar_mushroomsAI(Creature* creature) : Scripted_NoMovementAI(creature) {}
- - uint32 uiAuraTimer;
- - uint32 uiDeathTimer;
- + EventMap events;
- void Reset()
- {
- - DoCast(me, SPELL_PUTRID_MUSHROOM, true); // Hack, to make the mushrooms visible, can't find orig. spell...
- + DoCast(me, SPELL_PUTRID_MUSHROOM, true);
- if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
- DoCast(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AURA, true);
- + else
- + DoCast(SPELL_POWER_MUSHROOM_VISUAL_AURA);
- - uiAuraTimer = 0;
- - uiDeathTimer = 30*IN_MILLISECONDS;
- + events.Reset();
- + events.ScheduleEvent(EVENT_AURA, 1*IN_MILLISECONDS);
- + events.ScheduleEvent(EVENT_DEATH, 30*IN_MILLISECONDS);
- }
- void JustDied(Unit* killer)
- @@ -196,23 +217,43 @@ public:
- }
- }
- +
- + //void DamageTaken(Unit* /*attacker*/, uint32 &damage)
- + //{
- + //if (damage >= me->GetHealth() && me->GetEntry() == NPC_HEALTHY_MUSHROOM)
- + //DoCast(me, SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS, true);
- + //}
- +
- void EnterCombat(Unit* /*who*/) {}
- void AttackStart(Unit* /*victim*/) {}
- void UpdateAI(const uint32 diff)
- {
- - if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
- + if (!UpdateVictim())
- + return;
- +
- + events.Update(diff);
- +
- + if (me->HasUnitState(UNIT_STATE_CASTING))
- + return;
- +
- + while (uint32 eventId = events.ExecuteEvent())
- {
- - if (uiAuraTimer <= diff)
- + switch (eventId)
- {
- - DoCast(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AREA, true);
- - DoCast(me, SPELL_POISONOUS_MUSHROOM_POISON_CLOUD, false);
- - uiAuraTimer = 7*IN_MILLISECONDS;
- - } else uiAuraTimer -= diff;
- + case EVENT_AURA:
- + if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
- + {
- + DoCast(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AREA, true);
- + DoCast(me, SPELL_POISONOUS_MUSHROOM_POISON_CLOUD, false);
- + }
- + events.ScheduleEvent(EVENT_AURA, 7*IN_MILLISECONDS);
- + break;
- + case EVENT_DEATH:
- + me->DisappearAndDie();
- + break;
- + }
- }
- - if (uiDeathTimer <= diff)
- - me->DisappearAndDie();
- - else uiDeathTimer -= diff;
- }
- };
Add Comment
Please, Sign In to add comment