aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormaximius <none@none>2009-09-25 19:20:04 -0700
committermaximius <none@none>2009-09-25 19:20:04 -0700
commit2853aa1cd1bb3026d697672aefb6eace902f90b1 (patch)
tree9507ef4b5de46038f650eda146b126739820d19e /src
parent0febe02227f5ac2272ff1e57c6b527300ffe6641 (diff)
*Grobbulus - in Inject event, tank is not a target for this spell, by Gyullo
*Gundrak - AI for the boss Moorabi, by Manuel *Improvements to player death handling (they will now fall to the ground).. also attempted to improve creature death handling the same way. --HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/scripts/northrend/gundrak/boss_moorabi.cpp170
-rw-r--r--src/bindings/scripts/scripts/northrend/naxxramas/boss_grobbulus.cpp2
-rw-r--r--src/bindings/scripts/system/ScriptLoader.cpp2
-rw-r--r--src/game/Creature.cpp2
-rw-r--r--src/game/Player.cpp19
-rw-r--r--src/game/Player.h1
6 files changed, 152 insertions, 44 deletions
diff --git a/src/bindings/scripts/scripts/northrend/gundrak/boss_moorabi.cpp b/src/bindings/scripts/scripts/northrend/gundrak/boss_moorabi.cpp
index 17f0d4686ee..c8d110fe751 100644
--- a/src/bindings/scripts/scripts/northrend/gundrak/boss_moorabi.cpp
+++ b/src/bindings/scripts/scripts/northrend/gundrak/boss_moorabi.cpp
@@ -1,81 +1,167 @@
/* Script Data Start
SDName: Boss moorabi
-SDAuthor: LordVanMartin
-SD%Complete:
-SDComment:
-SDCategory:
+SDAuthor: Manuel
+SD%Complete: 100%
+SDComment: Maybe needs better timers.
+SDCategory: Gundrak
Script Data End */
-/*** SQL START ***
-update creature_template set scriptname = 'boss_moorabi' where entry = '';
-*** SQL END ***/
#include "precompiled.h"
//Spells
-#define SPELL_DETERMINED_GORE 55102
-#define SPELL_DETERMINED_STAB_2 59444
-#define SPELL_DETERMINED_STAB_3 55104
-
-#define SPELL_GROUND_TREMOR 55142
-#define SPELL_MOJO_FRENZY 55163
-#define SPELL_NUMBING_ROAR_1 55100
-#define SPELL_NUMBING_ROAR_2 55106
-#define SPELL_TRANSFORMATION 55098 //Periodic, The caster transforms into a powerful mammoth, increasing Physical damage done by 25% and granting immunity to Stun effects.
-#define SPELL_QUAKE 55101
-
-//not in db
+
+#define SPELL_DETERMINED_STAB 55104
+#define SPELL_GROUND_TREMOR 55142
+#define SPELL_NUMBING_SHOUT 55106
+
+#define SPELL_DETERMINED_GORE 55102
+#define SPELL_DETERMINED_GORE_1 59444
+#define SPELL_QUAKE 55101
+#define SPELL_NUMBING_ROAR 55100
+
+#define SPELL_MOJO_FRENZY 55163
+#define SPELL_TRANSFORMATION 55098 //Periodic, The caster transforms into a powerful mammoth, increasing Physical damage done by 25% and granting immunity to Stun effects.
+
+#define ACHIEVEMENT_LESS_RABI 2040
+
//Yell
#define SAY_AGGRO -1604010
-#define SAY_SLAY_1 -1604011
+//#define SAY_SLAY_1 -1604011 // not in db
#define SAY_SLAY_2 -1604012
#define SAY_SLAY_3 -1604013
#define SAY_DEATH -1604014
#define SAY_TRANSFORM -1604015
#define SAY_QUAKE -1604016
+#define EMOTE_TRANSFORM -1604017
struct TRINITY_DLL_DECL boss_moorabiAI : public ScriptedAI
{
- boss_moorabiAI(Creature *c) : ScriptedAI(c) {}
+ boss_moorabiAI(Creature *c) : ScriptedAI(c)
+ {
+ HeroicMode = c->GetMap()->IsHeroic();
+ }
- uint32 phase;
+ bool HeroicMode;
+ bool Phase;
+ uint32 SPELL_QUAKE_TIMER;
+ uint32 SPELL_NUMBING_SHOUT_TIMER;
+ uint32 SPELL_GROUND_TREMOR_TIMER;
+ uint32 SPELL_DETERMINED_STAB_TIMER;
+ uint32 SPELL_TRANSFORMATION_TIMER;
+
+ void Reset()
+ {
+ SPELL_GROUND_TREMOR_TIMER = 18000;
+ SPELL_NUMBING_SHOUT_TIMER = 10000;
+ SPELL_DETERMINED_STAB_TIMER = 20000;
+ SPELL_TRANSFORMATION_TIMER = 12000;
+ Phase = false;
+ }
- void Reset() {}
- void EnterCombat(Unit* who)
+ void EnterCombat(Unit *who)
{
DoScriptText(SAY_AGGRO, m_creature);
+ m_creature->CastSpell(m_creature,SPELL_MOJO_FRENZY,true);
}
- void AttackStart(Unit* who) {}
- void MoveInLineOfSight(Unit* who) {}
+
void UpdateAI(const uint32 diff)
{
- phase =1;
//Return since we have no target
- if (!UpdateVictim())
- return;
+ if (!UpdateVictim())
+ return;
+
+ if(Phase == false && m_creature->HasAura(SPELL_TRANSFORMATION))
+ Phase = true;
- DoMeleeAttackIfReady();
- }
- void JustDied(Unit* killer)
- {
- DoScriptText(SAY_DEATH, m_creature);
+ if(Phase == true)
+ {
+ m_creature->RemoveAura(SPELL_MOJO_FRENZY);
+
+ if (SPELL_GROUND_TREMOR_TIMER < diff)
+ {
+ DoScriptText(SAY_QUAKE, m_creature);
+ m_creature->CastSpell(m_creature->getVictim(),SPELL_QUAKE,true);
+ SPELL_GROUND_TREMOR_TIMER = 10000;
+ } else SPELL_GROUND_TREMOR_TIMER -= diff;
+
+ if (SPELL_NUMBING_SHOUT_TIMER < diff)
+ {
+ m_creature->CastSpell(m_creature->getVictim(),SPELL_NUMBING_ROAR,true);
+ SPELL_NUMBING_SHOUT_TIMER = 10000;
+ } else SPELL_NUMBING_SHOUT_TIMER -=diff;
+
+ if (SPELL_DETERMINED_STAB_TIMER < diff)
+ {
+ DoCast(m_creature->getVictim(), HeroicMode ? SPELL_DETERMINED_GORE_1 : SPELL_DETERMINED_GORE);
+ SPELL_DETERMINED_STAB_TIMER = 8000;
+ } else SPELL_DETERMINED_STAB_TIMER -=diff;
+ }
+ else
+ {
+ //CAST TRANSFORMATION
+ if (SPELL_TRANSFORMATION_TIMER < diff)
+ {
+ DoScriptText(EMOTE_TRANSFORM, m_creature);
+ DoScriptText(SAY_TRANSFORM, m_creature);
+ m_creature->CastSpell(m_creature,SPELL_TRANSFORMATION,false);
+ SPELL_TRANSFORMATION_TIMER = 10000;
+ } else SPELL_TRANSFORMATION_TIMER -= diff;
+
+ //CAST GROUND TERMOR || QUAKE
+ if (SPELL_GROUND_TREMOR_TIMER < diff)
+ {
+ DoScriptText(SAY_QUAKE, m_creature);
+ m_creature->CastSpell(m_creature->getVictim(),SPELL_GROUND_TREMOR,true);
+ SPELL_GROUND_TREMOR_TIMER = 10000;
+ } else SPELL_GROUND_TREMOR_TIMER -= diff;
+
+ //CAST NUMBING SHOUT || DETERMINED_STAB
+ if (SPELL_NUMBING_SHOUT_TIMER < diff)
+ {
+ m_creature->CastSpell(m_creature->getVictim(),SPELL_NUMBING_SHOUT,true);
+ SPELL_NUMBING_SHOUT_TIMER = 10000;
+ } else SPELL_NUMBING_SHOUT_TIMER -= diff;
+
+ if (SPELL_DETERMINED_STAB_TIMER < diff)
+ {
+ m_creature->CastSpell(m_creature->getVictim(),SPELL_DETERMINED_STAB,true);
+ SPELL_DETERMINED_STAB_TIMER = 8000;
+ } else SPELL_DETERMINED_STAB_TIMER -= diff;
+ }
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit *killer)
+ {
+ DoScriptText(SAY_DEATH, m_creature);
+
+ if (HeroicMode && Phase == false)
+ {
+ AchievementEntry const *AchievLessRabi = GetAchievementStore()->LookupEntry(ACHIEVEMENT_LESS_RABI);
+ if (AchievLessRabi)
+ {
+ Map *pMap = m_creature->GetMap();
+ if (pMap && pMap->IsDungeon())
+ {
+ Map::PlayerList const &players = pMap->GetPlayers();
+ for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
+ itr->getSource()->CompletedAchievement(AchievLessRabi);
+ }
+ }
+ }
}
void KilledUnit(Unit *victim)
{
if (victim == m_creature)
return;
- switch(rand()%3)
- {
- case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
- case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
- case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
- }
+ DoScriptText(RAND(SAY_SLAY_2,SAY_SLAY_3), m_creature);
}
};
-CreatureAI* GetAI_boss_moorabi(Creature* pCreature)
+CreatureAI *GetAI_boss_moorabi(Creature *pCreature)
{
- return new boss_moorabiAI (pCreature);
+ return new boss_moorabiAI(pCreature);
}
void AddSC_boss_moorabi()
diff --git a/src/bindings/scripts/scripts/northrend/naxxramas/boss_grobbulus.cpp b/src/bindings/scripts/scripts/northrend/naxxramas/boss_grobbulus.cpp
index 9195e0e7828..3652b902eda 100644
--- a/src/bindings/scripts/scripts/northrend/naxxramas/boss_grobbulus.cpp
+++ b/src/bindings/scripts/scripts/northrend/naxxramas/boss_grobbulus.cpp
@@ -76,7 +76,7 @@ struct TRINITY_DLL_DECL boss_grobbulusAI : public BossAI
events.ScheduleEvent(EVENT_SPRAY, 15000+rand()%15000);
return;
case EVENT_INJECT:
- if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0))
+ if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 1))
if (!target->HasAura(SPELL_MUTATING_INJECTION))
DoCast(target, SPELL_MUTATING_INJECTION);
events.ScheduleEvent(EVENT_INJECT, 8000 + 12000 * ((float)me->GetHealth() / me->GetMaxHealth()));
diff --git a/src/bindings/scripts/system/ScriptLoader.cpp b/src/bindings/scripts/system/ScriptLoader.cpp
index 432ad24ce33..e334070e520 100644
--- a/src/bindings/scripts/system/ScriptLoader.cpp
+++ b/src/bindings/scripts/system/ScriptLoader.cpp
@@ -261,6 +261,7 @@ extern void AddSC_ungoro_crater();
extern void AddSC_winterspring();
//northrend
+extern void AddSC_boss_moorabi();
extern void AddSC_instance_ahnkahet(); //Azjol-Nerub Ahn'kahet
extern void AddSC_boss_krik_thir();
extern void AddSC_boss_taldaram();
@@ -669,6 +670,7 @@ void AddScripts()
AddSC_winterspring();
//northrend
+ AddSC_boss_moorabi();
AddSC_instance_ahnkahet(); //Azjol-Nerub Ahn'kahet
AddSC_boss_krik_thir();
AddSC_boss_taldaram();
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 9e15ce994d0..03e88ed862a 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -1773,7 +1773,7 @@ void Creature::setDeathState(DeathState s)
if(m_formation && m_formation->getLeader() == this)
m_formation->FormationReset(true);
- if (canFly() && FallGround())
+ if ((canFly() || IsFlying()) && FallGround())
return;
Unit::setDeathState(CORPSE);
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 9a6ebb558fe..5a342306174 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -4442,8 +4442,27 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
}
}
+bool Player::FallGround(bool noDeath/* = false*/)
+{
+ // Let's abort after we called this function one time
+ if (getDeathState() == DEAD_FALLING && !noDeath)
+ return false;
+
+ float x, y, z;
+ GetPosition(x, y, z);
+ float ground_Z = GetMap()->GetVmapHeight(x, y, z, true);
+ if (fabs(ground_Z - z) < 0.1f)
+ return false;
+
+ GetMotionMaster()->MoveFall(ground_Z, EVENT_FALL_GROUND);
+ if(!noDeath) Unit::setDeathState(DEAD_FALLING);
+ return true;
+}
+
void Player::KillPlayer()
{
+ if(IsFlying()) FallGround();
+
SetMovement(MOVE_ROOT);
StopMirrorTimers(); //disable timers(bars)
diff --git a/src/game/Player.h b/src/game/Player.h
index 44df2282f0b..98596974178 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1748,6 +1748,7 @@ class MANGOS_DLL_SPEC Player : public Unit
Corpse *GetCorpse() const;
void SpawnCorpseBones();
void CreateCorpse();
+ bool FallGround(bool noDeath = false);
void KillPlayer();
uint32 GetResurrectionSpellId();
void ResurrectPlayer(float restore_percent, bool applySickness = false);