aboutsummaryrefslogtreecommitdiff
path: root/src/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/scripts')
-rw-r--r--src/scripts/eastern_kingdoms/blackrock_depths/boss_ambassador_flamelash.cpp2
-rw-r--r--src/scripts/eastern_kingdoms/blackrock_depths/boss_general_angerforge.cpp4
-rw-r--r--src/scripts/eastern_kingdoms/boss_kruul.cpp2
-rw-r--r--src/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp22
-rw-r--r--src/scripts/eastern_kingdoms/scholomance/boss_jandice_barov.cpp2
-rw-r--r--src/scripts/eastern_kingdoms/scholomance/boss_kormok.cpp4
-rw-r--r--src/scripts/eastern_kingdoms/stratholme/boss_nerubenkan.cpp2
-rw-r--r--src/scripts/eastern_kingdoms/zulaman/boss_janalai.cpp4
-rw-r--r--src/scripts/eastern_kingdoms/zulgurub/boss_arlokk.cpp7
-rw-r--r--src/scripts/eastern_kingdoms/zulgurub/boss_marli.cpp14
-rw-r--r--src/scripts/eastern_kingdoms/zulgurub/boss_thekal.cpp7
-rw-r--r--src/scripts/eastern_kingdoms/zulgurub/boss_venoxis.cpp7
-rw-r--r--src/scripts/kalimdor/maraudon/boss_noxxion.cpp2
-rw-r--r--src/scripts/northrend/naxxramas/boss_gluth.cpp2
-rw-r--r--src/scripts/northrend/naxxramas/boss_thaddius.cpp314
-rw-r--r--src/scripts/northrend/naxxramas/instance_naxxramas.cpp14
-rw-r--r--src/scripts/northrend/naxxramas/naxxramas.h11
-rw-r--r--src/scripts/world/npcs_special.cpp4
18 files changed, 288 insertions, 136 deletions
diff --git a/src/scripts/eastern_kingdoms/blackrock_depths/boss_ambassador_flamelash.cpp b/src/scripts/eastern_kingdoms/blackrock_depths/boss_ambassador_flamelash.cpp
index a6146827240..82475e89fec 100644
--- a/src/scripts/eastern_kingdoms/blackrock_depths/boss_ambassador_flamelash.cpp
+++ b/src/scripts/eastern_kingdoms/blackrock_depths/boss_ambassador_flamelash.cpp
@@ -45,7 +45,7 @@ struct TRINITY_DLL_DECL boss_ambassador_flamelashAI : public ScriptedAI
void SummonSpirits(Unit* victim)
{
- if (Creature *Spirit = DoSpawnCreature(9178, RAND(irand(0,-9),irand(0,9)), RAND(irand(0,-9),irand(0,9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000))
+ if (Creature *Spirit = DoSpawnCreature(9178, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000))
Spirit->AI()->AttackStart(victim);
}
diff --git a/src/scripts/eastern_kingdoms/blackrock_depths/boss_general_angerforge.cpp b/src/scripts/eastern_kingdoms/blackrock_depths/boss_general_angerforge.cpp
index c0370e57e25..fe33defffd7 100644
--- a/src/scripts/eastern_kingdoms/blackrock_depths/boss_general_angerforge.cpp
+++ b/src/scripts/eastern_kingdoms/blackrock_depths/boss_general_angerforge.cpp
@@ -55,13 +55,13 @@ struct TRINITY_DLL_DECL boss_general_angerforgeAI : public ScriptedAI
void SummonAdds(Unit* victim)
{
- if (Creature *SummonedAdd = DoSpawnCreature(8901, RAND(irand(0,-14),irand(0,14)), RAND(irand(0,-14),irand(0,14)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000))
+ if (Creature *SummonedAdd = DoSpawnCreature(8901, irand(-14,14), irand(-14,14), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000))
SummonedAdd->AI()->AttackStart(victim);
}
void SummonMedics(Unit* victim)
{
- if (Creature *SummonedMedic = DoSpawnCreature(8894, RAND(irand(0,-9),irand(0,9)), RAND(irand(0,-9),irand(0,9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000))
+ if (Creature *SummonedMedic = DoSpawnCreature(8894, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000))
SummonedMedic->AI()->AttackStart(victim);
}
diff --git a/src/scripts/eastern_kingdoms/boss_kruul.cpp b/src/scripts/eastern_kingdoms/boss_kruul.cpp
index 12c12cab3de..2e06e33b51b 100644
--- a/src/scripts/eastern_kingdoms/boss_kruul.cpp
+++ b/src/scripts/eastern_kingdoms/boss_kruul.cpp
@@ -66,7 +66,7 @@ struct TRINITY_DLL_DECL boss_kruulAI : public ScriptedAI
void SummonHounds(Unit* pVictim)
{
- if (Creature *Hound = DoSpawnCreature(19207, RAND(irand(0,-9),irand(0,9)), RAND(irand(0,-9),irand(0,9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000))
+ if (Creature *Hound = DoSpawnCreature(19207, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000))
Hound->AI()->AttackStart(pVictim);
}
diff --git a/src/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp b/src/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp
index 6a40cecacb6..dcba83ab249 100644
--- a/src/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp
+++ b/src/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp
@@ -270,11 +270,8 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI
//damage
const CreatureInfo *cinfo = m_creature->GetCreatureInfo();
- const CreatureBaseStats *stats = ((CreatureBaseStats*)m_creature)->GetBaseStats(m_creature->getLevel(), cinfo->unit_class);
- float mindmg = stats->GenerateMinDmg(cinfo);
- float maxdmg = stats->GenerateMaxDmg(cinfo);
- m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, mindmg);
- m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, maxdmg);
+ m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->mindmg);
+ m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cinfo->maxdmg);
m_creature->UpdateDamagePhysical(BASE_ATTACK);
}
@@ -396,18 +393,15 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI
//damage
const CreatureInfo *cinfo = m_creature->GetCreatureInfo();
- const CreatureBaseStats *stats = ((CreatureBaseStats*)m_creature)->GetBaseStats(m_creature->getLevel(), cinfo->unit_class);
- float mindmg = stats->GenerateMinDmg(cinfo);
- float maxdmg = stats->GenerateMaxDmg(cinfo);
- m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2 * mindmg);
- m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2 * maxdmg);
+ m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg);
+ m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg);
m_creature->UpdateDamagePhysical(BASE_ATTACK);
- m_creature->SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, mindmg);
- m_creature->SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, maxdmg);
+ m_creature->SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cinfo->mindmg);
+ m_creature->SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cinfo->maxdmg);
//Sigh, updating only works on main attack, do it manually ....
- m_creature->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, mindmg);
- m_creature->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, maxdmg);
+ m_creature->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, cinfo->mindmg);
+ m_creature->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, cinfo->maxdmg);
m_creature->SetAttackTime(OFF_ATTACK, (m_creature->GetAttackTime(BASE_ATTACK)*150)/100);
}
diff --git a/src/scripts/eastern_kingdoms/scholomance/boss_jandice_barov.cpp b/src/scripts/eastern_kingdoms/scholomance/boss_jandice_barov.cpp
index 7c120dbda0b..e836037ec0e 100644
--- a/src/scripts/eastern_kingdoms/scholomance/boss_jandice_barov.cpp
+++ b/src/scripts/eastern_kingdoms/scholomance/boss_jandice_barov.cpp
@@ -53,7 +53,7 @@ struct TRINITY_DLL_DECL boss_jandicebarovAI : public ScriptedAI
void SummonIllusions(Unit* victim)
{
- if (Creature *Illusion = DoSpawnCreature(11439, RAND(irand(0,-9),irand(0,9)), RAND(irand(0,-9),irand(0,9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000))
+ if (Creature *Illusion = DoSpawnCreature(11439, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000))
Illusion->AI()->AttackStart(victim);
}
diff --git a/src/scripts/eastern_kingdoms/scholomance/boss_kormok.cpp b/src/scripts/eastern_kingdoms/scholomance/boss_kormok.cpp
index 5ffea850954..15a7729bf36 100644
--- a/src/scripts/eastern_kingdoms/scholomance/boss_kormok.cpp
+++ b/src/scripts/eastern_kingdoms/scholomance/boss_kormok.cpp
@@ -51,13 +51,13 @@ struct TRINITY_DLL_DECL boss_kormokAI : public ScriptedAI
void SummonMinions(Unit* victim)
{
- if (Creature *SummonedMinion = DoSpawnCreature(16119, RAND(irand(0,-7),irand(0,7)), RAND(irand(0,-7),irand(0,7)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000))
+ if (Creature *SummonedMinion = DoSpawnCreature(16119, irand(-7,7), irand(-7,7), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000))
SummonedMinion->AI()->AttackStart(victim);
}
void SummonMages(Unit* victim)
{
- if (Creature *SummonedMage = DoSpawnCreature(16120, RAND(irand(0,-9),irand(0,9)), RAND(irand(0,-9),irand(0,9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000))
+ if (Creature *SummonedMage = DoSpawnCreature(16120, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000))
SummonedMage->AI()->AttackStart(victim);
}
diff --git a/src/scripts/eastern_kingdoms/stratholme/boss_nerubenkan.cpp b/src/scripts/eastern_kingdoms/stratholme/boss_nerubenkan.cpp
index b5785be38a1..e3b965926ea 100644
--- a/src/scripts/eastern_kingdoms/stratholme/boss_nerubenkan.cpp
+++ b/src/scripts/eastern_kingdoms/stratholme/boss_nerubenkan.cpp
@@ -63,7 +63,7 @@ struct TRINITY_DLL_DECL boss_nerubenkanAI : public ScriptedAI
void RaiseUndeadScarab(Unit* pVictim)
{
- if (Creature* pUndeadScarab = DoSpawnCreature(10876, RAND(irand(-9,0),irand(0,9)), RAND(irand(-9,0),irand(0,9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000))
+ if (Creature* pUndeadScarab = DoSpawnCreature(10876, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000))
if (pUndeadScarab->AI())
pUndeadScarab->AI()->AttackStart(pVictim);
}
diff --git a/src/scripts/eastern_kingdoms/zulaman/boss_janalai.cpp b/src/scripts/eastern_kingdoms/zulaman/boss_janalai.cpp
index 8981645221c..aef4b337a97 100644
--- a/src/scripts/eastern_kingdoms/zulaman/boss_janalai.cpp
+++ b/src/scripts/eastern_kingdoms/zulaman/boss_janalai.cpp
@@ -213,8 +213,8 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI
float dx, dy;
for (int i(0); i < 40; ++i)
{
- dx =(rand()%(area_dx))-(area_dx/2);
- dy =(rand()%(area_dy))-(area_dy/2);
+ dx = irand(-area_dx/2, area_dx/2);
+ dy = irand(-area_dy/2, area_dy/2);
Creature* bomb = DoSpawnCreature(MOB_FIRE_BOMB, dx, dy, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 15000);
if (bomb) FireBombGUIDs[i] = bomb->GetGUID();
diff --git a/src/scripts/eastern_kingdoms/zulgurub/boss_arlokk.cpp b/src/scripts/eastern_kingdoms/zulgurub/boss_arlokk.cpp
index 05ab5c81447..7cea97bb7c2 100644
--- a/src/scripts/eastern_kingdoms/zulgurub/boss_arlokk.cpp
+++ b/src/scripts/eastern_kingdoms/zulgurub/boss_arlokk.cpp
@@ -234,11 +234,8 @@ struct TRINITY_DLL_DECL boss_arlokkAI : public ScriptedAI
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
const CreatureInfo *cinfo = m_creature->GetCreatureInfo();
- const CreatureBaseStats *stats = ((CreatureBaseStats*)m_creature)->GetBaseStats(m_creature->getLevel(), cinfo->unit_class);
- float mindmg = stats->GenerateMinDmg(cinfo);
- float maxdmg = stats->GenerateMaxDmg(cinfo);
- m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (mindmg +((mindmg/100) * 35)));
- m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (maxdmg +((maxdmg/100) * 35)));
+ m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35)));
+ m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35)));
m_creature->UpdateDamagePhysical(BASE_ATTACK);
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
diff --git a/src/scripts/eastern_kingdoms/zulgurub/boss_marli.cpp b/src/scripts/eastern_kingdoms/zulgurub/boss_marli.cpp
index e240ae5db9a..e4b12ffb972 100644
--- a/src/scripts/eastern_kingdoms/zulgurub/boss_marli.cpp
+++ b/src/scripts/eastern_kingdoms/zulgurub/boss_marli.cpp
@@ -145,11 +145,8 @@ struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI
DoScriptText(SAY_TRANSFORM, m_creature);
DoCast(m_creature, SPELL_SPIDER_FORM);
const CreatureInfo *cinfo = m_creature->GetCreatureInfo();
- const CreatureBaseStats *stats = ((CreatureBaseStats*)m_creature)->GetBaseStats(m_creature->getLevel(), cinfo->unit_class);
- float mindmg = stats->GenerateMinDmg(cinfo);
- float maxdmg = stats->GenerateMaxDmg(cinfo);
- m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (mindmg +((mindmg/100) * 35)));
- m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (maxdmg +((maxdmg/100) * 35)));
+ m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35)));
+ m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35)));
m_creature->UpdateDamagePhysical(BASE_ATTACK);
DoCast(m_creature->getVictim(), SPELL_ENVOLWINGWEB);
@@ -188,11 +185,8 @@ struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI
{
m_creature->SetDisplayId(15220);
const CreatureInfo *cinfo = m_creature->GetCreatureInfo();
- const CreatureBaseStats *stats = ((CreatureBaseStats*)m_creature)->GetBaseStats(m_creature->getLevel(), cinfo->unit_class);
- float mindmg = stats->GenerateMinDmg(cinfo);
- float maxdmg = stats->GenerateMaxDmg(cinfo);
- m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (mindmg +((mindmg/100) * 1)));
- m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (maxdmg +((maxdmg/100) * 1)));
+ m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1)));
+ m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1)));
m_creature->UpdateDamagePhysical(BASE_ATTACK);
PhaseTwo = false;
diff --git a/src/scripts/eastern_kingdoms/zulgurub/boss_thekal.cpp b/src/scripts/eastern_kingdoms/zulgurub/boss_thekal.cpp
index 3f8b49c8970..e7002673cd3 100644
--- a/src/scripts/eastern_kingdoms/zulgurub/boss_thekal.cpp
+++ b/src/scripts/eastern_kingdoms/zulgurub/boss_thekal.cpp
@@ -185,11 +185,8 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetHealth(int(m_creature->GetMaxHealth()*1.0));
const CreatureInfo *cinfo = m_creature->GetCreatureInfo();
- const CreatureBaseStats *stats = ((CreatureBaseStats*)m_creature)->GetBaseStats(m_creature->getLevel(), cinfo->unit_class);
- float mindmg = stats->GenerateMinDmg(cinfo);
- float maxdmg = stats->GenerateMaxDmg(cinfo);
- m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (mindmg +((mindmg/100) * 40)));
- m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (maxdmg +((maxdmg/100) * 40)));
+ m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 40)));
+ m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 40)));
m_creature->UpdateDamagePhysical(BASE_ATTACK);
DoResetThreat();
PhaseTwo = true;
diff --git a/src/scripts/eastern_kingdoms/zulgurub/boss_venoxis.cpp b/src/scripts/eastern_kingdoms/zulgurub/boss_venoxis.cpp
index 5ea03ab4615..3b094b74b1e 100644
--- a/src/scripts/eastern_kingdoms/zulgurub/boss_venoxis.cpp
+++ b/src/scripts/eastern_kingdoms/zulgurub/boss_venoxis.cpp
@@ -148,11 +148,8 @@ struct TRINITY_DLL_DECL boss_venoxisAI : public ScriptedAI
DoCast(m_creature, SPELL_SNAKE_FORM);
m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f);
const CreatureInfo *cinfo = m_creature->GetCreatureInfo();
- const CreatureBaseStats *stats = ((CreatureBaseStats*)m_creature)->GetBaseStats(m_creature->getLevel(), cinfo->unit_class);
- float mindmg = stats->GenerateMinDmg(cinfo);
- float maxdmg = stats->GenerateMaxDmg(cinfo);
- m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (mindmg +((mindmg/100) * 25)));
- m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (maxdmg +((maxdmg/100) * 25)));
+ m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 25)));
+ m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 25)));
m_creature->UpdateDamagePhysical(BASE_ATTACK);
DoResetThreat();
PhaseTwo = true;
diff --git a/src/scripts/kalimdor/maraudon/boss_noxxion.cpp b/src/scripts/kalimdor/maraudon/boss_noxxion.cpp
index 70bc4b67368..9fa9a9079cf 100644
--- a/src/scripts/kalimdor/maraudon/boss_noxxion.cpp
+++ b/src/scripts/kalimdor/maraudon/boss_noxxion.cpp
@@ -51,7 +51,7 @@ struct TRINITY_DLL_DECL boss_noxxionAI : public ScriptedAI
void SummonAdds(Unit* pVictim)
{
- if (Creature *Add = DoSpawnCreature(13456, RAND(irand(0,-7),irand(0,7)), RAND(irand(0,-7),irand(0,7)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000))
+ if (Creature *Add = DoSpawnCreature(13456, irand(-7,7), irand(-7,7), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000))
Add->AI()->AttackStart(pVictim);
}
diff --git a/src/scripts/northrend/naxxramas/boss_gluth.cpp b/src/scripts/northrend/naxxramas/boss_gluth.cpp
index 51fe10ff001..525d9fd0f65 100644
--- a/src/scripts/northrend/naxxramas/boss_gluth.cpp
+++ b/src/scripts/northrend/naxxramas/boss_gluth.cpp
@@ -138,7 +138,7 @@ struct TRINITY_DLL_DECL boss_gluthAI : public BossAI
}
}
- if (me->getVictim()->GetEntry() == MOB_ZOMBIE)
+ if (me->getVictim() && me->getVictim()->GetEntry() == MOB_ZOMBIE)
{
if (me->IsWithinMeleeRange(me->getVictim()))
{
diff --git a/src/scripts/northrend/naxxramas/boss_thaddius.cpp b/src/scripts/northrend/naxxramas/boss_thaddius.cpp
index fa685759e83..b2a4b16b2a7 100644
--- a/src/scripts/northrend/naxxramas/boss_thaddius.cpp
+++ b/src/scripts/northrend/naxxramas/boss_thaddius.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 - 2009 Trinity <http://www.trinitycore.org/>
+ * Copyright (C) 2008 - 2010 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
@@ -18,19 +18,22 @@
#include "ScriptedPch.h"
#include "naxxramas.h"
+#include "SpellId.h"
//Stalagg
enum StalaggYells
{
SAY_STAL_AGGRO = -1533023, //not used
SAY_STAL_SLAY = -1533024, //not used
- SAY_STAL_DEATH = -1533025 //not used
+ SAY_STAL_DEATH = -1533025 //not used
};
enum StalagSpells
{
- SPELL_POWERSURGE = 54529,
- H_SPELL_POWERSURGE = 28134
+ SPELL_POWERSURGE = SPELL_POWER_SURGE_28134,
+ H_SPELL_POWERSURGE = SPELL_POWER_SURGE_54529,
+ SPELL_MAGNETIC_PULL = SPELL_MAGNETIC_PULL_28338,
+ SPELL_STALAGG_TESLA = SPELL_STALAGG_TESLA_PASSIVE_28097
};
//Feugen
@@ -43,8 +46,18 @@ enum FeugenYells
enum FeugenSpells
{
- SPELL_STATICFIELD = 28135,
- H_SPELL_STATICFIELD = 54528
+ SPELL_STATICFIELD = SPELL_STATIC_FIELD_28135,
+ H_SPELL_STATICFIELD = SPELL_STATIC_FIELD_54528,
+ SPELL_FEUGEN_TESLA = SPELL_FEUGEN_TESLA_PASSIVE_28109
+};
+
+// Thaddius DoAction
+enum ThaddiusActions
+{
+ ACTION_FEUGEN_RESET,
+ ACTION_FEUGEN_DIED,
+ ACTION_STALAGG_RESET,
+ ACTION_STALAGG_DIED
};
//generic
@@ -68,11 +81,11 @@ enum ThaddiusYells
enum ThaddiusSpells
{
- SPELL_POLARITY_SHIFT = 28089,
- SPELL_BALL_LIGHTNING = 28299,
- SPELL_CHAIN_LIGHTNING = 28167,
- H_SPELL_CHAIN_LIGHTNING = 54531,
- SPELL_BERSERK = 27680
+ SPELL_POLARITY_SHIFT = SPELL_POLARITY_SHIFT_28089,
+ SPELL_BALL_LIGHTNING = SPELL_BALL_LIGHTNING_28299,
+ SPELL_CHAIN_LIGHTNING = SPELL_CHAIN_LIGHTNING_28167,
+ H_SPELL_CHAIN_LIGHTNING = SPELL_CHAIN_LIGHTNING_54531,
+ SPELL_BERSERK = SPELL_BERSERK_27680
};
enum Events
@@ -83,17 +96,39 @@ enum Events
EVENT_BERSERK,
};
-bool CheckStalaggAlive = true;
-bool CheckFeugenAlive = true;
-
struct TRINITY_DLL_DECL boss_thaddiusAI : public BossAI
{
boss_thaddiusAI(Creature *c) : BossAI(c, BOSS_THADDIUS)
{
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED);
- me->SetReactState(REACT_PASSIVE);
+ // init is a bit tricky because thaddius shall track the life of both adds, but not if there was a wipe
+ // and, in particular, if there was a crash after both adds were killed (should not respawn)
+
+ // Moreover, the adds may not yet be spawn. So just track down the status if mob is spawn
+ // and each mob will send its status at reset (meaning that it is alive)
+ checkFeugenAlive = false;
+ if (Creature *pFeugen = m_creature->GetCreature(*m_creature, instance->GetData64(DATA_FEUGEN)))
+ checkFeugenAlive = pFeugen->isAlive();
+
+ checkStalaggAlive = false;
+ if (Creature *pStalagg = m_creature->GetCreature(*m_creature, instance->GetData64(DATA_STALAGG)))
+ checkStalaggAlive = pStalagg->isAlive();
+
+ if (!checkFeugenAlive && !checkStalaggAlive)
+ {
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED);
+ me->SetReactState(REACT_AGGRESSIVE);
+ }
+ else
+ {
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED);
+ me->SetReactState(REACT_PASSIVE);
+ }
}
+ bool checkStalaggAlive;
+ bool checkFeugenAlive;
+ uint32 uiAddsTimer;
+
void KilledUnit(Unit* victim)
{
if (!(rand()%5))
@@ -106,6 +141,37 @@ struct TRINITY_DLL_DECL boss_thaddiusAI : public BossAI
DoScriptText(SAY_DEATH, me);
}
+ void DoAction(const int32 action)
+ {
+ switch(action)
+ {
+ case ACTION_FEUGEN_RESET:
+ checkFeugenAlive = true;
+ break;
+ case ACTION_FEUGEN_DIED:
+ checkFeugenAlive = false;
+ break;
+ case ACTION_STALAGG_RESET:
+ checkStalaggAlive = true;
+ break;
+ case ACTION_STALAGG_DIED:
+ checkStalaggAlive = false;
+ break;
+ }
+
+ if (!checkFeugenAlive && !checkStalaggAlive)
+ {
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED);
+ // REACT_AGGRESSIVE only reset when he takes damage.
+ DoZoneInCombat();
+ }
+ else
+ {
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED);
+ me->SetReactState(REACT_PASSIVE);
+ }
+ }
+
void EnterCombat(Unit *who)
{
_EnterCombat();
@@ -115,17 +181,40 @@ struct TRINITY_DLL_DECL boss_thaddiusAI : public BossAI
events.ScheduleEvent(EVENT_BERSERK, 360000);
}
+ void DamageTaken(Unit *pDoneBy, uint32 &uiDamage)
+ {
+ me->SetReactState(REACT_AGGRESSIVE);
+ }
+
void UpdateAI(const uint32 diff)
{
- if (CheckStalaggAlive == false && CheckFeugenAlive == false) {
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED);
- me->SetReactState(REACT_AGGRESSIVE);
- }
+ if (checkFeugenAlive && checkStalaggAlive)
+ uiAddsTimer = 0;
- if (!UpdateVictim())
- return;
+ if (checkStalaggAlive != checkFeugenAlive)
+ {
+ uiAddsTimer += diff;
+ if (uiAddsTimer > 5000)
+ {
+ if (!checkStalaggAlive)
+ {
+ if (instance)
+ if (Creature *pStalagg = m_creature->GetCreature(*m_creature, instance->GetData64(DATA_STALAGG)))
+ pStalagg->Respawn();
+ }
+ else
+ {
+ if (instance)
+ if (Creature *pFeugen = m_creature->GetCreature(*m_creature, instance->GetData64(DATA_FEUGEN)))
+ pFeugen->Respawn();
+ }
+ }
+ }
+
+ if (!UpdateVictim())
+ return;
- events.Update(diff);
+ events.Update(diff);
if (me->hasUnitState(UNIT_STAT_CASTING))
return;
@@ -162,29 +251,76 @@ CreatureAI* GetAI_boss_thaddius(Creature* pCreature)
struct TRINITY_DLL_DECL mob_stalaggAI : public ScriptedAI
{
- mob_stalaggAI(Creature *c) : ScriptedAI(c) {}
-
- uint32 PowerSurgeTimer;
-
- void reset()
- {
- PowerSurgeTimer = urand(20000,25000);
- }
-
- void JustDied(Unit *killer)
- {
- CheckStalaggAlive = false;
- }
-
- void UpdateAI(const uint32 uiDiff)
- {
- if (PowerSurgeTimer <= uiDiff)
- {
- DoCast(m_creature, RAID_MODE(SPELL_POWERSURGE, H_SPELL_POWERSURGE));
- PowerSurgeTimer = urand(15000,20000);
- } else PowerSurgeTimer -= uiDiff;
- DoMeleeAttackIfReady();
- }
+ mob_stalaggAI(Creature *c) : ScriptedAI(c)
+ {
+ pInstance = c->GetInstanceData();
+ }
+
+ ScriptedInstance* pInstance;
+
+ uint32 powerSurgeTimer;
+ uint32 magneticPullTimer;
+
+ void Reset()
+ {
+ if (pInstance)
+ if (Creature *pThaddius = m_creature->GetCreature(*m_creature, pInstance->GetData64(DATA_THADDIUS)))
+ if (pThaddius->AI())
+ pThaddius->AI()->DoAction(ACTION_STALAGG_RESET);
+ powerSurgeTimer = urand(20000,25000);
+ magneticPullTimer = 20000;
+ }
+
+ void EnterCombat(Unit *pWho)
+ {
+ DoCast(SPELL_STALAGG_TESLA);
+ }
+
+ void JustDied(Unit *killer)
+ {
+ if (pInstance)
+ if (Creature *pThaddius = m_creature->GetCreature(*m_creature, pInstance->GetData64(DATA_THADDIUS)))
+ if (pThaddius->AI())
+ pThaddius->AI()->DoAction(ACTION_STALAGG_DIED);
+ }
+
+ void UpdateAI(const uint32 uiDiff)
+ {
+ if (!UpdateVictim())
+ return;
+
+ if (magneticPullTimer <= uiDiff)
+ {
+ if (Creature *pFeugen = m_creature->GetCreature(*m_creature, pInstance->GetData64(DATA_FEUGEN)))
+ {
+ Unit* pStalaggVictim = m_creature->getVictim();
+ Unit* pFeugenVictim = pFeugen->getVictim();
+
+ if (pFeugenVictim && pStalaggVictim)
+ {
+ // magnetic pull is not working. So just jump.
+
+ // reset aggro to be sure that feugen will not follow the jump
+ pFeugen->getThreatManager().modifyThreatPercent(pFeugenVictim, -100);
+ pFeugenVictim->JumpTo(m_creature, 0.3f);
+
+ m_creature->getThreatManager().modifyThreatPercent(pStalaggVictim, -100);
+ pStalaggVictim->JumpTo(pFeugen, 0.3f);
+ }
+ }
+
+ magneticPullTimer = 20000;
+ }
+ else magneticPullTimer -= uiDiff;
+
+ if (powerSurgeTimer <= uiDiff)
+ {
+ DoCast(m_creature, RAID_MODE(SPELL_POWERSURGE, H_SPELL_POWERSURGE));
+ powerSurgeTimer = urand(15000,20000);
+ } else powerSurgeTimer -= uiDiff;
+
+ DoMeleeAttackIfReady();
+ }
};
CreatureAI* GetAI_mob_stalagg(Creature* pCreature)
@@ -194,35 +330,55 @@ CreatureAI* GetAI_mob_stalagg(Creature* pCreature)
struct TRINITY_DLL_DECL mob_feugenAI : public ScriptedAI
{
- mob_feugenAI(Creature *c) : ScriptedAI(c) {}
-
- uint32 StaticFieldTimer;
- uint32 Checktimer;
-
- void reset()
- {
- StaticFieldTimer = 5000;
- }
-
- void JustDied(Unit *killer)
- {
- CheckFeugenAlive = false;
- }
-
- void UpdateAI(const uint32 uiDiff)
- {
- if (StaticFieldTimer <= uiDiff)
- {
- DoCast(m_creature, RAID_MODE(SPELL_STATICFIELD, H_SPELL_STATICFIELD));
- StaticFieldTimer = 5000;
- } else StaticFieldTimer -= uiDiff;
- DoMeleeAttackIfReady();
- }
+ mob_feugenAI(Creature *c) : ScriptedAI(c)
+ {
+ pInstance = c->GetInstanceData();
+ }
+
+ ScriptedInstance* pInstance;
+
+ uint32 staticFieldTimer;
+
+ void Reset()
+ {
+ if (pInstance)
+ if (Creature *pThaddius = m_creature->GetCreature(*m_creature, pInstance->GetData64(DATA_THADDIUS)))
+ if (pThaddius->AI())
+ pThaddius->AI()->DoAction(ACTION_FEUGEN_RESET);
+ staticFieldTimer = 5000;
+ }
+
+ void EnterCombat(Unit *pWho)
+ {
+ DoCast(SPELL_FEUGEN_TESLA);
+ }
+
+ void JustDied(Unit *killer)
+ {
+ if (pInstance)
+ if (Creature *pThaddius = m_creature->GetCreature(*m_creature, pInstance->GetData64(DATA_THADDIUS)))
+ if (pThaddius->AI())
+ pThaddius->AI()->DoAction(ACTION_FEUGEN_DIED);
+ }
+
+ void UpdateAI(const uint32 uiDiff)
+ {
+ if (!UpdateVictim())
+ return;
+
+ if (staticFieldTimer <= uiDiff)
+ {
+ DoCast(m_creature, RAID_MODE(SPELL_STATICFIELD, H_SPELL_STATICFIELD));
+ staticFieldTimer = 5000;
+ } else staticFieldTimer -= uiDiff;
+
+ DoMeleeAttackIfReady();
+ }
};
CreatureAI* GetAI_mob_feugen(Creature* pCreature)
{
- return new mob_feugenAI(pCreature);
+ return new mob_feugenAI(pCreature);
}
void AddSC_boss_thaddius()
@@ -233,13 +389,13 @@ void AddSC_boss_thaddius()
newscript->GetAI = &GetAI_boss_thaddius;
newscript->RegisterSelf();
- newscript = new Script;
- newscript->Name = "mob_stalagg";
- newscript->GetAI = &GetAI_mob_stalagg;
- newscript->RegisterSelf();
+ newscript = new Script;
+ newscript->Name = "mob_stalagg";
+ newscript->GetAI = &GetAI_mob_stalagg;
+ newscript->RegisterSelf();
- newscript = new Script;
- newscript->Name = "mob_feugen";
- newscript->GetAI = &GetAI_mob_feugen;
- newscript->RegisterSelf();
+ newscript = new Script;
+ newscript->Name = "mob_feugen";
+ newscript->GetAI = &GetAI_mob_feugen;
+ newscript->RegisterSelf();
}
diff --git a/src/scripts/northrend/naxxramas/instance_naxxramas.cpp b/src/scripts/northrend/naxxramas/instance_naxxramas.cpp
index 103dba7e4b8..19a330b58d6 100644
--- a/src/scripts/northrend/naxxramas/instance_naxxramas.cpp
+++ b/src/scripts/northrend/naxxramas/instance_naxxramas.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008 - 2009 Trinity <http://www.trinitycore.org/>
+/* Copyright (C) 2008 - 2010 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
@@ -115,6 +115,9 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData
uint64 uiBaron;
uint64 uiSir;
+ uint64 uiThaddius;
+ uint64 uiFeugen;
+ uint64 uiStalagg;
void OnCreatureCreate(Creature* pCreature, bool add)
{
@@ -126,6 +129,9 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData
case 16065: uiLady = pCreature->GetGUID(); return;
case 30549: uiBaron = pCreature->GetGUID(); return;
case 16063: uiSir = pCreature->GetGUID(); return;
+ case 15928: uiThaddius = pCreature->GetGUID(); return;
+ case 15930: uiFeugen = pCreature->GetGUID(); return;
+ case 15929: uiStalagg = pCreature->GetGUID(); return;
}
AddMinion(pCreature, add);
@@ -180,6 +186,12 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData
return uiBaron;
if (id == DATA_SIR)
return uiSir;
+ if (id == DATA_THADDIUS)
+ return uiThaddius;
+ if (id == DATA_FEUGEN)
+ return uiFeugen;
+ if (id == DATA_STALAGG)
+ return uiStalagg;
return 0;
}
diff --git a/src/scripts/northrend/naxxramas/naxxramas.h b/src/scripts/northrend/naxxramas/naxxramas.h
index 6f4dcae41a7..48121ff1309 100644
--- a/src/scripts/northrend/naxxramas/naxxramas.h
+++ b/src/scripts/northrend/naxxramas/naxxramas.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 - 2009 Trinity <http://www.trinitycore.org/>
+ * Copyright (C) 2008 - 2010 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
@@ -44,11 +44,18 @@ enum Data
DATA_HEIGAN_ERUPT,
DATA_GOTHIK_GATE,
DATA_SAPPHIRON_BIRTH,
+};
+
+enum Data64
+{
DATA_FAERLINA,
DATA_THANE,
DATA_LADY,
DATA_BARON,
- DATA_SIR
+ DATA_SIR,
+ DATA_THADDIUS,
+ DATA_FEUGEN,
+ DATA_STALAGG
};
#define GO_BIRTH 181356
diff --git a/src/scripts/world/npcs_special.cpp b/src/scripts/world/npcs_special.cpp
index 93e68d074e1..a57507f9c6a 100644
--- a/src/scripts/world/npcs_special.cpp
+++ b/src/scripts/world/npcs_special.cpp
@@ -1580,7 +1580,6 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI
SpellTimer = 0;
CreatureInfo const *Info = m_creature->GetCreatureInfo();
- CreatureBaseStats const *stats = ((CreatureBaseStats*)m_creature)->GetBaseStats(m_creature->getLevel(), Info->unit_class);
if (Info->Entry == C_VIPER)
IsViper = true;
@@ -1589,9 +1588,8 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI
//Add delta to make them not all hit the same time
uint32 delta = (rand() % 7) * 100;
- float attackpower = stats->GenerateAttackPower(Info);
m_creature->SetStatFloatValue(UNIT_FIELD_BASEATTACKTIME, Info->baseattacktime + delta);
- m_creature->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER , attackpower);
+ m_creature->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER , Info->attackpower);
}
//Redefined for random target selection: