diff options
author | megamage <none@none> | 2009-05-17 23:27:51 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-05-17 23:27:51 -0500 |
commit | a922f36da5c1d3d9809649cac028393e6b06b5df (patch) | |
tree | 1a951f2cce9916c7d8d0abd7500d71e818262c85 /src | |
parent | 1d859b6ee4251e26e02348286d549710435bd0f1 (diff) |
*Update script for Loatheb.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/scripts/creature/mob_generic_creature.cpp | 22 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/naxxramas/boss_loatheb.cpp | 138 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/naxxramas/boss_sapphiron.cpp | 4 | ||||
-rw-r--r-- | src/game/CreatureAI.cpp | 1 | ||||
-rw-r--r-- | src/game/CreatureAIImpl.h | 4 |
5 files changed, 72 insertions, 97 deletions
diff --git a/src/bindings/scripts/scripts/creature/mob_generic_creature.cpp b/src/bindings/scripts/scripts/creature/mob_generic_creature.cpp index cff456e3516..d26b724cdbf 100644 --- a/src/bindings/scripts/scripts/creature/mob_generic_creature.cpp +++ b/src/bindings/scripts/scripts/creature/mob_generic_creature.cpp @@ -167,7 +167,7 @@ struct TRINITY_DLL_DECL trigger_periodicAI : public NullCreatureAI trigger_periodicAI(Creature* c) : NullCreatureAI(c) { spell = me->m_spells[0] ? GetSpellStore()->LookupEntry(me->m_spells[0]) : NULL; - interval = me->m_spells[1] ? me->m_spells[1] : 1000; + interval = spell ? GetAISpellInfo(me->m_spells[0])->cooldown : 100000; //me->m_spells[1] ? me->m_spells[1] : 1000; timer = interval; } @@ -187,11 +187,26 @@ struct TRINITY_DLL_DECL trigger_periodicAI : public NullCreatureAI } }; +struct TRINITY_DLL_DECL trigger_deathAI : public NullCreatureAI +{ + trigger_deathAI(Creature* c) : NullCreatureAI(c) {} + void JustDied(Unit *killer) + { + if(me->m_spells[0]) + me->CastSpell(killer, me->m_spells[0], true); + } +}; + CreatureAI* GetAI_trigger_periodic(Creature *_Creature) { return new trigger_periodicAI (_Creature); } +CreatureAI* GetAI_trigger_death(Creature *_Creature) +{ + return new trigger_deathAI (_Creature); +} + void AddSC_generic_creature() { Script *newscript; @@ -204,5 +219,10 @@ void AddSC_generic_creature() newscript->Name="trigger_periodic"; newscript->GetAI = &GetAI_trigger_periodic; newscript->RegisterSelf(); + + /*newscript = new Script; + newscript->Name="trigger_death"; + newscript->GetAI = &GetAI_trigger_death; + newscript->RegisterSelf();*/ } diff --git a/src/bindings/scripts/scripts/zone/naxxramas/boss_loatheb.cpp b/src/bindings/scripts/scripts/zone/naxxramas/boss_loatheb.cpp index 3d50e8f084b..8548862d1b5 100644 --- a/src/bindings/scripts/scripts/zone/naxxramas/boss_loatheb.cpp +++ b/src/bindings/scripts/scripts/zone/naxxramas/boss_loatheb.cpp @@ -1,4 +1,6 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> +/* + * Copyright (C) 2008 - 2009 Trinity <http://www.trinitycore.org/> + * * 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 @@ -14,123 +16,64 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* ScriptData -SDName: Boss_Loatheb -SD%Complete: 100 -SDComment: -SDCategory: Naxxramas -EndScriptData */ - #include "precompiled.h" +#include "def_naxxramas.h" -#define SPELL_CORRUPTED_MIND 29198 -#define SPELL_POISON_AURA 29865 -#define SPELL_INEVITABLE_DOOM 29204 -#define SPELL_REMOVE_CURSE 30281 - -#define ADD_1X 2957.040 -#define ADD_1Y -3997.590 -#define ADD_1Z 274.280 - -#define ADD_2X 2909.130 -#define ADD_2Y -4042.970 -#define ADD_2Z 274.280 +#define SPELL_NECROTIC_AURA 55593 +#define SPELL_SUMMON_SPORE 29234 +#define SPELL_DEATHBLOOM HEROIC(29865,55053) +#define SPELL_INEVITABLE_DOOM HEROIC(29204,55052) -#define ADD_3X 2861.102 -#define ADD_3Y -3997.901 -#define ADD_3Z 274.280 - -struct TRINITY_DLL_DECL boss_loathebAI : public ScriptedAI +enum Events { - boss_loathebAI(Creature *c) : ScriptedAI(c) {} - - uint32 CorruptedMind_Timer; - uint32 PoisonAura_Timer; - uint32 InevitableDoom_Timer; - uint32 InevitableDoom5mins_Timer; - uint32 RemoveCurse_Timer; - uint32 Summon_Timer; + EVENT_AURA = 1, + EVENT_BLOOM, + EVENT_DOOM, +}; - void Reset() - { - CorruptedMind_Timer = 4000; - PoisonAura_Timer = 2500; - InevitableDoom_Timer = 120000; - InevitableDoom5mins_Timer = 300000; - RemoveCurse_Timer = 30000; - Summon_Timer = 8000; - } +struct TRINITY_DLL_DECL boss_loathebAI : public BossAI +{ + boss_loathebAI(Creature *c) : BossAI(c, BOSS_LOATHEB) {} void EnterCombat(Unit *who) { - } - - void JustDied(Unit* Killer) - { + _EnterCombat(); + events.ScheduleEvent(EVENT_AURA, 0); + events.ScheduleEvent(EVENT_BLOOM, 30000); + events.ScheduleEvent(EVENT_DOOM, 120000); } void UpdateAI(const uint32 diff) { - if (!UpdateVictim()) + if(!UpdateVictim()) return; - //CorruptedMind_Timer - if (CorruptedMind_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_CORRUPTED_MIND); - CorruptedMind_Timer = 62000; - }else CorruptedMind_Timer -= diff; - - //PoisonAura_Timer - if (PoisonAura_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_POISON_AURA); - PoisonAura_Timer = 60000; - }else PoisonAura_Timer -= diff; - - //InevitableDoom_Timer - if (InevitableDoom_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_INEVITABLE_DOOM); - InevitableDoom_Timer = 120000; - }else InevitableDoom_Timer -= diff; - - //InevitableDoom5mins_Timer - if (InevitableDoom5mins_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_INEVITABLE_DOOM); - InevitableDoom5mins_Timer = 15000; - }else InevitableDoom5mins_Timer -= diff; + events.Update(diff); - //RemoveCurse_Timer - if (RemoveCurse_Timer < diff) + while(uint32 eventId = events.ExecuteEvent()) { - DoCast(m_creature,SPELL_REMOVE_CURSE); - RemoveCurse_Timer = 30000; - }else RemoveCurse_Timer -= diff; - - //Summon_Timer - if (Summon_Timer < diff) - { - Unit* target = NULL; - Unit* SummonedSpores = NULL; - - SummonedSpores = m_creature->SummonCreature(16286,ADD_1X,ADD_1Y,ADD_1Z,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); - SummonedSpores = m_creature->SummonCreature(16286,ADD_2X,ADD_2Y,ADD_2Z,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); - SummonedSpores = m_creature->SummonCreature(16286,ADD_3X,ADD_3Y,ADD_3Z,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); - if (SummonedSpores) + switch(eventId) { - target = SelectUnit(SELECT_TARGET_RANDOM,0); - if (target) - SummonedSpores->AddThreat(target,1.0f); + case EVENT_AURA: + DoCastAOE(SPELL_NECROTIC_AURA); + events.ScheduleEvent(EVENT_AURA, 20000); + return; + case EVENT_BLOOM: + DoCastAOE(SPELL_SUMMON_SPORE, true); + DoCastAOE(SPELL_DEATHBLOOM); + events.ScheduleEvent(EVENT_BLOOM, 30000); + return; + case EVENT_DOOM: + DoCastAOE(SPELL_INEVITABLE_DOOM); + events.ScheduleEvent(EVENT_DOOM, events.GetTimer() < 5*60000 ? 30000 : 15000); + return; } - - Summon_Timer = 28000; - } else Summon_Timer -= diff; + } DoMeleeAttackIfReady(); } }; + CreatureAI* GetAI_boss_loatheb(Creature *_Creature) { return new boss_loathebAI (_Creature); @@ -143,5 +86,8 @@ void AddSC_boss_loatheb() newscript->Name="boss_loatheb"; newscript->GetAI = &GetAI_boss_loatheb; newscript->RegisterSelf(); + + // Fungal Creep + GetAISpellInfo(29232)->condition = AICOND_DIE; } diff --git a/src/bindings/scripts/scripts/zone/naxxramas/boss_sapphiron.cpp b/src/bindings/scripts/scripts/zone/naxxramas/boss_sapphiron.cpp index dce3c974f47..9bfb98cab43 100644 --- a/src/bindings/scripts/scripts/zone/naxxramas/boss_sapphiron.cpp +++ b/src/bindings/scripts/scripts/zone/naxxramas/boss_sapphiron.cpp @@ -343,4 +343,8 @@ void AddSC_boss_sapphiron() newscript->Name="boss_sapphiron"; newscript->GetAI = &GetAI_boss_sapphiron; newscript->RegisterSelf(); + + // Chill + GetAISpellInfo(28547)->cooldown = 1000; + GetAISpellInfo(55699)->cooldown = 1000; } diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp index 2fc4cf938cf..230c1d446fc 100644 --- a/src/game/CreatureAI.cpp +++ b/src/game/CreatureAI.cpp @@ -33,6 +33,7 @@ void CreatureAI::OnCharmed(bool apply) } AISpellInfoType * CreatureAI::AISpellInfo; +TRINITY_DLL_SPEC AISpellInfoType * GetAISpellInfo(uint32 i) { return &CreatureAI::AISpellInfo[i]; } void CreatureAI::DoZoneInCombat(Creature* creature) { diff --git a/src/game/CreatureAIImpl.h b/src/game/CreatureAIImpl.h index 7edebb709fd..f404f0d954f 100644 --- a/src/game/CreatureAIImpl.h +++ b/src/game/CreatureAIImpl.h @@ -81,6 +81,8 @@ class EventMap : private std::map<uint32, uint32> public: explicit EventMap() : m_phase(0), m_time(0) {} + uint32 GetTimer() const { return m_time; } + void Reset() { clear(); m_time = 0; m_phase = 0; } void Update(uint32 time) { m_time += time; } @@ -171,5 +173,7 @@ struct AISpellInfoType uint32 cooldown; }; +TRINITY_DLL_SPEC AISpellInfoType * GetAISpellInfo(uint32 i); + #endif |