aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjoschiwald <joschiwald.trinity@gmail.com>2014-04-28 19:58:17 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2014-04-28 19:58:17 +0200
commitf388020366a8aead923dcdddb56c449d3668ae2a (patch)
tree81e990124a9e1126ffcf99261813b06f83d4469b /src
parent6bc740f31209de475ce153f3633ea812c6aa42f9 (diff)
parent0c0d0ed9e59df4397f2bd401d3f0415445632064 (diff)
Merge pull request #11948 from MitchesD/misc
Scripts/Azuregos: converted to EventMap and WorldBossAI
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Kalimdor/boss_azuregos.cpp265
1 files changed, 159 insertions, 106 deletions
diff --git a/src/server/scripts/Kalimdor/boss_azuregos.cpp b/src/server/scripts/Kalimdor/boss_azuregos.cpp
index 3eceb2adcf7..8db8db75562 100644
--- a/src/server/scripts/Kalimdor/boss_azuregos.cpp
+++ b/src/server/scripts/Kalimdor/boss_azuregos.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2006-2009 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
@@ -16,151 +15,205 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* ScriptData
-SDName: Boss_Azuregos
-SD%Complete: 90
-SDComment: Teleport not included, spell reflect not effecting dots (Core problem)
-SDCategory: Azshara
-EndScriptData */
-
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
enum Say
{
- SAY_TELEPORT = 0
+ SAY_TELEPORT = 0
};
enum Spells
{
- SPELL_MARKOFFROST = 23182,
- SPELL_MANASTORM = 21097,
- SPELL_CHILL = 21098,
- SPELL_FROSTBREATH = 21099,
- SPELL_REFLECT = 22067,
- SPELL_CLEAVE = 8255, //Perhaps not right ID
- SPELL_ENRAGE = 23537
+ SPELL_MARK_OF_FROST = 23182,
+ SPELL_AURA_OF_FROST = 23186,
+ SPELL_MARK_OF_FROST_AURA = 23184,
+ SPELL_MANA_STORM = 21097,
+ SPELL_CHILL = 21098,
+ SPELL_FROST_BREATH = 21099,
+ SPELL_REFLECT = 22067,
+ SPELL_CLEAVE = 8255, // Perhaps not right ID
+ SPELL_ENRAGE = 23537
+};
+
+enum Events
+{
+ EVENT_MARK_OF_FROST = 1,
+ EVENT_MANA_STORM,
+ EVENT_CHILL,
+ EVENT_BREATH,
+ EVENT_TELEPORT,
+ EVENT_REFLECT,
+ EVENT_CLEAVE,
+ EVENT_ENRAGE
};
class boss_azuregos : public CreatureScript
{
-public:
- boss_azuregos() : CreatureScript("boss_azuregos") { }
-
- CreatureAI* GetAI(Creature* creature) const OVERRIDE
- {
- return new boss_azuregosAI(creature);
- }
-
- struct boss_azuregosAI : public ScriptedAI
- {
- boss_azuregosAI(Creature* creature) : ScriptedAI(creature) { }
-
- uint32 MarkOfFrostTimer;
- uint32 ManaStormTimer;
- uint32 ChillTimer;
- uint32 BreathTimer;
- uint32 TeleportTimer;
- uint32 ReflectTimer;
- uint32 CleaveTimer;
- uint32 EnrageTimer;
- bool Enraged;
-
- void Reset() OVERRIDE
+ public:
+ boss_azuregos() : CreatureScript("boss_azuregos") { }
+
+ struct boss_azuregosAI : public WorldBossAI
{
- MarkOfFrostTimer = 35000;
- ManaStormTimer = urand(5000, 17000);
- ChillTimer = urand(10000, 30000);
- BreathTimer = urand(2000, 8000);
- TeleportTimer = 30000;
- ReflectTimer = urand(15000, 30000);
- CleaveTimer = 7000;
- EnrageTimer = 0;
- Enraged = false;
- }
+ boss_azuregosAI(Creature* creature) : WorldBossAI(creature) { }
- void EnterCombat(Unit* /*who*/) OVERRIDE { }
+ void Reset() OVERRIDE
+ {
+ _Reset();
+ }
- void UpdateAI(uint32 diff) OVERRIDE
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
+ void EnterCombat(Unit* /*who*/) OVERRIDE
+ {
+ DoCast(me, SPELL_MARK_OF_FROST_AURA, true);
+ _enraged = false;
+
+ events.ScheduleEvent(EVENT_MARK_OF_FROST, 35000);
+ events.ScheduleEvent(EVENT_MANA_STORM, urand(5000, 17000));
+ events.ScheduleEvent(EVENT_CHILL, urand(10000, 30000));
+ events.ScheduleEvent(EVENT_BREATH, urand(2000, 8000));
+ events.ScheduleEvent(EVENT_TELEPORT, 30000);
+ events.ScheduleEvent(EVENT_REFLECT, urand(15000, 30000));
+ events.ScheduleEvent(EVENT_CLEAVE, 7000);
+ }
- if (TeleportTimer <= diff)
+ void KilledUnit(Unit* who) OVERRIDE
{
- Talk(SAY_TELEPORT);
- ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
- ThreatContainer::StorageType::const_iterator i = threatlist.begin();
- for (i = threatlist.begin(); i != threatlist.end(); ++i)
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ who->CastSpell(who, SPELL_MARK_OF_FROST, true);
+ }
+
+ void UpdateAI(uint32 diff) OVERRIDE
+ {
+ if (!UpdateVictim())
+ return;
+
+ events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
{
- Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
- if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
+ switch (eventId)
{
- DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, unit->GetOrientation());
+ case EVENT_MANA_STORM:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true))
+ DoCast(target, SPELL_MANA_STORM);
+ events.ScheduleEvent(EVENT_MANA_STORM, urand(7500, 12500));
+ break;
+ case EVENT_CHILL:
+ DoCastVictim(SPELL_CHILL);
+ events.ScheduleEvent(EVENT_CHILL, urand(13000, 25000));
+ break;
+ case EVENT_BREATH:
+ DoCastVictim(SPELL_FROST_BREATH);
+ events.ScheduleEvent(EVENT_BREATH, urand(10000, 15000));
+ break;
+ case EVENT_TELEPORT:
+ {
+ Talk(SAY_TELEPORT);
+ ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
+ {
+ if (Player* player = ObjectAccessor::GetPlayer(*me, (*i)->getUnitGuid()))
+ DoTeleportPlayer(player, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, player->GetOrientation());
+ }
+
+ DoResetThreat();
+ events.ScheduleEvent(EVENT_TELEPORT, 30000);
+ break;
+ }
+ case EVENT_REFLECT:
+ DoCast(me, SPELL_REFLECT);
+ events.ScheduleEvent(EVENT_REFLECT, urand(20000, 35000));
+ break;
+ case EVENT_CLEAVE:
+ DoCastVictim(SPELL_CLEAVE);
+ events.ScheduleEvent(EVENT_CLEAVE, 7000);
+ break;
+ default:
+ break;
}
}
- DoResetThreat();
- TeleportTimer = 30000;
- } else TeleportTimer -= diff;
+ if (HealthBelowPct(26) && !_enraged)
+ {
+ DoCast(me, SPELL_ENRAGE);
+ _enraged = true;
+ }
- // //MarkOfFrostTimer
- // if (MarkOfFrostTimer <= diff)
- // {
- // DoCastVictim(SPELL_MARKOFFROST);
- // MarkOfFrostTimer = 25000;
- // } else MarkOfFrostTimer -= diff;
+ DoMeleeAttackIfReady();
+ }
- //ChillTimer
- if (ChillTimer <= diff)
- {
- DoCastVictim(SPELL_CHILL);
- ChillTimer = urand(13000, 25000);
- } else ChillTimer -= diff;
+ private:
+ bool _enraged;
+ };
- //BreathTimer
- if (BreathTimer <= diff)
- {
- DoCastVictim(SPELL_FROSTBREATH);
- BreathTimer = urand(10000, 15000);
- } else BreathTimer -= diff;
+ CreatureAI* GetAI(Creature* creature) const OVERRIDE
+ {
+ return new boss_azuregosAI(creature);
+ }
+};
- //ManaStormTimer
- if (ManaStormTimer <= diff)
+class MarkOfFrostTargetSelector
+{
+ public:
+ MarkOfFrostTargetSelector() { }
+
+ bool operator()(WorldObject* object) const
+ {
+ if (Unit* unit = object->ToUnit())
+ return !(unit->HasAura(SPELL_MARK_OF_FROST) && !unit->HasAura(SPELL_AURA_OF_FROST));
+ return true;
+ }
+};
+
+class spell_mark_of_frost : public SpellScriptLoader
+{
+ public:
+ spell_mark_of_frost() : SpellScriptLoader("spell_mark_of_frost") { }
+
+ class spell_mark_of_frost_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_mark_of_frost_SpellScript);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_MANASTORM);
- ManaStormTimer = urand(7500, 12500);
- } else ManaStormTimer -= diff;
+ if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_FROST))
+ return false;
+ if (!sSpellMgr->GetSpellInfo(SPELL_AURA_OF_FROST))
+ return false;
+ return true;
+ }
- //ReflectTimer
- if (ReflectTimer <= diff)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
- DoCast(me, SPELL_REFLECT);
- ReflectTimer = urand(20000, 35000);
- } else ReflectTimer -= diff;
+ targets.remove_if(MarkOfFrostTargetSelector());
+ }
- //CleaveTimer
- if (CleaveTimer <= diff)
+ void HandleEffect(SpellEffIndex effIndex)
{
- DoCastVictim(SPELL_CLEAVE);
- CleaveTimer = 7000;
- } else CleaveTimer -= diff;
+ PreventHitDefaultEffect(effIndex);
+ GetHitUnit()->CastSpell(GetHitUnit(), SPELL_AURA_OF_FROST, true);
+ }
- //EnrageTimer
- if (HealthBelowPct(26) && !Enraged)
+ void Register() OVERRIDE
{
- DoCast(me, SPELL_ENRAGE);
- Enraged = true;
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mark_of_frost_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnEffectHitTarget += SpellEffectFn(spell_mark_of_frost_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
}
+ };
- DoMeleeAttackIfReady();
+ SpellScript* GetSpellScript() const OVERRIDE
+ {
+ return new spell_mark_of_frost_SpellScript();
}
- };
};
void AddSC_boss_azuregos()
{
new boss_azuregos();
+ new spell_mark_of_frost();
}