*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
This commit is contained in:
maximius
2009-09-25 19:20:04 -07:00
parent 0febe02227
commit 2853aa1cd1
9 changed files with 175 additions and 42 deletions
@@ -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
#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
//not in db
//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()
@@ -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()));
@@ -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();
+1 -1
View File
@@ -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);
+19
View File
@@ -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)
+1
View File
@@ -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);