From 1fbc7377d1acfcee7397771c9d0def5ae345da8a Mon Sep 17 00:00:00 2001 From: megamage Date: Tue, 12 May 2009 11:16:26 -0500 Subject: *Do not show error for not assigned example scripts. --HG-- branch : trunk --- src/bindings/scripts/ScriptMgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bindings/scripts/ScriptMgr.cpp') diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 18465bfacf7..4d7ed09fff4 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -1657,7 +1657,7 @@ void Script::RegisterSelf() m_scripts[id] = this; ++num_sc_scripts; } - else + else if(Name.find("example") == std::string::npos) { error_db_log("CRASH ALERT! TrinityScript: RegisterSelf, but script named %s does not have ScriptName assigned in database.",(this)->Name.c_str()); delete this; -- cgit v1.2.3 From 80c19013432ec49fb5c1b57bf2d5aca7be0d53c7 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 13 May 2009 10:59:00 -0500 Subject: *Add script for Gothik. Please apply 3233_world_scripts_naxx.sql for new contents. --HG-- branch : trunk --- sql/updates/3233_world_scripts_naxx.sql | 1 + sql/world_scripts_full.sql | 1 + src/bindings/scripts/ScriptMgr.cpp | 2 + .../scripts/scripts/zone/naxxramas/boss_gothik.cpp | 361 +++++++++++++++++++-- .../scripts/zone/naxxramas/instance_naxxramas.cpp | 8 +- 5 files changed, 338 insertions(+), 35 deletions(-) (limited to 'src/bindings/scripts/ScriptMgr.cpp') diff --git a/sql/updates/3233_world_scripts_naxx.sql b/sql/updates/3233_world_scripts_naxx.sql index 67a8615951d..a5a71ba6233 100644 --- a/sql/updates/3233_world_scripts_naxx.sql +++ b/sql/updates/3233_world_scripts_naxx.sql @@ -6,6 +6,7 @@ INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comm (-28169, 28240, 0, 'Mutating Injection - Poison Cloud'); UPDATE creature_template SET scriptname = 'boss_grobbulus' WHERE entry = 15931; +update creature_template set scriptname='mob_gothik_minion' where entry in (16124,16125,16126,16127,16148,16149,16150); INSERT INTO creature_template (entry, spell1, flags_extra, scriptname) VALUES (16363, 28158, 128, ''), # Grobbulus Cloud diff --git a/sql/world_scripts_full.sql b/sql/world_scripts_full.sql index a1df130d207..8b28c3bc370 100644 --- a/sql/world_scripts_full.sql +++ b/sql/world_scripts_full.sql @@ -645,6 +645,7 @@ UPDATE `creature_template` SET `ScriptName`='boss_heigan' WHERE `entry`=15936; UPDATE `creature_template` SET `ScriptName`='boss_loatheb' WHERE `entry`=16011; UPDATE `creature_template` SET `ScriptName`='boss_razuvious' WHERE `entry`=16061; UPDATE `creature_template` SET `ScriptName`='boss_gothik' WHERE `entry`=16060; +UPDATE `creature_template` SET `ScriptName`='mob_gothik_minion' where `entry` IN (16124,16125,16126,16127,16148,16149,16150); UPDATE `creature_template` SET `ScriptName`='boss_thane_korthazz' WHERE `entry`=16064; UPDATE `creature_template` SET `ScriptName`='boss_sir_zeliek' WHERE `entry`=16063; UPDATE `creature_template` SET `ScriptName`='boss_lady_blaumeux' WHERE `entry`=16065; diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 4d7ed09fff4..849c4d64be5 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -389,6 +389,7 @@ extern void AddSC_boss_sapphiron(); extern void AddSC_boss_four_horsemen(); extern void AddSC_boss_faerlina(); extern void AddSC_boss_heigan(); +extern void AddSC_boss_gothik(); extern void AddSC_instance_naxxramas(); //Netherstorm @@ -1327,6 +1328,7 @@ void ScriptsInit(char const* cfg_file = "trinitycore.conf") AddSC_boss_sapphiron(); AddSC_boss_four_horsemen(); AddSC_boss_heigan(); + AddSC_boss_gothik(); AddSC_instance_naxxramas(); //Netherstorm diff --git a/src/bindings/scripts/scripts/zone/naxxramas/boss_gothik.cpp b/src/bindings/scripts/scripts/zone/naxxramas/boss_gothik.cpp index 3a9c6a5b47a..7def6c370f4 100644 --- a/src/bindings/scripts/scripts/zone/naxxramas/boss_gothik.cpp +++ b/src/bindings/scripts/scripts/zone/naxxramas/boss_gothik.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 +/* Copyright (C) 2008 - 2009 Trinity * 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,14 +14,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* ScriptData -SDName: Boss_Gothik -SD%Complete: 0 -SDComment: Placeholder -SDCategory: Naxxramas -EndScriptData */ - #include "precompiled.h" +#include "def_naxxramas.h" #define SAY_SPEECH -1533040 #define SAY_KILL -1533041 @@ -29,37 +23,336 @@ EndScriptData */ #define SAY_TELEPORT -1533043 //Gothik -#define SPELL_HARVESTSOUL 28679 -#define SPELL_SHADOWBOLT HEROIC(29317,56405) -#define SPELL_SOUL_SIPHON 43591 // cannot find the correct spell +#define SPELL_HARVEST_SOUL 28679 +#define SPELL_SHADOW_BOLT HEROIC(29317,56405) + +#define SPELL_INFORM_LIVE_TRAINEE 27892 +#define SPELL_INFORM_LIVE_KNIGHT 27928 +#define SPELL_INFORM_LIVE_RIDER 27935 +#define SPELL_INFORM_DEAD_TRAINEE 27915 +#define SPELL_INFORM_DEAD_KNIGHT 27931 +#define SPELL_INFORM_DEAD_RIDER 27937 + +#define MOB_LIVE_TRAINEE 16124 +#define MOB_LIVE_KNIGHT 16125 +#define MOB_LIVE_RIDER 16126 +#define MOB_DEAD_TRAINEE 16127 +#define MOB_DEAD_KNIGHT 16148 +#define MOB_DEAD_RIDER 16150 +#define MOB_DEAD_HORSE 16149 + +const struct Waves { uint32 entry, number, time; } +waves[] = +{ + {MOB_LIVE_TRAINEE, 2, 20000}, + {MOB_LIVE_TRAINEE, 2, 20000}, + {MOB_LIVE_TRAINEE, 2, 10000}, + {MOB_LIVE_KNIGHT, 1, 10000}, + {MOB_LIVE_TRAINEE, 2, 15000}, + {MOB_LIVE_KNIGHT, 1, 10000}, + {MOB_LIVE_TRAINEE, 2, 15000}, + {MOB_LIVE_TRAINEE, 2, 0}, + {MOB_LIVE_KNIGHT, 1, 10000}, + {MOB_LIVE_RIDER, 1, 10000}, + {MOB_LIVE_TRAINEE, 2, 5000}, + {MOB_LIVE_KNIGHT, 1, 15000}, + {MOB_LIVE_TRAINEE, 2, 0}, + {MOB_LIVE_RIDER, 1, 10000}, + {MOB_LIVE_KNIGHT, 2, 10000}, + {MOB_LIVE_TRAINEE, 2, 10000}, + {MOB_LIVE_RIDER, 1, 5000}, + {MOB_LIVE_KNIGHT, 1, 5000}, + {MOB_LIVE_TRAINEE, 2, 20000}, + {MOB_LIVE_TRAINEE, 2, 0}, + {MOB_LIVE_KNIGHT, 1, 0}, + {MOB_LIVE_RIDER, 1, 15000}, + {MOB_LIVE_TRAINEE, 2, 29000}, + {0, 0, 0}, +}; + +#define POS_Y_GATE -3360.78f + +enum Events +{ + EVENT_SUMMON = 1, + EVENT_HARVEST, + EVENT_BOLT, +}; + +#define POS_LIVE 3 +#define POS_DEAD 5 + +const float PosSummonLive[POS_LIVE][4] = +{ + {2669.7, -3430.9, 268.56, 1.6}, + {2692.0, -3430.9, 268.56, 1.6}, + {2714.1, -3430.9, 268.56, 1.6}, +}; + +const float PosSummonDead[POS_DEAD][4] = +{ + {2725.1, -3310.0, 268.85, 3.4}, + {2699.3, -3322.8, 268.60, 3.3}, + {2733.1, -3348.5, 268.84, 3.1}, + {2682.8, -3304.2, 268.85, 3.9}, + {2664.8, -3340.7, 268.23, 3.7}, +}; + +const float PosGround[4] = {2691.2, -3362.7, 267.68, 1.7}; +const float PosPlatform[4] = {2640.5, -3360.6, 285.26, 0}; + +struct TRINITY_DLL_DECL boss_gothikAI : public BossAI +{ + boss_gothikAI(Creature *c) : BossAI(c, BOSS_GOTHIK) {} + + uint32 waveCount; + std::vector liveTrigger; + std::vector deadTrigger; + + void Reset() + { + liveTrigger.clear(); + deadTrigger.clear(); + me->setActive(false); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + me->SetReactState(REACT_PASSIVE); + _Reset(); + } + + void EnterCombat(Unit *who) + { + for(uint32 i = 0; i < POS_LIVE; ++i) + if(Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonLive[i])) + liveTrigger.push_back(trigger); + for(uint32 i = 0; i < POS_DEAD; ++i) + if(Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonDead[i])) + deadTrigger.push_back(trigger); + + if(liveTrigger.size() < POS_LIVE || deadTrigger.size() < POS_DEAD) + { + error_log("Script Gothik: cannot summon triggers!"); + EnterEvadeMode(); + return; + } + + _EnterCombat(); + me->setActive(true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + waveCount = 0; + events.ScheduleEvent(EVENT_SUMMON, 30000); + DoTeleportTo(PosPlatform); + DoScriptText(SAY_SPEECH, me); + if(instance) + instance->SetData(DATA_GOTHIK_GATE, 1); + } + + void JustSummoned(Creature *summon) + { + if(summon->GetEntry() == WORLD_TRIGGER) + summon->setActive(true); + else + { + summon->AI()->DoAction(me->HasReactState(REACT_PASSIVE) ? 1 : 0); + summon->AI()->EnterEvadeMode(); + } + summons.Summon(summon); + } + + void KilledUnit(Unit* victim) + { + if(!(rand()%5)) + DoScriptText(SAY_KILL, me); + } + + void JustDied(Unit* Killer) + { + _JustDied(); + DoScriptText(SAY_DEATH, me); + } + + void SpellHit(Unit *caster, const SpellEntry *spell) + { + uint32 spellId = 0; + switch(spell->Id) + { + case SPELL_INFORM_LIVE_TRAINEE: spellId = SPELL_INFORM_DEAD_TRAINEE; break; + case SPELL_INFORM_LIVE_KNIGHT: spellId = SPELL_INFORM_DEAD_KNIGHT; break; + case SPELL_INFORM_LIVE_RIDER: spellId = SPELL_INFORM_DEAD_RIDER; break; + } + if(spellId && me->isInCombat()) + { + me->HandleEmoteCommand(EMOTE_ONESHOT_SPELLCAST); + me->CastSpell(deadTrigger[rand()%POS_DEAD], spellId, true); + } + } + + void SpellHitTarget(Unit *target, const SpellEntry *spell) + { + if(!me->isInCombat()) + return; + + switch(spell->Id) + { + case SPELL_INFORM_DEAD_TRAINEE: DoSummon(MOB_DEAD_TRAINEE, target, 0); break; + case SPELL_INFORM_DEAD_KNIGHT: DoSummon(MOB_DEAD_KNIGHT, target, 0); break; + case SPELL_INFORM_DEAD_RIDER: DoSummon(MOB_DEAD_RIDER, target, 1.0f); + DoSummon(MOB_DEAD_HORSE, target, 1.0f); break; + } + } + + void UpdateAI(const uint32 diff) + { + if(!me->isInCombat()) + return; + + if(me->getThreatManager().isThreatListEmpty()) + { + EnterEvadeMode(); + return; + } + + if(me->HasReactState(REACT_AGGRESSIVE) && !UpdateVictim()) + return; + + events.Update(diff); + + if(me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while(uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_SUMMON: + if(waves[waveCount].entry) + { + for(uint32 i = 0; i < waves[waveCount].number; ++i) + DoSummon(waves[waveCount].entry, liveTrigger[rand()%POS_LIVE], 1.0f); + events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time); + ++waveCount; + } + else + { + DoScriptText(SAY_TELEPORT, me); + DoTeleportTo(PosGround); + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + if(instance) + instance->SetData(DATA_GOTHIK_GATE, 0); + summons.DoAction(0, 0); + summons.DoZoneInCombat(); + events.ScheduleEvent(EVENT_BOLT, 1000); + events.ScheduleEvent(EVENT_HARVEST, 15000); + } + break; + case EVENT_BOLT: + DoCast(me->getVictim(), SPELL_SHADOW_BOLT); + events.ScheduleEvent(EVENT_BOLT, 1000); + return; + case EVENT_HARVEST: + DoCast(me->getVictim(), SPELL_HARVEST_SOUL); + events.ScheduleEvent(EVENT_HARVEST, 15000); + return; + } + } + + DoMeleeAttackIfReady(); + } +}; + +struct TRINITY_DLL_DECL mob_gothik_minionAI : public SpellAI +{ + mob_gothik_minionAI(Creature *c) : SpellAI(c) + { + liveSide = me->GetPositionY() < POS_Y_GATE; + } + + bool liveSide; + bool gateClose; + +#define SIDE_CHECK(who) (liveSide == (who->GetPositionY() < POS_Y_GATE)) + + void DoAction(const int32 param) + { + gateClose = param; + } + + void DamageTaken(Unit *attacker, uint32 &damage) + { + if(gateClose && !SIDE_CHECK(attacker)) + damage = 0; + } + + void JustDied(Unit *killer) + { + if(me->isSummon()) + { + if(Unit *owner = ((TempSummon*)me)->GetSummoner()) + SpellAI::JustDied(owner); + } + } + + void EnterEvadeMode() + { + if(!gateClose) + { + SpellAI::EnterEvadeMode(); + return; + } + + if(!_EnterEvadeMode()) + return; -//Unrelenting Trainee -#define SPELL_EAGLECLAW 30285 -#define SPELL_KNOCKDOWN_PASSIVE 6961 + Map *map = me->GetMap(); + if(map->IsDungeon()) + { + Map::PlayerList const &PlayerList = map->GetPlayers(); + for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if(i->getSource()->isAlive() && SIDE_CHECK(i->getSource())) + { + AttackStart(i->getSource()); + return; + } + } + } -//Unrelenting Deathknight -#define SPELL_CHARGE 22120 -#define SPELL_SHADOW_MARK 27825 + me->GetMotionMaster()->MoveIdle(); + Reset(); + } -//Unrelenting Rider -#define SPELL_UNHOLY_AURA 55606 -#define H_SPELL_UNHOLY_AURA 55608 -#define SPELL_SHADOWBOLT_VOLLEY 27831 //Search thru targets and find those who have the SHADOW_MARK to cast this on -#define H_SPELL_SHADOWBOLT_VOLLEY 55638 + void UpdateAI(const uint32 diff) + { + if(gateClose && (!SIDE_CHECK(me) || me->getVictim() && !SIDE_CHECK(me->getVictim()))) + { + EnterEvadeMode(); + return; + } -//Spectral Trainee -#define SPELL_ARCANE_EXPLOSION 27989 + SpellAI::UpdateAI(diff); + } +}; -//Spectral Deathknight -#define SPELL_WHIRLWIND 28334 -#define SPELL_SUNDER_ARMOR 25051 //cannot find sunder that reduces armor by 2950 -#define SPELL_CLEAVE 20677 -#define SPELL_MANA_BURN 17631 +CreatureAI* GetAI_boss_gothik(Creature *_Creature) +{ + return new boss_gothikAI (_Creature); +} -//Spectral Rider -#define SPELL_LIFEDRAIN 24300 -//USES SAME UNHOLY AURA AS UNRELENTING RIDER +CreatureAI* GetAI_mob_gothik_minion(Creature *_Creature) +{ + return new mob_gothik_minionAI (_Creature); +} -//Spectral Horse -#define SPELL_STOMP 27993 +void AddSC_boss_gothik() +{ + Script *newscript; + newscript = new Script; + newscript->Name="boss_gothik"; + newscript->GetAI = &GetAI_boss_gothik; + newscript->RegisterSelf(); + newscript = new Script; + newscript->Name="mob_gothik_minion"; + newscript->GetAI = &GetAI_mob_gothik_minion; + newscript->RegisterSelf(); +} diff --git a/src/bindings/scripts/scripts/zone/naxxramas/instance_naxxramas.cpp b/src/bindings/scripts/scripts/zone/naxxramas/instance_naxxramas.cpp index 23f44f5daf8..e5913660c3f 100644 --- a/src/bindings/scripts/scripts/zone/naxxramas/instance_naxxramas.cpp +++ b/src/bindings/scripts/scripts/zone/naxxramas/instance_naxxramas.cpp @@ -86,9 +86,10 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData LoadDoorData(doorData); } + std::set Worshipper; std::set HeiganEruption[4]; + GameObject *GothikGate; Creature *Sapphiron; - std::set Worshipper; void OnCreatureCreate(Creature *creature, bool add) { @@ -114,6 +115,7 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData switch(go->GetEntry()) { case GO_BIRTH: if(!add && Sapphiron) Sapphiron->AI()->DoAction(DATA_SAPPHIRON_BIRTH); return; + case GO_GOTHIK_GATE: GothikGate = add ? go : NULL; break; } AddDoor(go, add); @@ -140,6 +142,10 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData case DATA_HEIGAN_ERUPT: HeiganErupt(value); break; + case DATA_GOTHIK_GATE: + if(GothikGate) + GothikGate->SetGoState(GOState(value)); + break; } } -- cgit v1.2.3 From 42aa8efe477ee3f0a7ea25957cc5b03f3d0b19f0 Mon Sep 17 00:00:00 2001 From: QAston Date: Thu, 14 May 2009 06:32:35 +0200 Subject: Backed out changeset 1f92b07df94a --HG-- branch : trunk --- sql/updates/3233_world_scripts_naxx.sql | 1 - sql/world_scripts_full.sql | 1 - src/bindings/scripts/ScriptMgr.cpp | 2 - .../scripts/scripts/zone/naxxramas/boss_gothik.cpp | 361 ++------------------- .../scripts/zone/naxxramas/instance_naxxramas.cpp | 8 +- 5 files changed, 35 insertions(+), 338 deletions(-) (limited to 'src/bindings/scripts/ScriptMgr.cpp') diff --git a/sql/updates/3233_world_scripts_naxx.sql b/sql/updates/3233_world_scripts_naxx.sql index a5a71ba6233..67a8615951d 100644 --- a/sql/updates/3233_world_scripts_naxx.sql +++ b/sql/updates/3233_world_scripts_naxx.sql @@ -6,7 +6,6 @@ INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comm (-28169, 28240, 0, 'Mutating Injection - Poison Cloud'); UPDATE creature_template SET scriptname = 'boss_grobbulus' WHERE entry = 15931; -update creature_template set scriptname='mob_gothik_minion' where entry in (16124,16125,16126,16127,16148,16149,16150); INSERT INTO creature_template (entry, spell1, flags_extra, scriptname) VALUES (16363, 28158, 128, ''), # Grobbulus Cloud diff --git a/sql/world_scripts_full.sql b/sql/world_scripts_full.sql index 8b28c3bc370..a1df130d207 100644 --- a/sql/world_scripts_full.sql +++ b/sql/world_scripts_full.sql @@ -645,7 +645,6 @@ UPDATE `creature_template` SET `ScriptName`='boss_heigan' WHERE `entry`=15936; UPDATE `creature_template` SET `ScriptName`='boss_loatheb' WHERE `entry`=16011; UPDATE `creature_template` SET `ScriptName`='boss_razuvious' WHERE `entry`=16061; UPDATE `creature_template` SET `ScriptName`='boss_gothik' WHERE `entry`=16060; -UPDATE `creature_template` SET `ScriptName`='mob_gothik_minion' where `entry` IN (16124,16125,16126,16127,16148,16149,16150); UPDATE `creature_template` SET `ScriptName`='boss_thane_korthazz' WHERE `entry`=16064; UPDATE `creature_template` SET `ScriptName`='boss_sir_zeliek' WHERE `entry`=16063; UPDATE `creature_template` SET `ScriptName`='boss_lady_blaumeux' WHERE `entry`=16065; diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 849c4d64be5..4d7ed09fff4 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -389,7 +389,6 @@ extern void AddSC_boss_sapphiron(); extern void AddSC_boss_four_horsemen(); extern void AddSC_boss_faerlina(); extern void AddSC_boss_heigan(); -extern void AddSC_boss_gothik(); extern void AddSC_instance_naxxramas(); //Netherstorm @@ -1328,7 +1327,6 @@ void ScriptsInit(char const* cfg_file = "trinitycore.conf") AddSC_boss_sapphiron(); AddSC_boss_four_horsemen(); AddSC_boss_heigan(); - AddSC_boss_gothik(); AddSC_instance_naxxramas(); //Netherstorm diff --git a/src/bindings/scripts/scripts/zone/naxxramas/boss_gothik.cpp b/src/bindings/scripts/scripts/zone/naxxramas/boss_gothik.cpp index 7def6c370f4..3a9c6a5b47a 100644 --- a/src/bindings/scripts/scripts/zone/naxxramas/boss_gothik.cpp +++ b/src/bindings/scripts/scripts/zone/naxxramas/boss_gothik.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2008 - 2009 Trinity +/* Copyright (C) 2006 - 2009 ScriptDev2 * 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,8 +14,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* ScriptData +SDName: Boss_Gothik +SD%Complete: 0 +SDComment: Placeholder +SDCategory: Naxxramas +EndScriptData */ + #include "precompiled.h" -#include "def_naxxramas.h" #define SAY_SPEECH -1533040 #define SAY_KILL -1533041 @@ -23,336 +29,37 @@ #define SAY_TELEPORT -1533043 //Gothik -#define SPELL_HARVEST_SOUL 28679 -#define SPELL_SHADOW_BOLT HEROIC(29317,56405) - -#define SPELL_INFORM_LIVE_TRAINEE 27892 -#define SPELL_INFORM_LIVE_KNIGHT 27928 -#define SPELL_INFORM_LIVE_RIDER 27935 -#define SPELL_INFORM_DEAD_TRAINEE 27915 -#define SPELL_INFORM_DEAD_KNIGHT 27931 -#define SPELL_INFORM_DEAD_RIDER 27937 - -#define MOB_LIVE_TRAINEE 16124 -#define MOB_LIVE_KNIGHT 16125 -#define MOB_LIVE_RIDER 16126 -#define MOB_DEAD_TRAINEE 16127 -#define MOB_DEAD_KNIGHT 16148 -#define MOB_DEAD_RIDER 16150 -#define MOB_DEAD_HORSE 16149 - -const struct Waves { uint32 entry, number, time; } -waves[] = -{ - {MOB_LIVE_TRAINEE, 2, 20000}, - {MOB_LIVE_TRAINEE, 2, 20000}, - {MOB_LIVE_TRAINEE, 2, 10000}, - {MOB_LIVE_KNIGHT, 1, 10000}, - {MOB_LIVE_TRAINEE, 2, 15000}, - {MOB_LIVE_KNIGHT, 1, 10000}, - {MOB_LIVE_TRAINEE, 2, 15000}, - {MOB_LIVE_TRAINEE, 2, 0}, - {MOB_LIVE_KNIGHT, 1, 10000}, - {MOB_LIVE_RIDER, 1, 10000}, - {MOB_LIVE_TRAINEE, 2, 5000}, - {MOB_LIVE_KNIGHT, 1, 15000}, - {MOB_LIVE_TRAINEE, 2, 0}, - {MOB_LIVE_RIDER, 1, 10000}, - {MOB_LIVE_KNIGHT, 2, 10000}, - {MOB_LIVE_TRAINEE, 2, 10000}, - {MOB_LIVE_RIDER, 1, 5000}, - {MOB_LIVE_KNIGHT, 1, 5000}, - {MOB_LIVE_TRAINEE, 2, 20000}, - {MOB_LIVE_TRAINEE, 2, 0}, - {MOB_LIVE_KNIGHT, 1, 0}, - {MOB_LIVE_RIDER, 1, 15000}, - {MOB_LIVE_TRAINEE, 2, 29000}, - {0, 0, 0}, -}; - -#define POS_Y_GATE -3360.78f - -enum Events -{ - EVENT_SUMMON = 1, - EVENT_HARVEST, - EVENT_BOLT, -}; - -#define POS_LIVE 3 -#define POS_DEAD 5 - -const float PosSummonLive[POS_LIVE][4] = -{ - {2669.7, -3430.9, 268.56, 1.6}, - {2692.0, -3430.9, 268.56, 1.6}, - {2714.1, -3430.9, 268.56, 1.6}, -}; - -const float PosSummonDead[POS_DEAD][4] = -{ - {2725.1, -3310.0, 268.85, 3.4}, - {2699.3, -3322.8, 268.60, 3.3}, - {2733.1, -3348.5, 268.84, 3.1}, - {2682.8, -3304.2, 268.85, 3.9}, - {2664.8, -3340.7, 268.23, 3.7}, -}; - -const float PosGround[4] = {2691.2, -3362.7, 267.68, 1.7}; -const float PosPlatform[4] = {2640.5, -3360.6, 285.26, 0}; - -struct TRINITY_DLL_DECL boss_gothikAI : public BossAI -{ - boss_gothikAI(Creature *c) : BossAI(c, BOSS_GOTHIK) {} - - uint32 waveCount; - std::vector liveTrigger; - std::vector deadTrigger; - - void Reset() - { - liveTrigger.clear(); - deadTrigger.clear(); - me->setActive(false); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); - me->SetReactState(REACT_PASSIVE); - _Reset(); - } - - void EnterCombat(Unit *who) - { - for(uint32 i = 0; i < POS_LIVE; ++i) - if(Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonLive[i])) - liveTrigger.push_back(trigger); - for(uint32 i = 0; i < POS_DEAD; ++i) - if(Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonDead[i])) - deadTrigger.push_back(trigger); - - if(liveTrigger.size() < POS_LIVE || deadTrigger.size() < POS_DEAD) - { - error_log("Script Gothik: cannot summon triggers!"); - EnterEvadeMode(); - return; - } - - _EnterCombat(); - me->setActive(true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); - waveCount = 0; - events.ScheduleEvent(EVENT_SUMMON, 30000); - DoTeleportTo(PosPlatform); - DoScriptText(SAY_SPEECH, me); - if(instance) - instance->SetData(DATA_GOTHIK_GATE, 1); - } - - void JustSummoned(Creature *summon) - { - if(summon->GetEntry() == WORLD_TRIGGER) - summon->setActive(true); - else - { - summon->AI()->DoAction(me->HasReactState(REACT_PASSIVE) ? 1 : 0); - summon->AI()->EnterEvadeMode(); - } - summons.Summon(summon); - } - - void KilledUnit(Unit* victim) - { - if(!(rand()%5)) - DoScriptText(SAY_KILL, me); - } - - void JustDied(Unit* Killer) - { - _JustDied(); - DoScriptText(SAY_DEATH, me); - } - - void SpellHit(Unit *caster, const SpellEntry *spell) - { - uint32 spellId = 0; - switch(spell->Id) - { - case SPELL_INFORM_LIVE_TRAINEE: spellId = SPELL_INFORM_DEAD_TRAINEE; break; - case SPELL_INFORM_LIVE_KNIGHT: spellId = SPELL_INFORM_DEAD_KNIGHT; break; - case SPELL_INFORM_LIVE_RIDER: spellId = SPELL_INFORM_DEAD_RIDER; break; - } - if(spellId && me->isInCombat()) - { - me->HandleEmoteCommand(EMOTE_ONESHOT_SPELLCAST); - me->CastSpell(deadTrigger[rand()%POS_DEAD], spellId, true); - } - } - - void SpellHitTarget(Unit *target, const SpellEntry *spell) - { - if(!me->isInCombat()) - return; - - switch(spell->Id) - { - case SPELL_INFORM_DEAD_TRAINEE: DoSummon(MOB_DEAD_TRAINEE, target, 0); break; - case SPELL_INFORM_DEAD_KNIGHT: DoSummon(MOB_DEAD_KNIGHT, target, 0); break; - case SPELL_INFORM_DEAD_RIDER: DoSummon(MOB_DEAD_RIDER, target, 1.0f); - DoSummon(MOB_DEAD_HORSE, target, 1.0f); break; - } - } - - void UpdateAI(const uint32 diff) - { - if(!me->isInCombat()) - return; - - if(me->getThreatManager().isThreatListEmpty()) - { - EnterEvadeMode(); - return; - } - - if(me->HasReactState(REACT_AGGRESSIVE) && !UpdateVictim()) - return; - - events.Update(diff); - - if(me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while(uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) - { - case EVENT_SUMMON: - if(waves[waveCount].entry) - { - for(uint32 i = 0; i < waves[waveCount].number; ++i) - DoSummon(waves[waveCount].entry, liveTrigger[rand()%POS_LIVE], 1.0f); - events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time); - ++waveCount; - } - else - { - DoScriptText(SAY_TELEPORT, me); - DoTeleportTo(PosGround); - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); - if(instance) - instance->SetData(DATA_GOTHIK_GATE, 0); - summons.DoAction(0, 0); - summons.DoZoneInCombat(); - events.ScheduleEvent(EVENT_BOLT, 1000); - events.ScheduleEvent(EVENT_HARVEST, 15000); - } - break; - case EVENT_BOLT: - DoCast(me->getVictim(), SPELL_SHADOW_BOLT); - events.ScheduleEvent(EVENT_BOLT, 1000); - return; - case EVENT_HARVEST: - DoCast(me->getVictim(), SPELL_HARVEST_SOUL); - events.ScheduleEvent(EVENT_HARVEST, 15000); - return; - } - } - - DoMeleeAttackIfReady(); - } -}; - -struct TRINITY_DLL_DECL mob_gothik_minionAI : public SpellAI -{ - mob_gothik_minionAI(Creature *c) : SpellAI(c) - { - liveSide = me->GetPositionY() < POS_Y_GATE; - } - - bool liveSide; - bool gateClose; - -#define SIDE_CHECK(who) (liveSide == (who->GetPositionY() < POS_Y_GATE)) - - void DoAction(const int32 param) - { - gateClose = param; - } - - void DamageTaken(Unit *attacker, uint32 &damage) - { - if(gateClose && !SIDE_CHECK(attacker)) - damage = 0; - } - - void JustDied(Unit *killer) - { - if(me->isSummon()) - { - if(Unit *owner = ((TempSummon*)me)->GetSummoner()) - SpellAI::JustDied(owner); - } - } - - void EnterEvadeMode() - { - if(!gateClose) - { - SpellAI::EnterEvadeMode(); - return; - } - - if(!_EnterEvadeMode()) - return; +#define SPELL_HARVESTSOUL 28679 +#define SPELL_SHADOWBOLT HEROIC(29317,56405) +#define SPELL_SOUL_SIPHON 43591 // cannot find the correct spell - Map *map = me->GetMap(); - if(map->IsDungeon()) - { - Map::PlayerList const &PlayerList = map->GetPlayers(); - for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if(i->getSource()->isAlive() && SIDE_CHECK(i->getSource())) - { - AttackStart(i->getSource()); - return; - } - } - } +//Unrelenting Trainee +#define SPELL_EAGLECLAW 30285 +#define SPELL_KNOCKDOWN_PASSIVE 6961 - me->GetMotionMaster()->MoveIdle(); - Reset(); - } +//Unrelenting Deathknight +#define SPELL_CHARGE 22120 +#define SPELL_SHADOW_MARK 27825 - void UpdateAI(const uint32 diff) - { - if(gateClose && (!SIDE_CHECK(me) || me->getVictim() && !SIDE_CHECK(me->getVictim()))) - { - EnterEvadeMode(); - return; - } +//Unrelenting Rider +#define SPELL_UNHOLY_AURA 55606 +#define H_SPELL_UNHOLY_AURA 55608 +#define SPELL_SHADOWBOLT_VOLLEY 27831 //Search thru targets and find those who have the SHADOW_MARK to cast this on +#define H_SPELL_SHADOWBOLT_VOLLEY 55638 - SpellAI::UpdateAI(diff); - } -}; +//Spectral Trainee +#define SPELL_ARCANE_EXPLOSION 27989 -CreatureAI* GetAI_boss_gothik(Creature *_Creature) -{ - return new boss_gothikAI (_Creature); -} +//Spectral Deathknight +#define SPELL_WHIRLWIND 28334 +#define SPELL_SUNDER_ARMOR 25051 //cannot find sunder that reduces armor by 2950 +#define SPELL_CLEAVE 20677 +#define SPELL_MANA_BURN 17631 -CreatureAI* GetAI_mob_gothik_minion(Creature *_Creature) -{ - return new mob_gothik_minionAI (_Creature); -} +//Spectral Rider +#define SPELL_LIFEDRAIN 24300 +//USES SAME UNHOLY AURA AS UNRELENTING RIDER -void AddSC_boss_gothik() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_gothik"; - newscript->GetAI = &GetAI_boss_gothik; - newscript->RegisterSelf(); +//Spectral Horse +#define SPELL_STOMP 27993 - newscript = new Script; - newscript->Name="mob_gothik_minion"; - newscript->GetAI = &GetAI_mob_gothik_minion; - newscript->RegisterSelf(); -} diff --git a/src/bindings/scripts/scripts/zone/naxxramas/instance_naxxramas.cpp b/src/bindings/scripts/scripts/zone/naxxramas/instance_naxxramas.cpp index e5913660c3f..23f44f5daf8 100644 --- a/src/bindings/scripts/scripts/zone/naxxramas/instance_naxxramas.cpp +++ b/src/bindings/scripts/scripts/zone/naxxramas/instance_naxxramas.cpp @@ -86,10 +86,9 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData LoadDoorData(doorData); } - std::set Worshipper; std::set HeiganEruption[4]; - GameObject *GothikGate; Creature *Sapphiron; + std::set Worshipper; void OnCreatureCreate(Creature *creature, bool add) { @@ -115,7 +114,6 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData switch(go->GetEntry()) { case GO_BIRTH: if(!add && Sapphiron) Sapphiron->AI()->DoAction(DATA_SAPPHIRON_BIRTH); return; - case GO_GOTHIK_GATE: GothikGate = add ? go : NULL; break; } AddDoor(go, add); @@ -142,10 +140,6 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData case DATA_HEIGAN_ERUPT: HeiganErupt(value); break; - case DATA_GOTHIK_GATE: - if(GothikGate) - GothikGate->SetGoState(GOState(value)); - break; } } -- cgit v1.2.3 From 1b52fa4206fee1917453f4a5a4e5b6ac84afcdf8 Mon Sep 17 00:00:00 2001 From: megamage Date: Thu, 14 May 2009 11:40:02 -0500 Subject: Backed out changeset: 5201ecc6b309 --HG-- branch : trunk --- sql/updates/3233_world_scripts_naxx.sql | 1 + sql/world_scripts_full.sql | 1 + src/bindings/scripts/ScriptMgr.cpp | 2 + .../scripts/scripts/zone/naxxramas/boss_gothik.cpp | 361 +++++++++++++++++++-- .../scripts/zone/naxxramas/instance_naxxramas.cpp | 8 +- 5 files changed, 338 insertions(+), 35 deletions(-) (limited to 'src/bindings/scripts/ScriptMgr.cpp') diff --git a/sql/updates/3233_world_scripts_naxx.sql b/sql/updates/3233_world_scripts_naxx.sql index 67a8615951d..a5a71ba6233 100644 --- a/sql/updates/3233_world_scripts_naxx.sql +++ b/sql/updates/3233_world_scripts_naxx.sql @@ -6,6 +6,7 @@ INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comm (-28169, 28240, 0, 'Mutating Injection - Poison Cloud'); UPDATE creature_template SET scriptname = 'boss_grobbulus' WHERE entry = 15931; +update creature_template set scriptname='mob_gothik_minion' where entry in (16124,16125,16126,16127,16148,16149,16150); INSERT INTO creature_template (entry, spell1, flags_extra, scriptname) VALUES (16363, 28158, 128, ''), # Grobbulus Cloud diff --git a/sql/world_scripts_full.sql b/sql/world_scripts_full.sql index a1df130d207..8b28c3bc370 100644 --- a/sql/world_scripts_full.sql +++ b/sql/world_scripts_full.sql @@ -645,6 +645,7 @@ UPDATE `creature_template` SET `ScriptName`='boss_heigan' WHERE `entry`=15936; UPDATE `creature_template` SET `ScriptName`='boss_loatheb' WHERE `entry`=16011; UPDATE `creature_template` SET `ScriptName`='boss_razuvious' WHERE `entry`=16061; UPDATE `creature_template` SET `ScriptName`='boss_gothik' WHERE `entry`=16060; +UPDATE `creature_template` SET `ScriptName`='mob_gothik_minion' where `entry` IN (16124,16125,16126,16127,16148,16149,16150); UPDATE `creature_template` SET `ScriptName`='boss_thane_korthazz' WHERE `entry`=16064; UPDATE `creature_template` SET `ScriptName`='boss_sir_zeliek' WHERE `entry`=16063; UPDATE `creature_template` SET `ScriptName`='boss_lady_blaumeux' WHERE `entry`=16065; diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 4d7ed09fff4..849c4d64be5 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -389,6 +389,7 @@ extern void AddSC_boss_sapphiron(); extern void AddSC_boss_four_horsemen(); extern void AddSC_boss_faerlina(); extern void AddSC_boss_heigan(); +extern void AddSC_boss_gothik(); extern void AddSC_instance_naxxramas(); //Netherstorm @@ -1327,6 +1328,7 @@ void ScriptsInit(char const* cfg_file = "trinitycore.conf") AddSC_boss_sapphiron(); AddSC_boss_four_horsemen(); AddSC_boss_heigan(); + AddSC_boss_gothik(); AddSC_instance_naxxramas(); //Netherstorm diff --git a/src/bindings/scripts/scripts/zone/naxxramas/boss_gothik.cpp b/src/bindings/scripts/scripts/zone/naxxramas/boss_gothik.cpp index 3a9c6a5b47a..7def6c370f4 100644 --- a/src/bindings/scripts/scripts/zone/naxxramas/boss_gothik.cpp +++ b/src/bindings/scripts/scripts/zone/naxxramas/boss_gothik.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 +/* Copyright (C) 2008 - 2009 Trinity * 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,14 +14,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* ScriptData -SDName: Boss_Gothik -SD%Complete: 0 -SDComment: Placeholder -SDCategory: Naxxramas -EndScriptData */ - #include "precompiled.h" +#include "def_naxxramas.h" #define SAY_SPEECH -1533040 #define SAY_KILL -1533041 @@ -29,37 +23,336 @@ EndScriptData */ #define SAY_TELEPORT -1533043 //Gothik -#define SPELL_HARVESTSOUL 28679 -#define SPELL_SHADOWBOLT HEROIC(29317,56405) -#define SPELL_SOUL_SIPHON 43591 // cannot find the correct spell +#define SPELL_HARVEST_SOUL 28679 +#define SPELL_SHADOW_BOLT HEROIC(29317,56405) + +#define SPELL_INFORM_LIVE_TRAINEE 27892 +#define SPELL_INFORM_LIVE_KNIGHT 27928 +#define SPELL_INFORM_LIVE_RIDER 27935 +#define SPELL_INFORM_DEAD_TRAINEE 27915 +#define SPELL_INFORM_DEAD_KNIGHT 27931 +#define SPELL_INFORM_DEAD_RIDER 27937 + +#define MOB_LIVE_TRAINEE 16124 +#define MOB_LIVE_KNIGHT 16125 +#define MOB_LIVE_RIDER 16126 +#define MOB_DEAD_TRAINEE 16127 +#define MOB_DEAD_KNIGHT 16148 +#define MOB_DEAD_RIDER 16150 +#define MOB_DEAD_HORSE 16149 + +const struct Waves { uint32 entry, number, time; } +waves[] = +{ + {MOB_LIVE_TRAINEE, 2, 20000}, + {MOB_LIVE_TRAINEE, 2, 20000}, + {MOB_LIVE_TRAINEE, 2, 10000}, + {MOB_LIVE_KNIGHT, 1, 10000}, + {MOB_LIVE_TRAINEE, 2, 15000}, + {MOB_LIVE_KNIGHT, 1, 10000}, + {MOB_LIVE_TRAINEE, 2, 15000}, + {MOB_LIVE_TRAINEE, 2, 0}, + {MOB_LIVE_KNIGHT, 1, 10000}, + {MOB_LIVE_RIDER, 1, 10000}, + {MOB_LIVE_TRAINEE, 2, 5000}, + {MOB_LIVE_KNIGHT, 1, 15000}, + {MOB_LIVE_TRAINEE, 2, 0}, + {MOB_LIVE_RIDER, 1, 10000}, + {MOB_LIVE_KNIGHT, 2, 10000}, + {MOB_LIVE_TRAINEE, 2, 10000}, + {MOB_LIVE_RIDER, 1, 5000}, + {MOB_LIVE_KNIGHT, 1, 5000}, + {MOB_LIVE_TRAINEE, 2, 20000}, + {MOB_LIVE_TRAINEE, 2, 0}, + {MOB_LIVE_KNIGHT, 1, 0}, + {MOB_LIVE_RIDER, 1, 15000}, + {MOB_LIVE_TRAINEE, 2, 29000}, + {0, 0, 0}, +}; + +#define POS_Y_GATE -3360.78f + +enum Events +{ + EVENT_SUMMON = 1, + EVENT_HARVEST, + EVENT_BOLT, +}; + +#define POS_LIVE 3 +#define POS_DEAD 5 + +const float PosSummonLive[POS_LIVE][4] = +{ + {2669.7, -3430.9, 268.56, 1.6}, + {2692.0, -3430.9, 268.56, 1.6}, + {2714.1, -3430.9, 268.56, 1.6}, +}; + +const float PosSummonDead[POS_DEAD][4] = +{ + {2725.1, -3310.0, 268.85, 3.4}, + {2699.3, -3322.8, 268.60, 3.3}, + {2733.1, -3348.5, 268.84, 3.1}, + {2682.8, -3304.2, 268.85, 3.9}, + {2664.8, -3340.7, 268.23, 3.7}, +}; + +const float PosGround[4] = {2691.2, -3362.7, 267.68, 1.7}; +const float PosPlatform[4] = {2640.5, -3360.6, 285.26, 0}; + +struct TRINITY_DLL_DECL boss_gothikAI : public BossAI +{ + boss_gothikAI(Creature *c) : BossAI(c, BOSS_GOTHIK) {} + + uint32 waveCount; + std::vector liveTrigger; + std::vector deadTrigger; + + void Reset() + { + liveTrigger.clear(); + deadTrigger.clear(); + me->setActive(false); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + me->SetReactState(REACT_PASSIVE); + _Reset(); + } + + void EnterCombat(Unit *who) + { + for(uint32 i = 0; i < POS_LIVE; ++i) + if(Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonLive[i])) + liveTrigger.push_back(trigger); + for(uint32 i = 0; i < POS_DEAD; ++i) + if(Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonDead[i])) + deadTrigger.push_back(trigger); + + if(liveTrigger.size() < POS_LIVE || deadTrigger.size() < POS_DEAD) + { + error_log("Script Gothik: cannot summon triggers!"); + EnterEvadeMode(); + return; + } + + _EnterCombat(); + me->setActive(true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + waveCount = 0; + events.ScheduleEvent(EVENT_SUMMON, 30000); + DoTeleportTo(PosPlatform); + DoScriptText(SAY_SPEECH, me); + if(instance) + instance->SetData(DATA_GOTHIK_GATE, 1); + } + + void JustSummoned(Creature *summon) + { + if(summon->GetEntry() == WORLD_TRIGGER) + summon->setActive(true); + else + { + summon->AI()->DoAction(me->HasReactState(REACT_PASSIVE) ? 1 : 0); + summon->AI()->EnterEvadeMode(); + } + summons.Summon(summon); + } + + void KilledUnit(Unit* victim) + { + if(!(rand()%5)) + DoScriptText(SAY_KILL, me); + } + + void JustDied(Unit* Killer) + { + _JustDied(); + DoScriptText(SAY_DEATH, me); + } + + void SpellHit(Unit *caster, const SpellEntry *spell) + { + uint32 spellId = 0; + switch(spell->Id) + { + case SPELL_INFORM_LIVE_TRAINEE: spellId = SPELL_INFORM_DEAD_TRAINEE; break; + case SPELL_INFORM_LIVE_KNIGHT: spellId = SPELL_INFORM_DEAD_KNIGHT; break; + case SPELL_INFORM_LIVE_RIDER: spellId = SPELL_INFORM_DEAD_RIDER; break; + } + if(spellId && me->isInCombat()) + { + me->HandleEmoteCommand(EMOTE_ONESHOT_SPELLCAST); + me->CastSpell(deadTrigger[rand()%POS_DEAD], spellId, true); + } + } + + void SpellHitTarget(Unit *target, const SpellEntry *spell) + { + if(!me->isInCombat()) + return; + + switch(spell->Id) + { + case SPELL_INFORM_DEAD_TRAINEE: DoSummon(MOB_DEAD_TRAINEE, target, 0); break; + case SPELL_INFORM_DEAD_KNIGHT: DoSummon(MOB_DEAD_KNIGHT, target, 0); break; + case SPELL_INFORM_DEAD_RIDER: DoSummon(MOB_DEAD_RIDER, target, 1.0f); + DoSummon(MOB_DEAD_HORSE, target, 1.0f); break; + } + } + + void UpdateAI(const uint32 diff) + { + if(!me->isInCombat()) + return; + + if(me->getThreatManager().isThreatListEmpty()) + { + EnterEvadeMode(); + return; + } + + if(me->HasReactState(REACT_AGGRESSIVE) && !UpdateVictim()) + return; + + events.Update(diff); + + if(me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while(uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_SUMMON: + if(waves[waveCount].entry) + { + for(uint32 i = 0; i < waves[waveCount].number; ++i) + DoSummon(waves[waveCount].entry, liveTrigger[rand()%POS_LIVE], 1.0f); + events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time); + ++waveCount; + } + else + { + DoScriptText(SAY_TELEPORT, me); + DoTeleportTo(PosGround); + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + if(instance) + instance->SetData(DATA_GOTHIK_GATE, 0); + summons.DoAction(0, 0); + summons.DoZoneInCombat(); + events.ScheduleEvent(EVENT_BOLT, 1000); + events.ScheduleEvent(EVENT_HARVEST, 15000); + } + break; + case EVENT_BOLT: + DoCast(me->getVictim(), SPELL_SHADOW_BOLT); + events.ScheduleEvent(EVENT_BOLT, 1000); + return; + case EVENT_HARVEST: + DoCast(me->getVictim(), SPELL_HARVEST_SOUL); + events.ScheduleEvent(EVENT_HARVEST, 15000); + return; + } + } + + DoMeleeAttackIfReady(); + } +}; + +struct TRINITY_DLL_DECL mob_gothik_minionAI : public SpellAI +{ + mob_gothik_minionAI(Creature *c) : SpellAI(c) + { + liveSide = me->GetPositionY() < POS_Y_GATE; + } + + bool liveSide; + bool gateClose; + +#define SIDE_CHECK(who) (liveSide == (who->GetPositionY() < POS_Y_GATE)) + + void DoAction(const int32 param) + { + gateClose = param; + } + + void DamageTaken(Unit *attacker, uint32 &damage) + { + if(gateClose && !SIDE_CHECK(attacker)) + damage = 0; + } + + void JustDied(Unit *killer) + { + if(me->isSummon()) + { + if(Unit *owner = ((TempSummon*)me)->GetSummoner()) + SpellAI::JustDied(owner); + } + } + + void EnterEvadeMode() + { + if(!gateClose) + { + SpellAI::EnterEvadeMode(); + return; + } + + if(!_EnterEvadeMode()) + return; -//Unrelenting Trainee -#define SPELL_EAGLECLAW 30285 -#define SPELL_KNOCKDOWN_PASSIVE 6961 + Map *map = me->GetMap(); + if(map->IsDungeon()) + { + Map::PlayerList const &PlayerList = map->GetPlayers(); + for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if(i->getSource()->isAlive() && SIDE_CHECK(i->getSource())) + { + AttackStart(i->getSource()); + return; + } + } + } -//Unrelenting Deathknight -#define SPELL_CHARGE 22120 -#define SPELL_SHADOW_MARK 27825 + me->GetMotionMaster()->MoveIdle(); + Reset(); + } -//Unrelenting Rider -#define SPELL_UNHOLY_AURA 55606 -#define H_SPELL_UNHOLY_AURA 55608 -#define SPELL_SHADOWBOLT_VOLLEY 27831 //Search thru targets and find those who have the SHADOW_MARK to cast this on -#define H_SPELL_SHADOWBOLT_VOLLEY 55638 + void UpdateAI(const uint32 diff) + { + if(gateClose && (!SIDE_CHECK(me) || me->getVictim() && !SIDE_CHECK(me->getVictim()))) + { + EnterEvadeMode(); + return; + } -//Spectral Trainee -#define SPELL_ARCANE_EXPLOSION 27989 + SpellAI::UpdateAI(diff); + } +}; -//Spectral Deathknight -#define SPELL_WHIRLWIND 28334 -#define SPELL_SUNDER_ARMOR 25051 //cannot find sunder that reduces armor by 2950 -#define SPELL_CLEAVE 20677 -#define SPELL_MANA_BURN 17631 +CreatureAI* GetAI_boss_gothik(Creature *_Creature) +{ + return new boss_gothikAI (_Creature); +} -//Spectral Rider -#define SPELL_LIFEDRAIN 24300 -//USES SAME UNHOLY AURA AS UNRELENTING RIDER +CreatureAI* GetAI_mob_gothik_minion(Creature *_Creature) +{ + return new mob_gothik_minionAI (_Creature); +} -//Spectral Horse -#define SPELL_STOMP 27993 +void AddSC_boss_gothik() +{ + Script *newscript; + newscript = new Script; + newscript->Name="boss_gothik"; + newscript->GetAI = &GetAI_boss_gothik; + newscript->RegisterSelf(); + newscript = new Script; + newscript->Name="mob_gothik_minion"; + newscript->GetAI = &GetAI_mob_gothik_minion; + newscript->RegisterSelf(); +} diff --git a/src/bindings/scripts/scripts/zone/naxxramas/instance_naxxramas.cpp b/src/bindings/scripts/scripts/zone/naxxramas/instance_naxxramas.cpp index 23f44f5daf8..e5913660c3f 100644 --- a/src/bindings/scripts/scripts/zone/naxxramas/instance_naxxramas.cpp +++ b/src/bindings/scripts/scripts/zone/naxxramas/instance_naxxramas.cpp @@ -86,9 +86,10 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData LoadDoorData(doorData); } + std::set Worshipper; std::set HeiganEruption[4]; + GameObject *GothikGate; Creature *Sapphiron; - std::set Worshipper; void OnCreatureCreate(Creature *creature, bool add) { @@ -114,6 +115,7 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData switch(go->GetEntry()) { case GO_BIRTH: if(!add && Sapphiron) Sapphiron->AI()->DoAction(DATA_SAPPHIRON_BIRTH); return; + case GO_GOTHIK_GATE: GothikGate = add ? go : NULL; break; } AddDoor(go, add); @@ -140,6 +142,10 @@ struct TRINITY_DLL_DECL instance_naxxramas : public InstanceData case DATA_HEIGAN_ERUPT: HeiganErupt(value); break; + case DATA_GOTHIK_GATE: + if(GothikGate) + GothikGate->SetGoState(GOState(value)); + break; } } -- cgit v1.2.3