diff options
author | megamage <none@none> | 2009-04-17 16:10:48 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-04-17 16:10:48 -0500 |
commit | 345f1a72c60d872961b2670f701f793938d6a93f (patch) | |
tree | 8fdcf62e5c59406199cbd3872e3f83874aabddf5 /src | |
parent | ad41b0c9e1d9d3a176d22cb42a33dfc1fb1aa55a (diff) | |
parent | c688548c2c64764b16cd571321d0d72ed83eb1b4 (diff) |
*Merge.
--HG--
branch : trunk
Diffstat (limited to 'src')
11 files changed, 491 insertions, 143 deletions
diff --git a/src/bindings/scripts/CMakeLists.txt b/src/bindings/scripts/CMakeLists.txt index cae1c65f4dc..93fbeaf171a 100644 --- a/src/bindings/scripts/CMakeLists.txt +++ b/src/bindings/scripts/CMakeLists.txt @@ -302,10 +302,13 @@ SET(trinityscript_LIB_SRCS scripts/zone/stratholme/def_stratholme.h scripts/zone/stratholme/instance_stratholme.cpp scripts/zone/stratholme/stratholme.cpp + scripts/zone/sunwell_plateau/boss_kiljaeden.cpp + scripts/zone/sunwell_plateau/boss_muru.cpp scripts/zone/sunwell_plateau/boss_eredar_twins.cpp scripts/zone/sunwell_plateau/boss_felmyst.cpp scripts/zone/sunwell_plateau/boss_brutallus.cpp scripts/zone/sunwell_plateau/boss_kalecgos.cpp + scripts/zone/sunwell_plateau/sunwell_plateau.cpp scripts/zone/sunwell_plateau/def_sunwell_plateau.h scripts/zone/sunwell_plateau/instance_sunwell_plateau.cpp scripts/zone/tanaris/tanaris.cpp diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 1591f53922b..1de66cdf98d 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -484,6 +484,9 @@ extern void AddSC_boss_kalecgos(); extern void AddSC_boss_brutallus(); extern void AddSC_boss_felmyst(); extern void AddSC_boss_eredar_twins(); +extern void AddSC_boss_muru(); +extern void AddSC_boss_kiljaeden(); +extern void AddSC_sunwell_plateau(); //Tanaris extern void AddSC_tanaris(); @@ -1404,6 +1407,9 @@ void ScriptsInit() AddSC_boss_brutallus(); AddSC_boss_felmyst(); AddSC_boss_eredar_twins(); + AddSC_boss_muru(); + AddSC_boss_kiljaeden(); + AddSC_sunwell_plateau(); //Tanaris AddSC_tanaris(); diff --git a/src/bindings/scripts/VC71/71ScriptDev2.vcproj b/src/bindings/scripts/VC71/71ScriptDev2.vcproj index ef03a6069ec..f241121295a 100644 --- a/src/bindings/scripts/VC71/71ScriptDev2.vcproj +++ b/src/bindings/scripts/VC71/71ScriptDev2.vcproj @@ -2306,6 +2306,18 @@ > </File> <File + RelativePath="..\scripts\zone\sunwell_plateau\boss_muru.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\sunwell_plateau\boss_kiljaeden.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\sunwell_plateau\sunwell_plateau.cpp" + > + </File> + <File RelativePath="..\scripts\zone\sunwell_plateau\def_sunwell_plateau.h" > </File> diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj index b07fb701c75..b10552f9f57 100644 --- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj +++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj @@ -2475,6 +2475,18 @@ > </File> <File + RelativePath="..\scripts\zone\sunwell_plateau\boss_muru.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\sunwell_plateau\boss_kiljaeden.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\sunwell_plateau\sunwell_plateau.cpp" + > + </File> + <File RelativePath="..\scripts\zone\sunwell_plateau\def_sunwell_plateau.h" > </File> diff --git a/src/bindings/scripts/VC90/90ScriptDev2.vcproj b/src/bindings/scripts/VC90/90ScriptDev2.vcproj index 423f64fc077..4ae4f14eb33 100644 --- a/src/bindings/scripts/VC90/90ScriptDev2.vcproj +++ b/src/bindings/scripts/VC90/90ScriptDev2.vcproj @@ -2753,6 +2753,18 @@ > </File> <File + RelativePath="..\scripts\zone\sunwell_plateau\boss_muru.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\sunwell_plateau\boss_kiljaeden.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\sunwell_plateau\sunwell_plateau.cpp" + > + </File> + <File RelativePath="..\scripts\zone\sunwell_plateau\def_sunwell_plateau.h" > </File> diff --git a/src/bindings/scripts/scripts/creature/mob_event_ai.h b/src/bindings/scripts/scripts/creature/mob_event_ai.h new file mode 100644 index 00000000000..8182717d5d4 --- /dev/null +++ b/src/bindings/scripts/scripts/creature/mob_event_ai.h @@ -0,0 +1,223 @@ +/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef SC_EVENTAI_H +#define SC_EVENTAI_H + +#define MAX_ACTIONS 3 + +enum Event_Types +{ + EVENT_T_TIMER = 0, //InitialMin, InitialMax, RepeatMin, RepeatMax + EVENT_T_TIMER_OOC = 1, //InitialMin, InitialMax, RepeatMin, RepeatMax + EVENT_T_HP = 2, //HPMax%, HPMin%, RepeatMin, RepeatMax + EVENT_T_MANA = 3, //ManaMax%,ManaMin% RepeatMin, RepeatMax + EVENT_T_AGGRO = 4, //NONE + EVENT_T_KILL = 5, //RepeatMin, RepeatMax + EVENT_T_DEATH = 6, //NONE + EVENT_T_EVADE = 7, //NONE + EVENT_T_SPELLHIT = 8, //SpellID, School, RepeatMin, RepeatMax + EVENT_T_RANGE = 9, //MinDist, MaxDist, RepeatMin, RepeatMax + EVENT_T_OOC_LOS = 10, //NoHostile, NoFriendly, RepeatMin, RepeatMax + EVENT_T_SPAWNED = 11, //NONE + EVENT_T_TARGET_HP = 12, //HPMax%, HPMin%, RepeatMin, RepeatMax + EVENT_T_TARGET_CASTING = 13, //RepeatMin, RepeatMax + EVENT_T_FRIENDLY_HP = 14, //HPDeficit, Radius, RepeatMin, RepeatMax + EVENT_T_FRIENDLY_IS_CC = 15, //DispelType, Radius, RepeatMin, RepeatMax + EVENT_T_FRIENDLY_MISSING_BUFF = 16, //SpellId, Radius, RepeatMin, RepeatMax + EVENT_T_SUMMONED_UNIT = 17, //CreatureId, RepeatMin, RepeatMax + EVENT_T_TARGET_MANA = 18, //ManaMax%, ManaMin%, RepeatMin, RepeatMax + EVENT_T_QUEST_ACCEPT = 19, //QuestID + EVENT_T_QUEST_COMPLETE = 20, // + EVENT_T_REACHED_HOME = 21, //NONE + + EVENT_T_END, +}; + +enum Action_Types +{ + ACTION_T_NONE = 0, //No action + ACTION_T_TEXT = 1, //-TextId1, optionally -TextId2, optionally -TextId3(if -TextId2 exist). If more than just -TextId1 is defined, randomize. Negative values. + ACTION_T_SET_FACTION = 2, //FactionId (or 0 for default) + ACTION_T_MORPH_TO_ENTRY_OR_MODEL = 3, //Creature_template entry(param1) OR ModelId (param2) (or 0 for both to demorph) + ACTION_T_SOUND = 4, //SoundId + ACTION_T_EMOTE = 5, //EmoteId + ACTION_T_RANDOM_SAY = 6, //UNUSED + ACTION_T_RANDOM_YELL = 7, //UNUSED + ACTION_T_RANDOM_TEXTEMOTE = 8, //UNUSED + ACTION_T_RANDOM_SOUND = 9, //SoundId1, SoundId2, SoundId3 (-1 in any field means no output if randomed that field) + ACTION_T_RANDOM_EMOTE = 10, //EmoteId1, EmoteId2, EmoteId3 (-1 in any field means no output if randomed that field) + ACTION_T_CAST = 11, //SpellId, Target, CastFlags + ACTION_T_SUMMON = 12, //CreatureID, Target, Duration in ms + ACTION_T_THREAT_SINGLE_PCT = 13, //Threat%, Target + ACTION_T_THREAT_ALL_PCT = 14, //Threat% + ACTION_T_QUEST_EVENT = 15, //QuestID, Target + ACTION_T_CASTCREATUREGO = 16, //QuestID, SpellId, Target + ACTION_T_SET_UNIT_FIELD = 17, //Field_Number, Value, Target + ACTION_T_SET_UNIT_FLAG = 18, //Flags (may be more than one field OR'd together), Target + ACTION_T_REMOVE_UNIT_FLAG = 19, //Flags (may be more than one field OR'd together), Target + ACTION_T_AUTO_ATTACK = 20, //AllowAttackState (0 = stop attack, anything else means continue attacking) + ACTION_T_COMBAT_MOVEMENT = 21, //AllowCombatMovement (0 = stop combat based movement, anything else continue attacking) + ACTION_T_SET_PHASE = 22, //Phase + ACTION_T_INC_PHASE = 23, //Value (may be negative to decrement phase, should not be 0) + ACTION_T_EVADE = 24, //No Params + ACTION_T_FLEE = 25, //No Params + ACTION_T_QUEST_EVENT_ALL = 26, //QuestID + ACTION_T_CASTCREATUREGO_ALL = 27, //QuestId, SpellId + ACTION_T_REMOVEAURASFROMSPELL = 28, //Target, Spellid + ACTION_T_RANGED_MOVEMENT = 29, //Distance, Angle + ACTION_T_RANDOM_PHASE = 30, //PhaseId1, PhaseId2, PhaseId3 + ACTION_T_RANDOM_PHASE_RANGE = 31, //PhaseMin, PhaseMax + ACTION_T_SUMMON_ID = 32, //CreatureId, Target, SpawnId + ACTION_T_KILLED_MONSTER = 33, //CreatureId, Target + ACTION_T_SET_INST_DATA = 34, //Field, Data + ACTION_T_SET_INST_DATA64 = 35, //Field, Target + ACTION_T_UPDATE_TEMPLATE = 36, //Entry, Team + ACTION_T_DIE = 37, //No Params + ACTION_T_ZONE_COMBAT_PULSE = 38, //No Params + + ACTION_T_SET_ACTIVE = 101, //Apply + ACTION_T_SET_AGGRESSIVE = 102, //Apply + ACTION_T_ATTACK_START_PULSE = 103, //Distance + ACTION_T_SUMMON_GO = 104, //GameObjectID, DespawnTime in ms + + ACTION_T_END, +}; + +enum Target +{ + //Self (m_creature) + TARGET_T_SELF = 0, //Self cast + + //Hostile targets (if pet then returns pet owner) + TARGET_T_HOSTILE, //Our current target (ie: highest aggro) + TARGET_T_HOSTILE_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks) + TARGET_T_HOSTILE_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for) + TARGET_T_HOSTILE_RANDOM, //Just any random target on our threat list + TARGET_T_HOSTILE_RANDOM_NOT_TOP, //Any random target except top threat + + //Invoker targets (if pet then returns pet owner) + TARGET_T_ACTION_INVOKER, //Unit who caused this Event to occur (only works for EVENT_T_AGGRO, EVENT_T_KILL, EVENT_T_DEATH, EVENT_T_SPELLHIT, EVENT_T_OOC_LOS, EVENT_T_FRIENDLY_HP, EVENT_T_FRIENDLY_IS_CC, EVENT_T_FRIENDLY_MISSING_BUFF) + + //Hostile targets (including pets) + TARGET_T_HOSTILE_WPET, //Current target (can be a pet) + TARGET_T_HOSTILE_WPET_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks) + TARGET_T_HOSTILE_WPET_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for) + TARGET_T_HOSTILE_WPET_RANDOM, //Just any random target on our threat list + TARGET_T_HOSTILE_WPET_RANDOM_NOT_TOP, //Any random target except top threat + + TARGET_T_ACTION_INVOKER_WPET, + + TARGET_T_END +}; + +enum CastFlags +{ + CAST_INTURRUPT_PREVIOUS = 0x01, //Interrupt any spell casting + CAST_TRIGGERED = 0x02, //Triggered (this makes spell cost zero mana and have no cast time) + CAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range + CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range + CAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself + CAST_AURA_NOT_PRESENT = 0x20, //Only casts the spell if the target does not have an aura from the spell +}; + +enum EventFlags +{ + EFLAG_REPEATABLE = 0x01, //Event repeats + EFLAG_NORMAL = 0x02, //Event only occurs in Normal instance difficulty + EFLAG_HEROIC = 0x04, //Event only occurs in Heroic instance difficulty + EFLAG_RESERVED_3 = 0x08, + EFLAG_RESERVED_4 = 0x10, + EFLAG_RESERVED_5 = 0x20, + EFLAG_RESERVED_6 = 0x40, + EFLAG_DEBUG_ONLY = 0x80, //Event only occurs in debug build of SD2 only +}; + +struct EventAI_Event +{ + uint32 event_id; + + uint32 creature_id; + + uint16 event_type; + uint32 event_inverse_phase_mask; + uint8 event_chance; + uint8 event_flags; + union + { + uint32 event_param1; + int32 event_param1_s; + }; + union + { + uint32 event_param2; + int32 event_param2_s; + }; + union + { + uint32 event_param3; + int32 event_param3_s; + }; + union + { + uint32 event_param4; + int32 event_param4_s; + }; + + struct _action + { + uint16 type; + union + { + uint32 param1; + int32 param1_s; + }; + union + { + uint32 param2; + int32 param2_s; + }; + union + { + uint32 param3; + int32 param3_s; + }; + }action[MAX_ACTIONS]; +}; + +//Event_Map +extern UNORDERED_MAP<uint32, std::vector<EventAI_Event> > EventAI_Event_Map; + +struct EventAI_Summon +{ + uint32 id; + + float position_x; + float position_y; + float position_z; + float orientation; + uint32 SpawnTimeSecs; +}; + +//EventSummon_Map +extern UNORDERED_MAP<uint32, EventAI_Summon> EventAI_Summon_Map; + +//EventAI Error handling +extern uint32 EAI_ErrorLevel; +/* + +struct EventAI_CreatureError +{ + bool ListEmpty; + bool NoInstance; +}; + +//Error prevention list +extern UNORDERED_MAP<uint32, EventAI_CreatureError> EventAI_CreatureErrorPreventionList; + +//Defines +#define EVENTAI_EMPTY_EVENTLIST "SD2: Eventlist for Creature %i is empty but creature is using Mob_EventAI. Preventing EventAI on this creature." +*/ +#endif + diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp index ed62e77b218..57f484f3ac1 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp @@ -388,15 +388,20 @@ void hyjalAI::Reset() //Initialize spells memset(Spell, 0, sizeof(Spell)); - //Reset World States - UpdateWorldState(WORLD_STATE_WAVES, 0); - UpdateWorldState(WORLD_STATE_ENEMY, 0); - UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0); + //Reset Instance Data for trash count if(pInstance) - pInstance->SetData(DATA_RESET_TRASH_COUNT, 0); - else error_log(ERROR_INST_DATA); + { + if((!pInstance->GetData(DATA_ALLIANCE_RETREAT) && m_creature->GetEntry() == JAINA) || (pInstance->GetData(DATA_ALLIANCE_RETREAT) && m_creature->GetEntry() == THRALL)) + { + //Reset World States + UpdateWorldState(WORLD_STATE_WAVES, 0); + UpdateWorldState(WORLD_STATE_ENEMY, 0); + UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0); + pInstance->SetData(DATA_RESET_TRASH_COUNT, 0); + } + }else error_log(ERROR_INST_DATA); //Visibility DoHide = true; diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kiljaeden.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kiljaeden.cpp new file mode 100644 index 00000000000..394db5faa04 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kiljaeden.cpp @@ -0,0 +1,25 @@ +/* Copyright (C) 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Boss_Kiljaeden +SD%Complete: 0 +SDComment: Placeholer +SDCategory: Sunwell_Plateau +EndScriptData */ + +void AddSC_boss_kiljaeden() +{}; diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_muru.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_muru.cpp new file mode 100644 index 00000000000..fe6f123ebcc --- /dev/null +++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_muru.cpp @@ -0,0 +1,25 @@ +/* Copyright (C) 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Boss_Muru +SD%Complete: 0 +SDComment: Placeholer +SDCategory: Sunwell_Plateau +EndScriptData */ + +void AddSC_boss_muru() +{}; diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/sunwell_plateau.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/sunwell_plateau.cpp new file mode 100644 index 00000000000..57b4cee1648 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/sunwell_plateau.cpp @@ -0,0 +1,25 @@ +/* Copyright (C) 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: sunwell_plateau +SD%Complete: 0 +SDComment: Placeholer +SDCategory: Sunwell_Plateau +EndScriptData */ + +void AddSC_sunwell_plateau() +{};
\ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp index a4c430ae7f7..dd1d9772f31 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp @@ -147,6 +147,7 @@ float KaelthasWeapons[7][5] = #define TIME_PHASE_3_4 120000 #define KAEL_VISIBLE_RANGE 50.0f +#define ROOM_BASE_Z 49.0f //Base AI for Advisors struct TRINITY_DLL_DECL advisorbase_ai : public ScriptedAI @@ -179,6 +180,7 @@ struct TRINITY_DLL_DECL advisorbase_ai : public ScriptedAI void Reset() { + m_creature->SetNoCallAssistance(true); FakeDeath = false; DelayRes_Timer = 0; DelayRes_Target = 0; @@ -268,7 +270,7 @@ struct TRINITY_DLL_DECL advisorbase_ai : public ScriptedAI //Kael'thas AI struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI { - boss_kaelthasAI(Creature *c) : ScriptedAI(c) + boss_kaelthasAI(Creature *c) : ScriptedAI(c), summons(m_creature) { pInstance = ((ScriptedInstance*)c->GetInstanceData()); AdvisorGuid[0] = 0; @@ -303,6 +305,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI uint64 AdvisorGuid[4]; uint64 WeaponGuid[7]; + SummonList summons; void DeleteLegs() { @@ -322,42 +325,12 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI i_pl->DestroyItemCount(30318, 1, true); i_pl->DestroyItemCount(30319, 1, true); i_pl->DestroyItemCount(30320, 1, true); - } - if(pInstance) { - for(uint32 i = 0; i < 7; i++) { - Creature* weapon = (Unit::GetCreature((*m_creature), WeaponGuid[i]));; - delete weapon; - } - } - } - - void CleanPhoenix() - { - CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); - Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); - - std::list<Creature*> PhoenixList; - - Trinity::AllCreaturesOfEntryInRange check(m_creature, PHOENIX, 50); - Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(m_creature, PhoenixList, check); - TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> visitor(searcher); - - CellLock<GridReadGuard> cell_lock(cell, pair); - cell_lock->Visit(cell_lock, visitor, *(m_creature->GetMap())); - - if(!PhoenixList.empty()) - { - for(std::list<Creature*>::iterator itr = PhoenixList.begin(); itr != PhoenixList.end(); ++itr) - { - (*itr)->RemoveFromWorld(); - } - } + } } void Reset() { + m_creature->SetNoCallAssistance(true); Fireball_Timer = 5000+rand()%10000; ArcaneDisruption_Timer = 45000; MindControl_Timer = 40000; @@ -379,7 +352,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI PrepareAdvisors(); DeleteLegs(); - CleanPhoenix(); + summons.DespawnAll(); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -413,7 +386,6 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI AdvisorGuid[1] = pInstance->GetData64(DATA_LORDSANGUINAR); AdvisorGuid[2] = pInstance->GetData64(DATA_GRANDASTROMANCERCAPERNIAN); AdvisorGuid[3] = pInstance->GetData64(DATA_MASTERENGINEERTELONICUS); - m_creature->addUnitState(UNIT_STAT_STUNNED); if(!AdvisorGuid[0] || !AdvisorGuid[1] || !AdvisorGuid[2] || !AdvisorGuid[3]) { @@ -466,8 +438,11 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); summoned->AI()->AttackStart(target); } + summons.Summon(summoned); } + void SummonedCreatureDespawn(Creature *summon) {summons.Despawn(summon);} + void JustDied(Unit* Killer) { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -476,6 +451,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI DoScriptText(SAY_DEATH, m_creature); DeleteLegs(); + summons.DespawnAll(); if(pInstance) pInstance->SetData(DATA_KAELTHASEVENT, DONE); @@ -486,7 +462,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI pCreature = (Unit::GetCreature((*m_creature), AdvisorGuid[i])); if(pCreature) { - pCreature->DealDamage(pCreature, pCreature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + pCreature->setDeathState(JUST_DIED); } } } @@ -522,6 +498,15 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI void UpdateAI(const uint32 diff) { + + if(pInstance && Phase) + { + if(pInstance->GetData(DATA_KAELTHASEVENT) == IN_PROGRESS && m_creature->getThreatManager().getThreatList().empty()) + { + EnterEvadeMode(); + return; + } + } //Phase 1 switch (Phase) { @@ -764,7 +749,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) { - m_creature->clearUnitState(UNIT_STAT_STUNNED); + DoResetThreat();//only healers will be at top threat, so reset(not delete) all players's threat when Kael comes to fight AttackStart(target); } Phase_Timer = 30000; @@ -955,7 +940,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end();i++) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); - if(pUnit) + if(pUnit && pUnit->GetTypeId() == TYPEID_PLAYER) { m_creature->CastSpell(pUnit, SPELL_KNOCKBACK, true); //Gravity lapse - needs an exception in Spell system to work @@ -989,7 +974,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end();i++) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); - if(pUnit) + if(pUnit && pUnit->GetTypeId() == TYPEID_PLAYER) { //Using packet workaround WorldPacket data(12); @@ -1410,109 +1395,124 @@ struct TRINITY_DLL_DECL mob_kael_flamestrikeAI : public ScriptedAI //Phoenix AI struct TRINITY_DLL_DECL mob_phoenix_tkAI : public ScriptedAI { - mob_phoenix_tkAI(Creature *c) : ScriptedAI(c) {} - - uint32 Cycle_Timer; - uint8 SummonEgg; - - void Reset() - { - Cycle_Timer = 2000; - SummonEgg = 0; - m_creature->CastSpell(m_creature,SPELL_BURN,true); - } - - void Aggro(Unit *who) { } - - void DamageTaken(Unit* pKiller, uint32 &damage) - { - if(m_creature->GetHealth() < damage && SummonEgg < 2){ - damage = 0; - SummonEgg = 1; - } - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if(SummonEgg < 2){ - if (Cycle_Timer < diff) - { - //spell Burn should possible do this, but it doesn't, so do this for now. - uint32 dmg = urand(4500,5500); - if (m_creature->GetHealth() > dmg) - m_creature->SetHealth(uint32(m_creature->GetHealth()-dmg)); - Cycle_Timer = 2000; - }else Cycle_Timer -= diff; - }else { - if(Cycle_Timer < diff){ - m_creature->SummonCreature(PHOENIX_EGG,m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),m_creature->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,16000); - m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - m_creature->RemoveCorpse(); - }else Cycle_Timer -= diff; - } - - if(SummonEgg == 1){ //hack die animation - m_creature->RemoveAllAuras(); - DoStartNoMovement(m_creature->getVictim()); - m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD); - SummonEgg = 2; - Cycle_Timer = 1000; - } - if(SummonEgg < 2)DoMeleeAttackIfReady(); - } + mob_phoenix_tkAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + } + + ScriptedInstance* pInstance; + uint32 Cycle_Timer; + bool egg; + + void JustDied(Unit *victim) + { + if(egg) + { + float x,y,z; + m_creature->GetPosition(x,y,z); + z = m_creature->GetMap()->GetVmapHeight(x,y,z,true); + if(z == INVALID_HEIGHT) + z = ROOM_BASE_Z; + m_creature->SummonCreature(PHOENIX_EGG,x,y,z,m_creature->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,16000); + m_creature->RemoveCorpse(); + } + } + + + void Reset() + { + m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);//birds can fly! :) + egg = true; + Cycle_Timer = 2000; + m_creature->CastSpell(m_creature,SPELL_BURN,true); + } + + void Aggro(Unit *who) { } + + void DamageTaken(Unit* pKiller, uint32 &damage) + { + + } + + void UpdateAI(const uint32 diff) + { + if (Cycle_Timer < diff) + { + if(pInstance)//check for boss reset + { + Creature* Kael = Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_KAELTHAS)); + if (Kael && Kael->getThreatManager().getThreatList().empty()) + { + egg = false; + m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + Cycle_Timer = 2000; + return; + } + } + //spell Burn should possible do this, but it doesn't, so do this for now. + uint32 dmg = urand(4500,5500); + if (m_creature->GetHealth() > dmg) + m_creature->SetHealth(uint32(m_creature->GetHealth()-dmg)); + else//kill itt + m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + Cycle_Timer = 2000; + }else Cycle_Timer -= diff; + + if (!UpdateVictim()) + return; + DoMeleeAttackIfReady(); + } }; //Phoenix Egg AI struct TRINITY_DLL_DECL mob_phoenix_egg_tkAI : public ScriptedAI { - mob_phoenix_egg_tkAI(Creature *c) : ScriptedAI(c) {} - - uint32 Rebirth_Timer; - bool summoned; - - void Reset(){ - Rebirth_Timer = 15000; - summoned = false; - } - - //ignore any - void MoveInLineOfSight(Unit* who) { return; } - - void AttackStart(Unit* who) - { - if (m_creature->Attack(who, false)) - { - if (!InCombat) - { - InCombat = true; - Aggro(who); - } - DoStartNoMovement(who); - } - } - - void Aggro(Unit *who) { } - - void JustSummoned(Creature* summoned) - { - summoned->AddThreat(m_creature->getVictim(), 0.0f); - summoned->CastSpell(summoned,SPELL_REBIRTH,false); - } - - void UpdateAI(const uint32 diff) - { - if (Rebirth_Timer < diff) - { - if(!summoned){ - Creature* Phoenix = m_creature->SummonCreature(PHOENIX,m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),m_creature->GetOrientation(),TEMPSUMMON_CORPSE_DESPAWN,5000); - summoned = true; - } - m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - }else Rebirth_Timer -= diff; - } + mob_phoenix_egg_tkAI(Creature *c) : ScriptedAI(c) {} + + uint32 Rebirth_Timer; + bool summoned; + + void Reset(){ + Rebirth_Timer = 15000; + summoned = false; + } + + //ignore any + void MoveInLineOfSight(Unit* who) { return; } + + void AttackStart(Unit* who) + { + if (m_creature->Attack(who, false)) + { + if (!InCombat) + { + InCombat = true; + Aggro(who); + } + DoStartNoMovement(who); + } + } + + void Aggro(Unit *who) { } + + void JustSummoned(Creature* summoned) + { + summoned->AddThreat(m_creature->getVictim(), 0.0f); + summoned->CastSpell(summoned,SPELL_REBIRTH,false); + } + + void UpdateAI(const uint32 diff) + { + if (Rebirth_Timer < diff) + { + if(!summoned) + { + Creature* Phoenix = m_creature->SummonCreature(PHOENIX,m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),m_creature->GetOrientation(),TEMPSUMMON_CORPSE_DESPAWN,5000); + summoned = true; + } + m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + }else Rebirth_Timer -= diff; + } }; CreatureAI* GetAI_boss_kaelthas(Creature *_Creature) |