diff options
author | John Holiver <none@none> | 2010-08-08 05:01:17 -0300 |
---|---|---|
committer | John Holiver <none@none> | 2010-08-08 05:01:17 -0300 |
commit | 99a054bfd2552287fb3220b44616f831e981727b (patch) | |
tree | ea6c0281afde325c484fb4a2e2fa7bfbcbf2feaa /src | |
parent | 0ce01cdb63bba202a0f0be6c7d0eac3dd6cb5df2 (diff) |
Converting EasternKingdoms/ZulAman and EasternKingdoms/ZulGurub.
Need to recheck tomorrow. :)
--HG--
branch : trunk
Diffstat (limited to 'src')
24 files changed, 5042 insertions, 4788 deletions
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp index 6c97607e296..c470eba6648 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp @@ -374,12 +374,12 @@ EndScriptData */ #define SPELL_BOSS_OBJECT_VISUAL 11206 -class go_altar_of_archaedas : public CreatureScript +class go_altar_of_archaedas : public GameObjectScript { public: go_altar_of_archaedas() - : CreatureScript("go_altar_of_archaedas") + : GameObjectScript("go_altar_of_archaedas") { } @@ -406,12 +406,12 @@ EndScriptData */ #define SPELL_BOSS_OBJECT_VISUAL 11206 -class go_altar_of_the_keepers : public CreatureScript +class go_altar_of_the_keepers : public GameObjectScript { public: go_altar_of_the_keepers() - : CreatureScript("go_altar_of_the_keepers") + : GameObjectScript("go_altar_of_the_keepers") { } diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index 2c9547955cb..ddd4c52f438 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -298,5 +298,5 @@ class instance_uldaman : public InstanceMapScript void AddSC_instance_uldaman() { - new instance_uldaman; + new instance_uldaman(); }
\ No newline at end of file diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index 2be5b6caacb..6f048557858 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -59,411 +59,421 @@ EndScriptData */ #define SE_LOC_Y_MAX 1435 #define SE_LOC_Y_MIN 1370 -struct boss_akilzonAI : public ScriptedAI +class boss_akilzon : public CreatureScript { - boss_akilzonAI(Creature *c) : ScriptedAI(c) - { - SpellEntry *TempSpell = GET_SPELL(SPELL_ELECTRICAL_DAMAGE); - if (TempSpell) - TempSpell->EffectBasePoints[1] = 49;//disable bugged lightning until fixed in core - pInstance = c->GetInstanceData(); - } - ScriptedInstance *pInstance; - - uint64 BirdGUIDs[8]; - uint64 TargetGUID; - uint64 CycloneGUID; - uint64 CloudGUID; - - uint32 StaticDisruption_Timer; - uint32 GustOfWind_Timer; - uint32 CallLighting_Timer; - uint32 ElectricalStorm_Timer; - uint32 SummonEagles_Timer; - uint32 Enrage_Timer; - - uint32 StormCount; - uint32 StormSequenceTimer; - - bool isRaining; - - void Reset() - { - if (pInstance) - pInstance->SetData(DATA_AKILZONEVENT, NOT_STARTED); - - StaticDisruption_Timer = urand(10000,20000); //10 to 20 seconds (bosskillers) - GustOfWind_Timer = urand(20000,30000); //20 to 30 seconds(bosskillers) - CallLighting_Timer = urand(10000,20000); //totaly random timer. can't find any info on this - ElectricalStorm_Timer = 60000; //60 seconds(bosskillers) - Enrage_Timer = 10*MINUTE*IN_MILLISECONDS; //10 minutes till enrage(bosskillers) - SummonEagles_Timer = 99999; - - TargetGUID = 0; - CloudGUID = 0; - CycloneGUID = 0; - DespawnSummons(); - for (uint8 i = 0; i < 8; ++i) - BirdGUIDs[i] = 0; - - StormCount = 0; - StormSequenceTimer = 0; - - isRaining = false; - - SetWeather(WEATHER_STATE_FINE, 0.0f); - } - - void EnterCombat(Unit * /*who*/) - { - me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_ONAGGRO); - //DoZoneInCombat(); - if (pInstance) - pInstance->SetData(DATA_AKILZONEVENT, IN_PROGRESS); - } - - void JustDied(Unit* /*Killer*/) - { - me->MonsterYell(SAY_ONDEATH,LANG_UNIVERSAL,NULL); - DoPlaySoundToSet(me, SOUND_ONDEATH); - if (pInstance) - pInstance->SetData(DATA_AKILZONEVENT, DONE); - DespawnSummons(); - } - - void KilledUnit(Unit* /*victim*/) - { - switch (urand(0,1)) + public: + + boss_akilzon() + : CreatureScript("boss_akilzon") { - case 0: - me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_ONSLAY1); - break; - case 1: - me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_ONSLAY2); - break; } - } - void DespawnSummons() - { - for (uint8 i = 0; i < 8; ++i) + struct boss_akilzonAI : public ScriptedAI { - Unit* bird = Unit::GetUnit(*me,BirdGUIDs[i]); - if (bird && bird->isAlive()) + boss_akilzonAI(Creature *c) : ScriptedAI(c) { - bird->SetVisibility(VISIBILITY_OFF); - bird->setDeathState(JUST_DIED); + SpellEntry *TempSpell = GET_SPELL(SPELL_ELECTRICAL_DAMAGE); + if (TempSpell) + TempSpell->EffectBasePoints[1] = 49;//disable bugged lightning until fixed in core + pInstance = c->GetInstanceData(); } - } - } + ScriptedInstance *pInstance; - void SetWeather(uint32 weather, float grade) - { - Map* pMap = me->GetMap(); - if (!pMap->IsDungeon()) - return; + uint64 BirdGUIDs[8]; + uint64 TargetGUID; + uint64 CycloneGUID; + uint64 CloudGUID; - WorldPacket data(SMSG_WEATHER, (4+4+4)); - data << uint32(weather) << float(grade) << uint8(0); + uint32 StaticDisruption_Timer; + uint32 GustOfWind_Timer; + uint32 CallLighting_Timer; + uint32 ElectricalStorm_Timer; + uint32 SummonEagles_Timer; + uint32 Enrage_Timer; - pMap->SendToPlayers(&data); - } + uint32 StormCount; + uint32 StormSequenceTimer; - void HandleStormSequence(Unit *Cloud) // 1: begin, 2-9: tick, 10: end - { - if (StormCount < 10 && StormCount > 1) - { - // deal damage - int32 bp0 = 800; - for (uint8 i = 2; i < StormCount; ++i) - bp0 *= 2; + bool isRaining; - CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); - Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_AKILZONEVENT, NOT_STARTED); - std::list<Unit *> tempUnitMap; + StaticDisruption_Timer = urand(10000,20000); //10 to 20 seconds (bosskillers) + GustOfWind_Timer = urand(20000,30000); //20 to 30 seconds(bosskillers) + CallLighting_Timer = urand(10000,20000); //totaly random timer. can't find any info on this + ElectricalStorm_Timer = 60000; //60 seconds(bosskillers) + Enrage_Timer = 10*MINUTE*IN_MILLISECONDS; //10 minutes till enrage(bosskillers) + SummonEagles_Timer = 99999; - { - Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(me, me, 999); - Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck> searcher(me, tempUnitMap, u_check); + TargetGUID = 0; + CloudGUID = 0; + CycloneGUID = 0; + DespawnSummons(); + for (uint8 i = 0; i < 8; ++i) + BirdGUIDs[i] = 0; + + StormCount = 0; + StormSequenceTimer = 0; + + isRaining = false; - TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); - TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); + SetWeather(WEATHER_STATE_FINE, 0.0f); + } - cell.Visit(p, world_unit_searcher, *(me->GetMap())); - cell.Visit(p, grid_unit_searcher, *(me->GetMap())); + void EnterCombat(Unit * /*who*/) + { + me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_ONAGGRO); + //DoZoneInCombat(); + if (pInstance) + pInstance->SetData(DATA_AKILZONEVENT, IN_PROGRESS); } - //dealdamege - for (std::list<Unit*>::const_iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i) + + void JustDied(Unit* /*Killer*/) { - if (!Cloud->IsWithinDist(*i, 6, false)) + me->MonsterYell(SAY_ONDEATH,LANG_UNIVERSAL,NULL); + DoPlaySoundToSet(me, SOUND_ONDEATH); + if (pInstance) + pInstance->SetData(DATA_AKILZONEVENT, DONE); + DespawnSummons(); + } + + void KilledUnit(Unit* /*victim*/) + { + switch (urand(0,1)) { - Cloud->CastCustomSpell(*i, 43137, &bp0, NULL, NULL, true, 0, 0, me->GetGUID()); + case 0: + me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_ONSLAY1); + break; + case 1: + me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_ONSLAY2); + break; } } - // visual - float x,y,z; - z = me->GetPositionZ(); - for (uint8 i = 0; i < 5+rand()%5; ++i) + + void DespawnSummons() { - x = 343+rand()%60; - y = 1380+rand()%60; - if (Unit *trigger = me->SummonTrigger(x, y, z, 0, 2000)) + for (uint8 i = 0; i < 8; ++i) { - trigger->setFaction(35); - trigger->SetMaxHealth(100000); - trigger->SetHealth(100000); - trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (Cloud) - Cloud->CastCustomSpell(trigger, /*43661*/43137, &bp0, NULL, NULL,true, 0, 0, Cloud->GetGUID()); + Unit* bird = Unit::GetUnit(*me,BirdGUIDs[i]); + if (bird && bird->isAlive()) + { + bird->SetVisibility(VISIBILITY_OFF); + bird->setDeathState(JUST_DIED); + } } } - } - ++StormCount; - if (StormCount > 10) - { - StormCount = 0; // finish - SummonEagles_Timer = 5000; - me->InterruptNonMeleeSpells(false); - CloudGUID = 0; - if (Cloud) - Cloud->DealDamage(Cloud, Cloud->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - SetWeather(WEATHER_STATE_FINE, 0.0f); - isRaining = false; - } - StormSequenceTimer = 1000; - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - if (StormCount) - { - Unit *pTarget = Unit::GetUnit(*me, CloudGUID); - if (!pTarget || !pTarget->isAlive()) + void SetWeather(uint32 weather, float grade) { - EnterEvadeMode(); - return; - } - else if (Unit* Cyclone = Unit::GetUnit(*me, CycloneGUID)) - Cyclone->CastSpell(pTarget, 25160, true); // keep casting or... + Map* pMap = me->GetMap(); + if (!pMap->IsDungeon()) + return; - if (StormSequenceTimer <= diff) - HandleStormSequence(pTarget); - else - StormSequenceTimer -= diff; + WorldPacket data(SMSG_WEATHER, (4+4+4)); + data << uint32(weather) << float(grade) << uint8(0); - return; - } + pMap->SendToPlayers(&data); + } - if (Enrage_Timer <= diff) - { - me->MonsterYell(SAY_ONENRAGE, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_ONENRAGE); - DoCast(me, SPELL_BERSERK, true); - Enrage_Timer = 600000; - } else Enrage_Timer -= diff; + void HandleStormSequence(Unit *Cloud) // 1: begin, 2-9: tick, 10: end + { + if (StormCount < 10 && StormCount > 1) + { + // deal damage + int32 bp0 = 800; + for (uint8 i = 2; i < StormCount; ++i) + bp0 *= 2; - if (StaticDisruption_Timer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); - if (!pTarget) pTarget = me->getVictim(); - TargetGUID = pTarget->GetGUID(); - DoCast(pTarget, SPELL_STATIC_DISRUPTION, false); - me->SetInFront(me->getVictim()); - StaticDisruption_Timer = (10+rand()%8)*1000; // < 20s - - /*if (float dist = me->IsWithinDist3d(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 5.0f) dist = 5.0f; - SDisruptAOEVisual_Timer = 1000 + floor(dist / 30 * 1000.0f);*/ - } else StaticDisruption_Timer -= diff; - - if (GustOfWind_Timer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); - if (!pTarget) pTarget = me->getVictim(); - DoCast(pTarget, SPELL_GUST_OF_WIND); - GustOfWind_Timer = (20+rand()%10)*1000; //20 to 30 seconds(bosskillers) - } else GustOfWind_Timer -= diff; + CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + Cell cell(p); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); - if (CallLighting_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CALL_LIGHTNING); - CallLighting_Timer = (12 + rand()%5)*1000; //totaly random timer. can't find any info on this - } else CallLighting_Timer -= diff; + std::list<Unit *> tempUnitMap; - if (!isRaining && ElectricalStorm_Timer < 8000 + rand()%5000) - { - SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f); - isRaining = true; - } + { + Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(me, me, 999); + Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck> searcher(me, tempUnitMap, u_check); - if (ElectricalStorm_Timer <= diff) { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true); - if (!pTarget) - { - EnterEvadeMode(); - return; - } - pTarget->CastSpell(pTarget, 44007, true);//cloud visual - DoCast(pTarget, SPELL_ELECTRICAL_STORM, false);//storm cyclon + visual - float x,y,z; - pTarget->GetPosition(x,y,z); - if (pTarget) - { - pTarget->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); - pTarget->SendMonsterMove(x,y,me->GetPositionZ()+15,0); + TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); + TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); + + cell.Visit(p, world_unit_searcher, *(me->GetMap())); + cell.Visit(p, grid_unit_searcher, *(me->GetMap())); + } + //dealdamege + for (std::list<Unit*>::const_iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i) + { + if (!Cloud->IsWithinDist(*i, 6, false)) + { + Cloud->CastCustomSpell(*i, 43137, &bp0, NULL, NULL, true, 0, 0, me->GetGUID()); + } + } + // visual + float x,y,z; + z = me->GetPositionZ(); + for (uint8 i = 0; i < 5+rand()%5; ++i) + { + x = 343+rand()%60; + y = 1380+rand()%60; + if (Unit *trigger = me->SummonTrigger(x, y, z, 0, 2000)) + { + trigger->setFaction(35); + trigger->SetMaxHealth(100000); + trigger->SetHealth(100000); + trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (Cloud) + Cloud->CastCustomSpell(trigger, /*43661*/43137, &bp0, NULL, NULL,true, 0, 0, Cloud->GetGUID()); + } + } + } + ++StormCount; + if (StormCount > 10) + { + StormCount = 0; // finish + SummonEagles_Timer = 5000; + me->InterruptNonMeleeSpells(false); + CloudGUID = 0; + if (Cloud) + Cloud->DealDamage(Cloud, Cloud->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + SetWeather(WEATHER_STATE_FINE, 0.0f); + isRaining = false; + } + StormSequenceTimer = 1000; } - Unit *Cloud = me->SummonTrigger(x, y, me->GetPositionZ()+16, 0, 15000); - if (Cloud) + + void UpdateAI(const uint32 diff) { - CloudGUID = Cloud->GetGUID(); - Cloud->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); - Cloud->StopMoving(); - Cloud->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); - Cloud->setFaction(35); - Cloud->SetMaxHealth(9999999); - Cloud->SetHealth(9999999); - Cloud->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - ElectricalStorm_Timer = 60000; //60 seconds(bosskillers) - StormCount = 1; - StormSequenceTimer = 0; - } else ElectricalStorm_Timer -= diff; + if (!UpdateVictim()) + return; - if (SummonEagles_Timer <= diff) - { - me->MonsterYell(SAY_ONSUMMON, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_ONSUMMON); + if (StormCount) + { + Unit *pTarget = Unit::GetUnit(*me, CloudGUID); + if (!pTarget || !pTarget->isAlive()) + { + EnterEvadeMode(); + return; + } + else if (Unit* Cyclone = Unit::GetUnit(*me, CycloneGUID)) + Cyclone->CastSpell(pTarget, 25160, true); // keep casting or... - float x, y, z; - me->GetPosition(x, y, z); + if (StormSequenceTimer <= diff) + HandleStormSequence(pTarget); + else + StormSequenceTimer -= diff; - for (uint8 i = 0; i < 8; ++i) - { - Unit* bird = Unit::GetUnit(*me,BirdGUIDs[i]); - if (!bird) //they despawned on die + return; + } + + if (Enrage_Timer <= diff) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + me->MonsterYell(SAY_ONENRAGE, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_ONENRAGE); + DoCast(me, SPELL_BERSERK, true); + Enrage_Timer = 600000; + } else Enrage_Timer -= diff; + + if (StaticDisruption_Timer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); + if (!pTarget) pTarget = me->getVictim(); + TargetGUID = pTarget->GetGUID(); + DoCast(pTarget, SPELL_STATIC_DISRUPTION, false); + me->SetInFront(me->getVictim()); + StaticDisruption_Timer = (10+rand()%8)*1000; // < 20s + + /*if (float dist = me->IsWithinDist3d(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 5.0f) dist = 5.0f; + SDisruptAOEVisual_Timer = 1000 + floor(dist / 30 * 1000.0f);*/ + } else StaticDisruption_Timer -= diff; + + if (GustOfWind_Timer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); + if (!pTarget) pTarget = me->getVictim(); + DoCast(pTarget, SPELL_GUST_OF_WIND); + GustOfWind_Timer = (20+rand()%10)*1000; //20 to 30 seconds(bosskillers) + } else GustOfWind_Timer -= diff; + + if (CallLighting_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CALL_LIGHTNING); + CallLighting_Timer = (12 + rand()%5)*1000; //totaly random timer. can't find any info on this + } else CallLighting_Timer -= diff; + + if (!isRaining && ElectricalStorm_Timer < 8000 + rand()%5000) + { + SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f); + isRaining = true; + } + + if (ElectricalStorm_Timer <= diff) { + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true); + if (!pTarget) { - x = pTarget->GetPositionX() + irand(-10,10); - y = pTarget->GetPositionY() + irand(-10,10); - z = pTarget->GetPositionZ() + urand(16,20); - if (z > 95) - z = 95 - urand(0,5); + EnterEvadeMode(); + return; } - Creature *pCreature = me->SummonCreature(MOB_SOARING_EAGLE, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (pCreature) + pTarget->CastSpell(pTarget, 44007, true);//cloud visual + DoCast(pTarget, SPELL_ELECTRICAL_STORM, false);//storm cyclon + visual + float x,y,z; + pTarget->GetPosition(x,y,z); + if (pTarget) { - pCreature->AddThreat(me->getVictim(), 1.0f); - pCreature->AI()->AttackStart(me->getVictim()); - BirdGUIDs[i] = pCreature->GetGUID(); + pTarget->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + pTarget->SendMonsterMove(x,y,me->GetPositionZ()+15,0); } - } + Unit *Cloud = me->SummonTrigger(x, y, me->GetPositionZ()+16, 0, 15000); + if (Cloud) + { + CloudGUID = Cloud->GetGUID(); + Cloud->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + Cloud->StopMoving(); + Cloud->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); + Cloud->setFaction(35); + Cloud->SetMaxHealth(9999999); + Cloud->SetHealth(9999999); + Cloud->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + ElectricalStorm_Timer = 60000; //60 seconds(bosskillers) + StormCount = 1; + StormSequenceTimer = 0; + } else ElectricalStorm_Timer -= diff; + + if (SummonEagles_Timer <= diff) + { + me->MonsterYell(SAY_ONSUMMON, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_ONSUMMON); + + float x, y, z; + me->GetPosition(x, y, z); + + for (uint8 i = 0; i < 8; ++i) + { + Unit* bird = Unit::GetUnit(*me,BirdGUIDs[i]); + if (!bird) //they despawned on die + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + x = pTarget->GetPositionX() + irand(-10,10); + y = pTarget->GetPositionY() + irand(-10,10); + z = pTarget->GetPositionZ() + urand(16,20); + if (z > 95) + z = 95 - urand(0,5); + } + Creature *pCreature = me->SummonCreature(MOB_SOARING_EAGLE, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + if (pCreature) + { + pCreature->AddThreat(me->getVictim(), 1.0f); + pCreature->AI()->AttackStart(me->getVictim()); + BirdGUIDs[i] = pCreature->GetGUID(); + } + } + } + SummonEagles_Timer = 999999; + } else SummonEagles_Timer -= diff; + + DoMeleeAttackIfReady(); } - SummonEagles_Timer = 999999; - } else SummonEagles_Timer -= diff; + }; - DoMeleeAttackIfReady(); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_akilzonAI(creature); + } }; -struct mob_soaring_eagleAI : public ScriptedAI +class mob_akilzon_eagle : public CreatureScript { - mob_soaring_eagleAI(Creature *c) : ScriptedAI(c) {} + public: - uint32 EagleSwoop_Timer; - bool arrived; - uint32 TargetGUID; + mob_akilzon_eagle() + : CreatureScript("mob_akilzon_eagle") + { + } - void Reset() - { - EagleSwoop_Timer = 5000 + rand()%5000; - arrived = true; - TargetGUID = 0; - me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); - } + struct mob_akilzon_eagleAI : public ScriptedAI + { + mob_akilzon_eagleAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit * /*who*/) {DoZoneInCombat();} + uint32 EagleSwoop_Timer; + bool arrived; + uint32 TargetGUID; - void MoveInLineOfSight(Unit* /*who*/) {} + void Reset() + { + EagleSwoop_Timer = 5000 + rand()%5000; + arrived = true; + TargetGUID = 0; + me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + } - void MovementInform(uint32, uint32) - { - arrived = true; - if (TargetGUID) - { - if (Unit *pTarget = Unit::GetUnit(*me, TargetGUID)) - DoCast(pTarget, SPELL_EAGLE_SWOOP, true); - TargetGUID = 0; - me->SetSpeed(MOVE_RUN, 1.2f); - EagleSwoop_Timer = 5000 + rand()%5000; - } - } + void EnterCombat(Unit * /*who*/) {DoZoneInCombat();} - void UpdateAI(const uint32 diff) - { - if (EagleSwoop_Timer <= diff) - EagleSwoop_Timer = 0; - else - EagleSwoop_Timer -= diff; + void MoveInLineOfSight(Unit* /*who*/) {} - if (arrived) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + void MovementInform(uint32, uint32) { - float x, y, z; - if (EagleSwoop_Timer) + arrived = true; + if (TargetGUID) { - x = pTarget->GetPositionX() + irand(-10,10); - y = pTarget->GetPositionY() + irand(-10,10); - z = pTarget->GetPositionZ() + urand(10,15); - if (z > 95) - z = 95 - urand(0,5); + if (Unit *pTarget = Unit::GetUnit(*me, TargetGUID)) + DoCast(pTarget, SPELL_EAGLE_SWOOP, true); + TargetGUID = 0; + me->SetSpeed(MOVE_RUN, 1.2f); + EagleSwoop_Timer = 5000 + rand()%5000; } + } + + void UpdateAI(const uint32 diff) + { + if (EagleSwoop_Timer <= diff) + EagleSwoop_Timer = 0; else + EagleSwoop_Timer -= diff; + + if (arrived) { - pTarget->GetContactPoint(me, x, y, z); - z += 2; - me->SetSpeed(MOVE_RUN, 5.0f); - TargetGUID = pTarget->GetGUID(); + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + float x, y, z; + if (EagleSwoop_Timer) + { + x = pTarget->GetPositionX() + irand(-10,10); + y = pTarget->GetPositionY() + irand(-10,10); + z = pTarget->GetPositionZ() + urand(10,15); + if (z > 95) + z = 95 - urand(0,5); + } + else + { + pTarget->GetContactPoint(me, x, y, z); + z += 2; + me->SetSpeed(MOVE_RUN, 5.0f); + TargetGUID = pTarget->GetGUID(); + } + me->GetMotionMaster()->MovePoint(0, x, y, z); + arrived = false; + } } - me->GetMotionMaster()->MovePoint(0, x, y, z); - arrived = false; } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new mob_akilzon_eagleAI(creature); } - } }; -//Soaring Eagle -CreatureAI* GetAI_mob_soaring_eagle(Creature* pCreature) -{ - return new mob_soaring_eagleAI(pCreature); -} - -CreatureAI* GetAI_boss_akilzon(Creature* pCreature) -{ - return new boss_akilzonAI(pCreature); -} - void AddSC_boss_akilzon() { - Script *newscript = NULL; - - newscript = new Script; - newscript->Name = "boss_akilzon"; - newscript->GetAI = &GetAI_boss_akilzon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_akilzon_eagle"; - newscript->GetAI = &GetAI_mob_soaring_eagle; - newscript->RegisterSelf(); + new boss_akilzon(); + new mob_akilzon_eagle(); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp index a846e3f8779..08896c91b1b 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp @@ -73,331 +73,342 @@ enum PhaseHalazzi PHASE_ENRAGE = 5 }; -struct boss_halazziAI : public ScriptedAI +class boss_halazzi : public CreatureScript { - boss_halazziAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - // need to find out what controls totem's spell cooldown - SpellEntry *TempSpell = GET_SPELL(SPELL_LIGHTNING); - if (TempSpell && TempSpell->CastingTimeIndex != 5) - TempSpell->CastingTimeIndex = 5; // 2000 ms casting time - } - - ScriptedInstance *pInstance; - - uint32 FrenzyTimer; - uint32 SaberlashTimer; - uint32 ShockTimer; - uint32 TotemTimer; - uint32 CheckTimer; - uint32 BerserkTimer; - - uint32 TransformCount; - - PhaseHalazzi Phase; - - uint64 LynxGUID; - - void Reset() - { - if (pInstance) - pInstance->SetData(DATA_HALAZZIEVENT, NOT_STARTED); - - TransformCount = 0; - BerserkTimer = 600000; - CheckTimer = 1000; - - DoCast(me, SPELL_DUAL_WIELD, true); - - Phase = PHASE_NONE; - EnterPhase(PHASE_LYNX); - } - - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_HALAZZIEVENT, IN_PROGRESS); - - me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_AGGRO); - - EnterPhase(PHASE_LYNX); - } - - void JustSummoned(Creature* summon) - { - summon->AI()->AttackStart(me->getVictim()); - if (summon->GetEntry() == MOB_SPIRIT_LYNX) - LynxGUID = summon->GetGUID(); - } - - void DamageTaken(Unit * /*done_by*/, uint32 &damage) - { - if (damage >= me->GetHealth() && Phase != PHASE_ENRAGE) - damage = 0; - } - - void SpellHit(Unit*, const SpellEntry *spell) - { - if (spell->Id == SPELL_TRANSFORM_SPLIT2) - EnterPhase(PHASE_HUMAN); - } - - void AttackStart(Unit *who) - { - if (Phase != PHASE_MERGE) ScriptedAI::AttackStart(who); - } - - void EnterPhase(PhaseHalazzi NextPhase) - { - switch(NextPhase) + public: + + boss_halazzi() + : CreatureScript("boss_halazzi") + { + } + + struct boss_halazziAI : public ScriptedAI { - case PHASE_LYNX: - case PHASE_ENRAGE: - if (Phase == PHASE_MERGE) + boss_halazziAI(Creature *c) : ScriptedAI(c) { - DoCast(me, SPELL_TRANSFORM_MERGE, true); - me->Attack(me->getVictim(), true); - me->GetMotionMaster()->MoveChase(me->getVictim()); + pInstance = c->GetInstanceData(); + // need to find out what controls totem's spell cooldown + SpellEntry *TempSpell = GET_SPELL(SPELL_LIGHTNING); + if (TempSpell && TempSpell->CastingTimeIndex != 5) + TempSpell->CastingTimeIndex = 5; // 2000 ms casting time } - if (Creature *Lynx = Unit::GetCreature(*me, LynxGUID)) - Lynx->DisappearAndDie(); - me->SetMaxHealth(600000); - me->SetHealth(600000 - 150000 * TransformCount); - FrenzyTimer = 16000; - SaberlashTimer = 20000; - ShockTimer = 10000; - TotemTimer = 12000; - break; - case PHASE_SPLIT: - me->MonsterYell(YELL_SPLIT, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_SPLIT); - DoCast(me, SPELL_TRANSFORM_SPLIT, true); - break; - case PHASE_HUMAN: - //DoCast(me, SPELL_SUMMON_LYNX, true); - DoSpawnCreature(MOB_SPIRIT_LYNX, 5,5,0,0, TEMPSUMMON_CORPSE_DESPAWN, 0); - me->SetMaxHealth(400000); - me->SetHealth(400000); - ShockTimer = 10000; - TotemTimer = 12000; - break; - case PHASE_MERGE: - if (Unit *pLynx = Unit::GetUnit(*me, LynxGUID)) + + ScriptedInstance *pInstance; + + uint32 FrenzyTimer; + uint32 SaberlashTimer; + uint32 ShockTimer; + uint32 TotemTimer; + uint32 CheckTimer; + uint32 BerserkTimer; + + uint32 TransformCount; + + PhaseHalazzi Phase; + + uint64 LynxGUID; + + void Reset() { - me->MonsterYell(YELL_MERGE, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_MERGE); - pLynx->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pLynx->GetMotionMaster()->Clear(); - pLynx->GetMotionMaster()->MoveFollow(me, 0, 0); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveFollow(pLynx, 0, 0); - ++TransformCount; + if (pInstance) + pInstance->SetData(DATA_HALAZZIEVENT, NOT_STARTED); + + TransformCount = 0; + BerserkTimer = 600000; + CheckTimer = 1000; + + DoCast(me, SPELL_DUAL_WIELD, true); + + Phase = PHASE_NONE; + EnterPhase(PHASE_LYNX); } - break; - default: - break; - } - Phase = NextPhase; - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_HALAZZIEVENT, IN_PROGRESS); - if (BerserkTimer <= diff) - { - me->MonsterYell(YELL_BERSERK, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_BERSERK); - DoCast(me, SPELL_BERSERK, true); - BerserkTimer = 60000; - } else BerserkTimer -= diff; + me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_AGGRO); - if (Phase == PHASE_LYNX || Phase == PHASE_ENRAGE) - { - if (SaberlashTimer <= diff) + EnterPhase(PHASE_LYNX); + } + + void JustSummoned(Creature* summon) { - // A tank with more than 490 defense skills should receive no critical hit - //DoCast(me, 41296, true); - DoCast(me->getVictim(), SPELL_SABER_LASH, true); - //me->RemoveAurasDueToSpell(41296); - SaberlashTimer = 30000; - } else SaberlashTimer -= diff; - - if (FrenzyTimer <= diff) + summon->AI()->AttackStart(me->getVictim()); + if (summon->GetEntry() == MOB_SPIRIT_LYNX) + LynxGUID = summon->GetGUID(); + } + + void DamageTaken(Unit * /*done_by*/, uint32 &damage) { - DoCast(me, SPELL_FRENZY); - FrenzyTimer = urand(10000,15000); - } else FrenzyTimer -= diff; + if (damage >= me->GetHealth() && Phase != PHASE_ENRAGE) + damage = 0; + } - if (Phase == PHASE_LYNX) - if (CheckTimer <= diff) - { - if (me->GetHealth() * 4 < me->GetMaxHealth() * (3 - TransformCount)) - EnterPhase(PHASE_SPLIT); - CheckTimer = 1000; - } else CheckTimer -= diff; - } + void SpellHit(Unit*, const SpellEntry *spell) + { + if (spell->Id == SPELL_TRANSFORM_SPLIT2) + EnterPhase(PHASE_HUMAN); + } - if (Phase == PHASE_HUMAN || Phase == PHASE_ENRAGE) - { - if (TotemTimer <= diff) + void AttackStart(Unit *who) { - DoCast(me, SPELL_SUMMON_TOTEM); - TotemTimer = 20000; - } else TotemTimer -= diff; + if (Phase != PHASE_MERGE) ScriptedAI::AttackStart(who); + } + + void EnterPhase(PhaseHalazzi NextPhase) + { + switch(NextPhase) + { + case PHASE_LYNX: + case PHASE_ENRAGE: + if (Phase == PHASE_MERGE) + { + DoCast(me, SPELL_TRANSFORM_MERGE, true); + me->Attack(me->getVictim(), true); + me->GetMotionMaster()->MoveChase(me->getVictim()); + } + if (Creature *Lynx = Unit::GetCreature(*me, LynxGUID)) + Lynx->DisappearAndDie(); + me->SetMaxHealth(600000); + me->SetHealth(600000 - 150000 * TransformCount); + FrenzyTimer = 16000; + SaberlashTimer = 20000; + ShockTimer = 10000; + TotemTimer = 12000; + break; + case PHASE_SPLIT: + me->MonsterYell(YELL_SPLIT, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_SPLIT); + DoCast(me, SPELL_TRANSFORM_SPLIT, true); + break; + case PHASE_HUMAN: + //DoCast(me, SPELL_SUMMON_LYNX, true); + DoSpawnCreature(MOB_SPIRIT_LYNX, 5,5,0,0, TEMPSUMMON_CORPSE_DESPAWN, 0); + me->SetMaxHealth(400000); + me->SetHealth(400000); + ShockTimer = 10000; + TotemTimer = 12000; + break; + case PHASE_MERGE: + if (Unit *pLynx = Unit::GetUnit(*me, LynxGUID)) + { + me->MonsterYell(YELL_MERGE, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_MERGE); + pLynx->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pLynx->GetMotionMaster()->Clear(); + pLynx->GetMotionMaster()->MoveFollow(me, 0, 0); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveFollow(pLynx, 0, 0); + ++TransformCount; + } + break; + default: + break; + } + Phase = NextPhase; + } - if (ShockTimer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (!UpdateVictim()) + return; + + if (BerserkTimer <= diff) + { + me->MonsterYell(YELL_BERSERK, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_BERSERK); + DoCast(me, SPELL_BERSERK, true); + BerserkTimer = 60000; + } else BerserkTimer -= diff; + + if (Phase == PHASE_LYNX || Phase == PHASE_ENRAGE) + { + if (SaberlashTimer <= diff) + { + // A tank with more than 490 defense skills should receive no critical hit + //DoCast(me, 41296, true); + DoCast(me->getVictim(), SPELL_SABER_LASH, true); + //me->RemoveAurasDueToSpell(41296); + SaberlashTimer = 30000; + } else SaberlashTimer -= diff; + + if (FrenzyTimer <= diff) + { + DoCast(me, SPELL_FRENZY); + FrenzyTimer = urand(10000,15000); + } else FrenzyTimer -= diff; + + if (Phase == PHASE_LYNX) + if (CheckTimer <= diff) + { + if (me->GetHealth() * 4 < me->GetMaxHealth() * (3 - TransformCount)) + EnterPhase(PHASE_SPLIT); + CheckTimer = 1000; + } else CheckTimer -= diff; + } + + if (Phase == PHASE_HUMAN || Phase == PHASE_ENRAGE) { - if (pTarget->IsNonMeleeSpellCasted(false)) - DoCast(pTarget, SPELL_EARTHSHOCK); - else - DoCast(pTarget, SPELL_FLAMESHOCK); - ShockTimer = 10000 + rand()%5000; + if (TotemTimer <= diff) + { + DoCast(me, SPELL_SUMMON_TOTEM); + TotemTimer = 20000; + } else TotemTimer -= diff; + + if (ShockTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + if (pTarget->IsNonMeleeSpellCasted(false)) + DoCast(pTarget, SPELL_EARTHSHOCK); + else + DoCast(pTarget, SPELL_FLAMESHOCK); + ShockTimer = 10000 + rand()%5000; + } + } else ShockTimer -= diff; + + if (Phase == PHASE_HUMAN) + if (CheckTimer <= diff) + { + if (((me->GetHealth()*100) / me->GetMaxHealth() <= 20)/*me->GetHealth() * 10 < me->GetMaxHealth()*/) + EnterPhase(PHASE_MERGE); + else + { + Unit *Lynx = Unit::GetUnit(*me, LynxGUID); + if (Lynx && ((Lynx->GetHealth()*100) / Lynx->GetMaxHealth() <= 20)/*Lynx->GetHealth() * 10 < Lynx->GetMaxHealth()*/) + EnterPhase(PHASE_MERGE); + } + CheckTimer = 1000; + } else CheckTimer -= diff; } - } else ShockTimer -= diff; - if (Phase == PHASE_HUMAN) - if (CheckTimer <= diff) + if (Phase == PHASE_MERGE) { - if (((me->GetHealth()*100) / me->GetMaxHealth() <= 20)/*me->GetHealth() * 10 < me->GetMaxHealth()*/) - EnterPhase(PHASE_MERGE); - else + if (CheckTimer <= diff) { Unit *Lynx = Unit::GetUnit(*me, LynxGUID); - if (Lynx && ((Lynx->GetHealth()*100) / Lynx->GetMaxHealth() <= 20)/*Lynx->GetHealth() * 10 < Lynx->GetMaxHealth()*/) - EnterPhase(PHASE_MERGE); - } - CheckTimer = 1000; - } else CheckTimer -= diff; - } + if (Lynx) + { + Lynx->GetMotionMaster()->MoveFollow(me, 0, 0); + me->GetMotionMaster()->MoveFollow(Lynx, 0, 0); + if (me->IsWithinDistInMap(Lynx, 6.0f)) + { + if (TransformCount < 3) + EnterPhase(PHASE_LYNX); + else + EnterPhase(PHASE_ENRAGE); + } + } + CheckTimer = 1000; + } else CheckTimer -= diff; + } - if (Phase == PHASE_MERGE) - { - if (CheckTimer <= diff) + DoMeleeAttackIfReady(); + } + + void KilledUnit(Unit* /*victim*/) { - Unit *Lynx = Unit::GetUnit(*me, LynxGUID); - if (Lynx) + switch (urand(0,1)) { - Lynx->GetMotionMaster()->MoveFollow(me, 0, 0); - me->GetMotionMaster()->MoveFollow(Lynx, 0, 0); - if (me->IsWithinDistInMap(Lynx, 6.0f)) - { - if (TransformCount < 3) - EnterPhase(PHASE_LYNX); - else - EnterPhase(PHASE_ENRAGE); - } + case 0: + me->MonsterYell(YELL_KILL_ONE, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_KILL_ONE); + break; + + case 1: + me->MonsterYell(YELL_KILL_TWO, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_KILL_TWO); + break; } - CheckTimer = 1000; - } else CheckTimer -= diff; - } + } - DoMeleeAttackIfReady(); - } + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + pInstance->SetData(DATA_HALAZZIEVENT, DONE); + + me->MonsterYell(YELL_DEATH, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_DEATH); + } + }; - void KilledUnit(Unit* /*victim*/) - { - switch (urand(0,1)) + CreatureAI* GetAI(Creature* creature) const { - case 0: - me->MonsterYell(YELL_KILL_ONE, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_KILL_ONE); - break; - - case 1: - me->MonsterYell(YELL_KILL_TWO, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_KILL_TWO); - break; + return new boss_halazziAI(creature); } - } - - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(DATA_HALAZZIEVENT, DONE); - - me->MonsterYell(YELL_DEATH, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_DEATH); - } }; // Spirits Lynx AI - -struct boss_spiritlynxAI : public ScriptedAI +class mob_halazzi_lynx : public CreatureScript { - boss_spiritlynxAI(Creature *c) : ScriptedAI(c) {} + public: - uint32 FrenzyTimer; - uint32 shredder_timer; + mob_halazzi_lynx() + : CreatureScript("mob_halazzi_lynx") + { + } - void Reset() - { - FrenzyTimer = urand(30000,50000); //frenzy every 30-50 seconds - shredder_timer = 4000; - } + struct mob_halazzi_lynxAI : public ScriptedAI + { + mob_halazzi_lynxAI(Creature *c) : ScriptedAI(c) {} - void DamageTaken(Unit * /*done_by*/, uint32 &damage) - { - if (damage >= me->GetHealth()) - damage = 0; - } + uint32 FrenzyTimer; + uint32 shredder_timer; - void AttackStart(Unit *who) - { - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - ScriptedAI::AttackStart(who); - } + void Reset() + { + FrenzyTimer = urand(30000,50000); //frenzy every 30-50 seconds + shredder_timer = 4000; + } - void EnterCombat(Unit * /*who*/) {/*DoZoneInCombat();*/} + void DamageTaken(Unit * /*done_by*/, uint32 &damage) + { + if (damage >= me->GetHealth()) + damage = 0; + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void AttackStart(Unit *who) + { + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + ScriptedAI::AttackStart(who); + } - if (FrenzyTimer <= diff) - { - DoCast(me, SPELL_LYNX_FRENZY); - FrenzyTimer = urand(30000,50000); //frenzy every 30-50 seconds - } else FrenzyTimer -= diff; + void EnterCombat(Unit * /*who*/) {/*DoZoneInCombat();*/} - if (shredder_timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHRED_ARMOR); - shredder_timer = 4000; - } else shredder_timer -= diff; + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (FrenzyTimer <= diff) + { + DoCast(me, SPELL_LYNX_FRENZY); + FrenzyTimer = urand(30000,50000); //frenzy every 30-50 seconds + } else FrenzyTimer -= diff; - DoMeleeAttackIfReady(); - } + if (shredder_timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHRED_ARMOR); + shredder_timer = 4000; + } else shredder_timer -= diff; -}; + DoMeleeAttackIfReady(); + } -CreatureAI* GetAI_boss_halazziAI(Creature* pCreature) -{ - return new boss_halazziAI (pCreature); -} + }; -CreatureAI* GetAI_boss_spiritlynxAI(Creature* pCreature) -{ - return new boss_spiritlynxAI (pCreature); -} + CreatureAI* GetAI(Creature* creature) const + { + return new mob_halazzi_lynxAI(creature); + } +}; void AddSC_boss_halazzi() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_halazzi"; - newscript->GetAI = &GetAI_boss_halazziAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_halazzi_lynx"; - newscript->GetAI = &GetAI_boss_spiritlynxAI; - newscript->RegisterSelf(); + new boss_halazzi(); + new mob_halazzi_lynx(); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp index 5fa14fb56ab..b968f89ae8e 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp @@ -200,392 +200,437 @@ struct boss_hexlord_addAI : public ScriptedAI } }; -struct boss_hex_lord_malacrassAI : public ScriptedAI +class boss_hexlord_malacrass : public CreatureScript { - boss_hex_lord_malacrassAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - SelectAddEntry(); - for (uint8 i = 0; i < 4; ++i) - AddGUID[i] = 0; - } - - ScriptedInstance *pInstance; - - uint64 AddGUID[4]; - uint32 AddEntry[4]; + public: - uint64 PlayerGUID; - - uint32 SpiritBolts_Timer; - uint32 DrainPower_Timer; - uint32 SiphonSoul_Timer; - uint32 PlayerAbility_Timer; - uint32 CheckAddState_Timer; - uint32 ResetTimer; - - uint32 PlayerClass; + boss_hexlord_malacrass() + : CreatureScript("boss_hexlord_malacrass") + { + } - void Reset() - { - if (pInstance) - pInstance->SetData(DATA_HEXLORDEVENT, NOT_STARTED); + struct boss_hex_lord_malacrassAI : public ScriptedAI + { + boss_hex_lord_malacrassAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + SelectAddEntry(); + for (uint8 i = 0; i < 4; ++i) + AddGUID[i] = 0; + } - SpiritBolts_Timer = 20000; - DrainPower_Timer = 60000; - SiphonSoul_Timer = 100000; - PlayerAbility_Timer = 99999; - CheckAddState_Timer = 5000; - ResetTimer = 5000; + ScriptedInstance *pInstance; - SpawnAdds(); + uint64 AddGUID[4]; + uint32 AddEntry[4]; - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 46916); - me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); - } + uint64 PlayerGUID; - void EnterCombat(Unit* /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_HEXLORDEVENT, IN_PROGRESS); + uint32 SpiritBolts_Timer; + uint32 DrainPower_Timer; + uint32 SiphonSoul_Timer; + uint32 PlayerAbility_Timer; + uint32 CheckAddState_Timer; + uint32 ResetTimer; - DoZoneInCombat(); - me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_YELL_AGGRO); + uint32 PlayerClass; - for (uint8 i = 0; i < 4; ++i) - { - Unit* Temp = Unit::GetUnit((*me),AddGUID[i]); - if (Temp && Temp->isAlive()) - CAST_CRE(Temp)->AI()->AttackStart(me->getVictim()); - else + void Reset() { - EnterEvadeMode(); - break; - } - } - } + if (pInstance) + pInstance->SetData(DATA_HEXLORDEVENT, NOT_STARTED); - void KilledUnit(Unit* /*victim*/) - { - switch (urand(0,1)) - { - case 0: - me->MonsterYell(YELL_KILL_ONE, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_YELL_KILL_ONE); - break; - case 1: - me->MonsterYell(YELL_KILL_TWO, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_YELL_KILL_TWO); - break; - } - } - - void JustDied(Unit* /*victim*/) - { - if (pInstance) - pInstance->SetData(DATA_HEXLORDEVENT, DONE); - - me->MonsterYell(YELL_DEATH, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_YELL_DEATH); + SpiritBolts_Timer = 20000; + DrainPower_Timer = 60000; + SiphonSoul_Timer = 100000; + PlayerAbility_Timer = 99999; + CheckAddState_Timer = 5000; + ResetTimer = 5000; - for (uint8 i = 0; i < 4 ; ++i) - { - Unit* Temp = Unit::GetUnit((*me),AddGUID[i]); - if (Temp && Temp->isAlive()) - Temp->DealDamage(Temp, Temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - } + SpawnAdds(); - void SelectAddEntry() - { - std::vector<uint32> AddList; + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 46916); + me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); + } - for (uint8 i = 0; i < 8; ++i) - AddList.push_back(AddEntryList[i]); + void EnterCombat(Unit* /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_HEXLORDEVENT, IN_PROGRESS); - while (AddList.size() > 4) - AddList.erase(AddList.begin()+rand()%AddList.size()); + DoZoneInCombat(); + me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_YELL_AGGRO); - uint8 i = 0; - for (std::vector<uint32>::const_iterator itr = AddList.begin(); itr != AddList.end(); ++itr, ++i) - AddEntry[i] = *itr; - } + for (uint8 i = 0; i < 4; ++i) + { + Unit* Temp = Unit::GetUnit((*me),AddGUID[i]); + if (Temp && Temp->isAlive()) + CAST_CRE(Temp)->AI()->AttackStart(me->getVictim()); + else + { + EnterEvadeMode(); + break; + } + } + } - void SpawnAdds() - { - for (uint8 i = 0; i < 4; ++i) - { - Creature *pCreature = (Unit::GetCreature((*me), AddGUID[i])); - if (!pCreature || !pCreature->isAlive()) + void KilledUnit(Unit* /*victim*/) { - if (pCreature) pCreature->setDeathState(DEAD); - pCreature = me->SummonCreature(AddEntry[i], Pos_X[i], POS_Y, POS_Z, ORIENT, TEMPSUMMON_DEAD_DESPAWN, 0); - if (pCreature) AddGUID[i] = pCreature->GetGUID(); + switch (urand(0,1)) + { + case 0: + me->MonsterYell(YELL_KILL_ONE, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_YELL_KILL_ONE); + break; + case 1: + me->MonsterYell(YELL_KILL_TWO, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_YELL_KILL_TWO); + break; + } } - else + + void JustDied(Unit* /*victim*/) { - pCreature->AI()->EnterEvadeMode(); - pCreature->GetMap()->CreatureRelocation(me, Pos_X[i], POS_Y, POS_Z, ORIENT); - pCreature->StopMoving(); - } - } - } + if (pInstance) + pInstance->SetData(DATA_HEXLORDEVENT, DONE); - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + me->MonsterYell(YELL_DEATH, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_YELL_DEATH); - if (ResetTimer <= diff) - { - if (me->IsWithinDist3d(119.223, 1035.45, 29.4481, 10)) - { - EnterEvadeMode(); - return; + for (uint8 i = 0; i < 4 ; ++i) + { + Unit* Temp = Unit::GetUnit((*me),AddGUID[i]); + if (Temp && Temp->isAlive()) + Temp->DealDamage(Temp, Temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } } - ResetTimer = 5000; - } else ResetTimer -= diff; - if (CheckAddState_Timer <= diff) - { - for (uint8 i = 0; i < 4; ++i) - if (Creature *pTemp = Unit::GetCreature(*me, AddGUID[i])) - if (pTemp->isAlive() && !pTemp->getVictim()) - pTemp->AI()->AttackStart(me->getVictim()); + void SelectAddEntry() + { + std::vector<uint32> AddList; - CheckAddState_Timer = 5000; - } else CheckAddState_Timer -= diff; + for (uint8 i = 0; i < 8; ++i) + AddList.push_back(AddEntryList[i]); - if (DrainPower_Timer <= diff) - { - DoCast(me, SPELL_DRAIN_POWER, true); - me->MonsterYell(YELL_DRAIN_POWER, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_YELL_DRAIN_POWER); - DrainPower_Timer = urand(40000,55000); // must cast in 60 sec, or buff/debuff will disappear - } else DrainPower_Timer -= diff; + while (AddList.size() > 4) + AddList.erase(AddList.begin()+rand()%AddList.size()); - if (SpiritBolts_Timer <= diff) - { - if (DrainPower_Timer < 12000) // channel 10 sec - SpiritBolts_Timer = 13000; // cast drain power first - else - { - DoCast(me, SPELL_SPIRIT_BOLTS, false); - me->MonsterYell(YELL_SPIRIT_BOLTS, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_YELL_SPIRIT_BOLTS); - SpiritBolts_Timer = 40000; - SiphonSoul_Timer = 10000; // ready to drain - PlayerAbility_Timer = 99999; + uint8 i = 0; + for (std::vector<uint32>::const_iterator itr = AddList.begin(); itr != AddList.end(); ++itr, ++i) + AddEntry[i] = *itr; } - } else SpiritBolts_Timer -= diff; - if (SiphonSoul_Timer <= diff) - { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 70, true); - Unit *trigger = DoSpawnCreature(MOB_TEMP_TRIGGER, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 30000); - if (!pTarget || !trigger) + void SpawnAdds() { - EnterEvadeMode(); - return; + for (uint8 i = 0; i < 4; ++i) + { + Creature *pCreature = (Unit::GetCreature((*me), AddGUID[i])); + if (!pCreature || !pCreature->isAlive()) + { + if (pCreature) pCreature->setDeathState(DEAD); + pCreature = me->SummonCreature(AddEntry[i], Pos_X[i], POS_Y, POS_Z, ORIENT, TEMPSUMMON_DEAD_DESPAWN, 0); + if (pCreature) AddGUID[i] = pCreature->GetGUID(); + } + else + { + pCreature->AI()->EnterEvadeMode(); + pCreature->GetMap()->CreatureRelocation(me, Pos_X[i], POS_Y, POS_Z, ORIENT); + pCreature->StopMoving(); + } + } } - else + + void UpdateAI(const uint32 diff) { - trigger->SetDisplayId(11686); - trigger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - trigger->CastSpell(pTarget, SPELL_SIPHON_SOUL, true); - trigger->GetMotionMaster()->MoveChase(me); + if (!UpdateVictim()) + return; - //DoCast(pTarget, SPELL_SIPHON_SOUL, true); - //me->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, pTarget->GetGUID()); - //me->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SIPHON_SOUL); + if (ResetTimer <= diff) + { + if (me->IsWithinDist3d(119.223, 1035.45, 29.4481, 10)) + { + EnterEvadeMode(); + return; + } + ResetTimer = 5000; + } else ResetTimer -= diff; + + if (CheckAddState_Timer <= diff) + { + for (uint8 i = 0; i < 4; ++i) + if (Creature *pTemp = Unit::GetCreature(*me, AddGUID[i])) + if (pTemp->isAlive() && !pTemp->getVictim()) + pTemp->AI()->AttackStart(me->getVictim()); - PlayerGUID = pTarget->GetGUID(); - PlayerAbility_Timer = urand(8000,10000); - PlayerClass = pTarget->getClass() - 1; + CheckAddState_Timer = 5000; + } else CheckAddState_Timer -= diff; - if (PlayerClass == CLASS_DRUID-1) - PlayerClass = CLASS_DRUID; - else if (PlayerClass == CLASS_PRIEST-1 && pTarget->HasSpell(15473)) - PlayerClass = CLASS_PRIEST; // shadow priest + if (DrainPower_Timer <= diff) + { + DoCast(me, SPELL_DRAIN_POWER, true); + me->MonsterYell(YELL_DRAIN_POWER, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_YELL_DRAIN_POWER); + DrainPower_Timer = urand(40000,55000); // must cast in 60 sec, or buff/debuff will disappear + } else DrainPower_Timer -= diff; - SiphonSoul_Timer = 99999; // buff lasts 30 sec + if (SpiritBolts_Timer <= diff) + { + if (DrainPower_Timer < 12000) // channel 10 sec + SpiritBolts_Timer = 13000; // cast drain power first + else + { + DoCast(me, SPELL_SPIRIT_BOLTS, false); + me->MonsterYell(YELL_SPIRIT_BOLTS, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_YELL_SPIRIT_BOLTS); + SpiritBolts_Timer = 40000; + SiphonSoul_Timer = 10000; // ready to drain + PlayerAbility_Timer = 99999; + } + } else SpiritBolts_Timer -= diff; + + if (SiphonSoul_Timer <= diff) + { + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 70, true); + Unit *trigger = DoSpawnCreature(MOB_TEMP_TRIGGER, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 30000); + if (!pTarget || !trigger) + { + EnterEvadeMode(); + return; + } + else + { + trigger->SetDisplayId(11686); + trigger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + trigger->CastSpell(pTarget, SPELL_SIPHON_SOUL, true); + trigger->GetMotionMaster()->MoveChase(me); + + //DoCast(pTarget, SPELL_SIPHON_SOUL, true); + //me->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, pTarget->GetGUID()); + //me->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SIPHON_SOUL); + + PlayerGUID = pTarget->GetGUID(); + PlayerAbility_Timer = urand(8000,10000); + PlayerClass = pTarget->getClass() - 1; + + if (PlayerClass == CLASS_DRUID-1) + PlayerClass = CLASS_DRUID; + else if (PlayerClass == CLASS_PRIEST-1 && pTarget->HasSpell(15473)) + PlayerClass = CLASS_PRIEST; // shadow priest + + SiphonSoul_Timer = 99999; // buff lasts 30 sec + } + } else SiphonSoul_Timer -= diff; + + if (PlayerAbility_Timer <= diff) + { + //Unit *pTarget = Unit::GetUnit(*me, PlayerGUID); + //if (pTarget && pTarget->isAlive()) + //{ + UseAbility(); + PlayerAbility_Timer = urand(8000,10000); + //} + } else PlayerAbility_Timer -= diff; + + DoMeleeAttackIfReady(); } - } else SiphonSoul_Timer -= diff; - if (PlayerAbility_Timer <= diff) - { - //Unit *pTarget = Unit::GetUnit(*me, PlayerGUID); - //if (pTarget && pTarget->isAlive()) - //{ - UseAbility(); - PlayerAbility_Timer = urand(8000,10000); - //} - } else PlayerAbility_Timer -= diff; - - DoMeleeAttackIfReady(); - } - - void UseAbility() - { - uint8 random = urand(0,2); - Unit *pTarget = NULL; - switch(PlayerAbility[PlayerClass][random].target) - { - case ABILITY_TARGET_SELF: - pTarget = me; - break; - case ABILITY_TARGET_VICTIM: - pTarget = me->getVictim(); - break; - case ABILITY_TARGET_ENEMY: - default: - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - break; - case ABILITY_TARGET_HEAL: - pTarget = DoSelectLowestHpFriendly(50, 0); - break; - case ABILITY_TARGET_BUFF: + void UseAbility() + { + uint8 random = urand(0,2); + Unit *pTarget = NULL; + switch(PlayerAbility[PlayerClass][random].target) { - std::list<Creature*> templist = DoFindFriendlyMissingBuff(50, PlayerAbility[PlayerClass][random].spell); - if (!templist.empty()) - pTarget = *(templist.begin()); + case ABILITY_TARGET_SELF: + pTarget = me; + break; + case ABILITY_TARGET_VICTIM: + pTarget = me->getVictim(); + break; + case ABILITY_TARGET_ENEMY: + default: + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + break; + case ABILITY_TARGET_HEAL: + pTarget = DoSelectLowestHpFriendly(50, 0); + break; + case ABILITY_TARGET_BUFF: + { + std::list<Creature*> templist = DoFindFriendlyMissingBuff(50, PlayerAbility[PlayerClass][random].spell); + if (!templist.empty()) + pTarget = *(templist.begin()); + } + break; } - break; + if (pTarget) + DoCast(pTarget, PlayerAbility[PlayerClass][random].spell, false); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_hexlord_malacrassAI(creature); } - if (pTarget) - DoCast(pTarget, PlayerAbility[PlayerClass][random].spell, false); - } }; #define SPELL_BLOODLUST 43578 #define SPELL_CLEAVE 15496 -struct boss_thurgAI : public boss_hexlord_addAI +class boss_thurg : public CreatureScript { + public: - boss_thurgAI(Creature *c) : boss_hexlord_addAI(c) {} + boss_thurg() + : CreatureScript("boss_thurg") + { + } - uint32 bloodlust_timer; - uint32 cleave_timer; + struct boss_thurgAI : public boss_hexlord_addAI + { - void Reset() - { - bloodlust_timer = 15000; - cleave_timer = 10000; + boss_thurgAI(Creature *c) : boss_hexlord_addAI(c) {} - boss_hexlord_addAI::Reset(); - } + uint32 bloodlust_timer; + uint32 cleave_timer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void Reset() + { + bloodlust_timer = 15000; + cleave_timer = 10000; - if (bloodlust_timer <= diff) - { - std::list<Creature*> templist = DoFindFriendlyMissingBuff(50, SPELL_BLOODLUST); - if (!templist.empty()) + boss_hexlord_addAI::Reset(); + } + + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = *(templist.begin())) - DoCast(pTarget, SPELL_BLOODLUST, false); + if (!UpdateVictim()) + return; + + if (bloodlust_timer <= diff) + { + std::list<Creature*> templist = DoFindFriendlyMissingBuff(50, SPELL_BLOODLUST); + if (!templist.empty()) + { + if (Unit *pTarget = *(templist.begin())) + DoCast(pTarget, SPELL_BLOODLUST, false); + } + bloodlust_timer = 12000; + } else bloodlust_timer -= diff; + + if (cleave_timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE, false); + cleave_timer = 12000; //3 sec cast + } else cleave_timer -= diff; + + boss_hexlord_addAI::UpdateAI(diff); } - bloodlust_timer = 12000; - } else bloodlust_timer -= diff; + }; - if (cleave_timer <= diff) + CreatureAI* GetAI(Creature* creature) const { - DoCast(me->getVictim(), SPELL_CLEAVE, false); - cleave_timer = 12000; //3 sec cast - } else cleave_timer -= diff; - - boss_hexlord_addAI::UpdateAI(diff); - } + return new boss_thurgAI(creature); + } }; #define SPELL_FLASH_HEAL 43575 #define SPELL_DISPEL_MAGIC 43577 -struct boss_alyson_antilleAI : public boss_hexlord_addAI +class boss_alyson_antille : public CreatureScript { - //Holy Priest - boss_alyson_antilleAI(Creature *c) : boss_hexlord_addAI(c) {} + public: - uint32 flashheal_timer; - uint32 dispelmagic_timer; + boss_alyson_antille() + : CreatureScript("boss_alyson_antille") + { + } - void Reset() - { - flashheal_timer = 2500; - dispelmagic_timer = 10000; + struct boss_alyson_antilleAI : public boss_hexlord_addAI + { + //Holy Priest + boss_alyson_antilleAI(Creature *c) : boss_hexlord_addAI(c) {} - //AcquireGUID(); + uint32 flashheal_timer; + uint32 dispelmagic_timer; - boss_hexlord_addAI::Reset(); - } + void Reset() + { + flashheal_timer = 2500; + dispelmagic_timer = 10000; - void AttackStart(Unit* who) - { - if (!who) - return; + //AcquireGUID(); - if (who->isTargetableForAttack()) - { - if (me->Attack(who, false)) - { - me->GetMotionMaster()->MoveChase(who, 20); - me->AddThreat(who, 0.0f); + boss_hexlord_addAI::Reset(); } - } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (flashheal_timer <= diff) - { - Unit *pTarget = DoSelectLowestHpFriendly(99, 30000); - if (pTarget) + void AttackStart(Unit* who) { - if (pTarget->IsWithinDistInMap(me, 50)) - DoCast(pTarget, SPELL_FLASH_HEAL, false); - else + if (!who) + return; + + if (who->isTargetableForAttack()) { - // bugged - //me->GetMotionMaster()->Clear(); - //me->GetMotionMaster()->MoveChase(pTarget, 20); + if (me->Attack(who, false)) + { + me->GetMotionMaster()->MoveChase(who, 20); + me->AddThreat(who, 0.0f); + } } } - else + + void UpdateAI(const uint32 diff) { + if (!UpdateVictim()) + return; + + if (flashheal_timer <= diff) + { + Unit *pTarget = DoSelectLowestHpFriendly(99, 30000); + if (pTarget) + { + if (pTarget->IsWithinDistInMap(me, 50)) + DoCast(pTarget, SPELL_FLASH_HEAL, false); + else + { + // bugged + //me->GetMotionMaster()->Clear(); + //me->GetMotionMaster()->MoveChase(pTarget, 20); + } + } + else + { + if (urand(0,1)) + pTarget = DoSelectLowestHpFriendly(50, 0); + else + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + DoCast(pTarget, SPELL_DISPEL_MAGIC, false); + } + flashheal_timer = 2500; + } else flashheal_timer -= diff; + + /*if (dispelmagic_timer <= diff) + { if (urand(0,1)) - pTarget = DoSelectLowestHpFriendly(50, 0); - else - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) + { + Unit *pTarget = SelectTarget(); + DoCast(pTarget, SPELL_DISPEL_MAGIC, false); + } + else + me->CastSpell(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DISPEL_MAGIC, false); + + dispelmagic_timer = 12000; + } else dispelmagic_timer -= diff;*/ + + boss_hexlord_addAI::UpdateAI(diff); } - flashheal_timer = 2500; - } else flashheal_timer -= diff; + }; - /*if (dispelmagic_timer <= diff) + CreatureAI* GetAI(Creature* creature) const { - if (urand(0,1)) - { - Unit *pTarget = SelectTarget(); - - DoCast(pTarget, SPELL_DISPEL_MAGIC, false); + return new boss_alyson_antilleAI(creature); } - else - me->CastSpell(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DISPEL_MAGIC, false); - - dispelmagic_timer = 12000; - } else dispelmagic_timer -= diff;*/ - - boss_hexlord_addAI::UpdateAI(diff); - } }; #define SPELL_FIREBOLT 43584 @@ -635,275 +680,269 @@ struct boss_gazakrothAI : public boss_hexlord_addAI #define SPELL_FLAME_BREATH 43582 #define SPELL_THUNDERCLAP 43583 -struct boss_lord_raadanAI : public boss_hexlord_addAI +class boss_lord_raadan : public CreatureScript { - boss_lord_raadanAI(Creature *c) : boss_hexlord_addAI(c) {} + public: - uint32 flamebreath_timer; - uint32 thunderclap_timer; + boss_lord_raadan() + : CreatureScript("boss_lord_raadan") + { + } - void Reset() - { - flamebreath_timer = 8000; - thunderclap_timer = 13000; + struct boss_lord_raadanAI : public boss_hexlord_addAI + { + boss_lord_raadanAI(Creature *c) : boss_hexlord_addAI(c) {} - boss_hexlord_addAI::Reset(); + uint32 flamebreath_timer; + uint32 thunderclap_timer; - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void Reset() + { + flamebreath_timer = 8000; + thunderclap_timer = 13000; - if (thunderclap_timer <= diff) - { - DoCast(me->getVictim(), SPELL_THUNDERCLAP, false); - thunderclap_timer = 12000; - } else thunderclap_timer -= diff; + boss_hexlord_addAI::Reset(); - if (flamebreath_timer <= diff) - { - DoCast(me->getVictim(), SPELL_FLAME_BREATH, false); - flamebreath_timer = 12000; - } else flamebreath_timer -= diff; + } + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; - boss_hexlord_addAI::UpdateAI(diff); - } + if (thunderclap_timer <= diff) + { + DoCast(me->getVictim(), SPELL_THUNDERCLAP, false); + thunderclap_timer = 12000; + } else thunderclap_timer -= diff; + + if (flamebreath_timer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAME_BREATH, false); + flamebreath_timer = 12000; + } else flamebreath_timer -= diff; + + boss_hexlord_addAI::UpdateAI(diff); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_lord_raadanAI(creature); + } }; #define SPELL_PSYCHIC_WAIL 43590 -struct boss_darkheartAI : public boss_hexlord_addAI +class boss_darkheart : public CreatureScript { - boss_darkheartAI(Creature *c) : boss_hexlord_addAI(c) {} + public: - uint32 psychicwail_timer; - - void Reset() - { - psychicwail_timer = 8000; - boss_hexlord_addAI::Reset(); - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + boss_darkheart() + : CreatureScript("boss_darkheart") + { + } - if (psychicwail_timer <= diff) + struct boss_darkheartAI : public boss_hexlord_addAI { - DoCast(me->getVictim(), SPELL_PSYCHIC_WAIL, false); - psychicwail_timer = 12000; - } else psychicwail_timer -= diff; + boss_darkheartAI(Creature *c) : boss_hexlord_addAI(c) {} - boss_hexlord_addAI::UpdateAI(diff); - } + uint32 psychicwail_timer; + + void Reset() + { + psychicwail_timer = 8000; + boss_hexlord_addAI::Reset(); + } + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (psychicwail_timer <= diff) + { + DoCast(me->getVictim(), SPELL_PSYCHIC_WAIL, false); + psychicwail_timer = 12000; + } else psychicwail_timer -= diff; + + boss_hexlord_addAI::UpdateAI(diff); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_darkheartAI(creature); + } }; #define SPELL_VENOM_SPIT 43579 -struct boss_slitherAI : public boss_hexlord_addAI +class boss_slither : public CreatureScript { - boss_slitherAI(Creature *c) : boss_hexlord_addAI(c) {} + public: - uint32 venomspit_timer; + boss_slither() + : CreatureScript("boss_slither") + { + } - void Reset() - { - venomspit_timer = 5000; - boss_hexlord_addAI::Reset(); - } + struct boss_slitherAI : public boss_hexlord_addAI + { + boss_slitherAI(Creature *c) : boss_hexlord_addAI(c) {} - void AttackStart(Unit* who) - { - if (!who) - return; + uint32 venomspit_timer; - if (who->isTargetableForAttack()) - { - if (me->Attack(who, false)) + void Reset() { - me->GetMotionMaster()->MoveChase(who, 20); - me->AddThreat(who, 0.0f); + venomspit_timer = 5000; + boss_hexlord_addAI::Reset(); } - } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void AttackStart(Unit* who) + { + if (!who) + return; - if (venomspit_timer <= diff) - { - if (Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(victim, SPELL_VENOM_SPIT, false); - venomspit_timer = 2500; - } else venomspit_timer -= diff; + if (who->isTargetableForAttack()) + { + if (me->Attack(who, false)) + { + me->GetMotionMaster()->MoveChase(who, 20); + me->AddThreat(who, 0.0f); + } + } + } - boss_hexlord_addAI::UpdateAI(diff); - } + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (venomspit_timer <= diff) + { + if (Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(victim, SPELL_VENOM_SPIT, false); + venomspit_timer = 2500; + } else venomspit_timer -= diff; + + boss_hexlord_addAI::UpdateAI(diff); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_slitherAI(creature); + } }; //Fenstalker #define SPELL_VOLATILE_INFECTION 43586 - -struct boss_fenstalkerAI : public boss_hexlord_addAI +class boss_fenstalker : public CreatureScript { - boss_fenstalkerAI(Creature *c) : boss_hexlord_addAI(c) {} + public: - uint32 volatileinf_timer; + boss_fenstalker() + : CreatureScript("boss_fenstalker") + { + } - void Reset() - { - volatileinf_timer = 15000; - boss_hexlord_addAI::Reset(); + struct boss_fenstalkerAI : public boss_hexlord_addAI + { + boss_fenstalkerAI(Creature *c) : boss_hexlord_addAI(c) {} - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 volatileinf_timer; - if (volatileinf_timer <= diff) - { - // core bug - me->getVictim()->CastSpell(me->getVictim(),SPELL_VOLATILE_INFECTION, false); - volatileinf_timer = 12000; - } else volatileinf_timer -= diff; + void Reset() + { + volatileinf_timer = 15000; + boss_hexlord_addAI::Reset(); - boss_hexlord_addAI::UpdateAI(diff); - } + } + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (volatileinf_timer <= diff) + { + // core bug + me->getVictim()->CastSpell(me->getVictim(),SPELL_VOLATILE_INFECTION, false); + volatileinf_timer = 12000; + } else volatileinf_timer -= diff; + + boss_hexlord_addAI::UpdateAI(diff); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_fenstalkerAI(creature); + } }; //Koragg #define SPELL_COLD_STARE 43593 #define SPELL_MIGHTY_BLOW 43592 -struct boss_koraggAI : public boss_hexlord_addAI +class boss_koragg : public CreatureScript { - boss_koraggAI(Creature *c) : boss_hexlord_addAI(c) {} - - uint32 coldstare_timer; - uint32 mightyblow_timer; - - void Reset() - { - coldstare_timer = 15000; - mightyblow_timer = 10000; - boss_hexlord_addAI::Reset(); - - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + public: - if (mightyblow_timer <= diff) + boss_koragg() + : CreatureScript("boss_koragg") { - DoCast(me->getVictim(), SPELL_MIGHTY_BLOW, false); - mightyblow_timer = 12000; } - if (coldstare_timer <= diff) - { - if (Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(victim, SPELL_COLD_STARE, false); - coldstare_timer = 12000; - } - - boss_hexlord_addAI::UpdateAI(diff); - } -}; - -CreatureAI* GetAI_boss_hex_lord_malacrass(Creature* pCreature) -{ - return new boss_hex_lord_malacrassAI (pCreature); -} -CreatureAI* GetAI_boss_thurg(Creature* pCreature) -{ - return new boss_thurgAI (pCreature); -} + struct boss_koraggAI : public boss_hexlord_addAI + { + boss_koraggAI(Creature *c) : boss_hexlord_addAI(c) {} -CreatureAI* GetAI_boss_alyson_antille(Creature* pCreature) -{ - return new boss_alyson_antilleAI (pCreature); -} + uint32 coldstare_timer; + uint32 mightyblow_timer; -CreatureAI* GetAI_boss_gazakroth(Creature* pCreature) -{ - return new boss_gazakrothAI (pCreature); -} + void Reset() + { + coldstare_timer = 15000; + mightyblow_timer = 10000; + boss_hexlord_addAI::Reset(); -CreatureAI* GetAI_boss_lord_raadan(Creature* pCreature) -{ - return new boss_lord_raadanAI (pCreature); -} + } + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; -CreatureAI* GetAI_boss_darkheart(Creature* pCreature) -{ - return new boss_darkheartAI (pCreature); -} + if (mightyblow_timer <= diff) + { + DoCast(me->getVictim(), SPELL_MIGHTY_BLOW, false); + mightyblow_timer = 12000; + } + if (coldstare_timer <= diff) + { + if (Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(victim, SPELL_COLD_STARE, false); + coldstare_timer = 12000; + } -CreatureAI* GetAI_boss_slither(Creature* pCreature) -{ - return new boss_slitherAI (pCreature); -} + boss_hexlord_addAI::UpdateAI(diff); + } + }; -CreatureAI* GetAI_boss_fenstalker(Creature* pCreature) -{ - return new boss_fenstalkerAI (pCreature); -} + CreatureAI* GetAI(Creature* creature) const + { + return new boss_koraggAI(creature); + } +}; -CreatureAI* GetAI_boss_koragg(Creature* pCreature) -{ - return new boss_koraggAI (pCreature); -} void AddSC_boss_hex_lord_malacrass() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_hexlord_malacrass"; - newscript->GetAI = &GetAI_boss_hex_lord_malacrass; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_thurg"; - newscript->GetAI = &GetAI_boss_thurg; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_gazakroth"; - newscript->GetAI = &GetAI_boss_gazakroth; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_lord_raadan"; - newscript->GetAI = &GetAI_boss_lord_raadan; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_darkheart"; - newscript->GetAI = &GetAI_boss_darkheart; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_slither"; - newscript->GetAI = &GetAI_boss_slither; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_fenstalker"; - newscript->GetAI = &GetAI_boss_fenstalker; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_koragg"; - newscript->GetAI = &GetAI_boss_koragg; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_alyson_antille"; - newscript->GetAI = &GetAI_boss_alyson_antille; - newscript->RegisterSelf(); + new boss_hexlord_malacrass(); + new boss_thurg(); + new boss_gazakroth(); + new boss_lord_raadan(); + new boss_darkheart(); + new boss_slither(); + new boss_fenstalker(); + new boss_koragg(); + new boss_alyson_antille(); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index 180fafe2a32..a7e020c2e66 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -101,538 +101,595 @@ float hatcherway[2][5][3] = {-34.29,1095.22,19} } }; - -struct boss_janalaiAI : public ScriptedAI +class boss_janalai : public CreatureScript { - boss_janalaiAI(Creature *c) : ScriptedAI(c) - { - pInstance =c->GetInstanceData(); + public: - SpellEntry *TempSpell = GET_SPELL(SPELL_HATCH_EGG); - if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1) + boss_janalai() + : CreatureScript("boss_janalai") { - TempSpell->EffectImplicitTargetA[0] = 1; - TempSpell->EffectImplicitTargetB[0] = 0; } - } - ScriptedInstance *pInstance; + struct boss_janalaiAI : public ScriptedAI + { + boss_janalaiAI(Creature *c) : ScriptedAI(c) + { + pInstance =c->GetInstanceData(); - uint32 FireBreathTimer; - uint32 BombTimer; - uint32 BombSequenceTimer; - uint32 BombCount; - uint32 HatcherTimer; - uint32 EnrageTimer; + SpellEntry *TempSpell = GET_SPELL(SPELL_HATCH_EGG); + if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1) + { + TempSpell->EffectImplicitTargetA[0] = 1; + TempSpell->EffectImplicitTargetB[0] = 0; + } + } - bool noeggs; - bool enraged; - bool isBombing; + ScriptedInstance *pInstance; - bool isFlameBreathing; + uint32 FireBreathTimer; + uint32 BombTimer; + uint32 BombSequenceTimer; + uint32 BombCount; + uint32 HatcherTimer; + uint32 EnrageTimer; - uint64 FireBombGUIDs[40]; + bool noeggs; + bool enraged; + bool isBombing; - void Reset() - { - if (pInstance) - pInstance->SetData(DATA_JANALAIEVENT, NOT_STARTED); + bool isFlameBreathing; - FireBreathTimer = 8000; - BombTimer = 30000; - BombSequenceTimer = 1000; - BombCount = 0; - HatcherTimer = 10000; - EnrageTimer = MINUTE*5*IN_MILLISECONDS; + uint64 FireBombGUIDs[40]; - noeggs = false; - isBombing =false; - enraged = false; + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_JANALAIEVENT, NOT_STARTED); - isFlameBreathing = false; + FireBreathTimer = 8000; + BombTimer = 30000; + BombSequenceTimer = 1000; + BombCount = 0; + HatcherTimer = 10000; + EnrageTimer = MINUTE*5*IN_MILLISECONDS; - for (uint8 i = 0; i < 40; ++i) - FireBombGUIDs[i] = 0; + noeggs = false; + isBombing =false; + enraged = false; - HatchAllEggs(1); - } + isFlameBreathing = false; - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); + for (uint8 i = 0; i < 40; ++i) + FireBombGUIDs[i] = 0; - if (pInstance) - pInstance->SetData(DATA_JANALAIEVENT, DONE); - } + HatchAllEggs(1); + } - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + void JustDied(Unit* /*Killer*/) + { + DoScriptText(SAY_DEATH, me); - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_JANALAIEVENT, IN_PROGRESS); + if (pInstance) + pInstance->SetData(DATA_JANALAIEVENT, DONE); + } - DoScriptText(SAY_AGGRO, me); -// DoZoneInCombat(); - } + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } - void DamageDealt(Unit *pTarget, uint32 &damage) - { - if (isFlameBreathing) - { - if (!me->HasInArc(M_PI/6, pTarget)) - damage = 0; - } - } + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_JANALAIEVENT, IN_PROGRESS); - void FireWall() - { - uint8 WallNum; - Creature* wall = NULL; - for (uint8 i = 0; i < 4; ++i) - { - if (i == 0 || i == 2) - WallNum = 3; - else - WallNum = 2; + DoScriptText(SAY_AGGRO, me); + // DoZoneInCombat(); + } - for (uint8 j = 0; j < WallNum; j++) + void DamageDealt(Unit *pTarget, uint32 &damage) { - if (WallNum == 3) - wall = me->SummonCreature(MOB_FIRE_BOMB, FireWallCoords[i][0],FireWallCoords[i][1]+5*(j-1),FireWallCoords[i][2],FireWallCoords[i][3],TEMPSUMMON_TIMED_DESPAWN,15000); - else - wall = me->SummonCreature(MOB_FIRE_BOMB, FireWallCoords[i][0]-2+4*j,FireWallCoords[i][1],FireWallCoords[i][2],FireWallCoords[i][3],TEMPSUMMON_TIMED_DESPAWN,15000); - if (wall) wall->CastSpell(wall, SPELL_FIRE_WALL, true); + if (isFlameBreathing) + { + if (!me->HasInArc(M_PI/6, pTarget)) + damage = 0; + } } - } - } - void SpawnBombs() - { - float dx, dy; - for (int i(0); i < 40; ++i) - { - dx = irand(-area_dx/2, area_dx/2); - dy = irand(-area_dy/2, area_dy/2); + void FireWall() + { + uint8 WallNum; + Creature* wall = NULL; + for (uint8 i = 0; i < 4; ++i) + { + if (i == 0 || i == 2) + WallNum = 3; + else + WallNum = 2; + + for (uint8 j = 0; j < WallNum; j++) + { + if (WallNum == 3) + wall = me->SummonCreature(MOB_FIRE_BOMB, FireWallCoords[i][0],FireWallCoords[i][1]+5*(j-1),FireWallCoords[i][2],FireWallCoords[i][3],TEMPSUMMON_TIMED_DESPAWN,15000); + else + wall = me->SummonCreature(MOB_FIRE_BOMB, FireWallCoords[i][0]-2+4*j,FireWallCoords[i][1],FireWallCoords[i][2],FireWallCoords[i][3],TEMPSUMMON_TIMED_DESPAWN,15000); + if (wall) wall->CastSpell(wall, SPELL_FIRE_WALL, true); + } + } + } - Creature* bomb = DoSpawnCreature(MOB_FIRE_BOMB, dx, dy, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 15000); - if (bomb) FireBombGUIDs[i] = bomb->GetGUID(); - } - BombCount = 0; - } + void SpawnBombs() + { + float dx, dy; + for (int i(0); i < 40; ++i) + { + dx = irand(-area_dx/2, area_dx/2); + dy = irand(-area_dy/2, area_dy/2); - bool HatchAllEggs(uint32 uiAction) //1: reset, 2: isHatching all - { - std::list<Creature*> templist; - float x, y, z; - me->GetPosition(x, y, z); + Creature* bomb = DoSpawnCreature(MOB_FIRE_BOMB, dx, dy, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 15000); + if (bomb) FireBombGUIDs[i] = bomb->GetGUID(); + } + BombCount = 0; + } - { - CellPair pair(Trinity::ComputeCellPair(x, y)); - Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); + bool HatchAllEggs(uint32 uiAction) //1: reset, 2: isHatching all + { + std::list<Creature*> templist; + float x, y, z; + me->GetPosition(x, y, z); - Trinity::AllCreaturesOfEntryInRange check(me, MOB_EGG, 100); - Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, templist, check); + { + CellPair pair(Trinity::ComputeCellPair(x, y)); + Cell cell(pair); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); - TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher); + Trinity::AllCreaturesOfEntryInRange check(me, MOB_EGG, 100); + Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, templist, check); - cell.Visit(pair, cSearcher, *(me->GetMap())); - } + TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher); - //sLog.outError("Eggs %d at middle", templist.size()); - if (!templist.size()) - return false; + cell.Visit(pair, cSearcher, *(me->GetMap())); + } - for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i) - { - if (uiAction == 1) - (*i)->SetDisplayId(10056); - else if (uiAction == 2 &&(*i)->GetDisplayId() != 11686) - (*i)->CastSpell(*i, SPELL_HATCH_EGG, false); - } - return true; - } + //sLog.outError("Eggs %d at middle", templist.size()); + if (!templist.size()) + return false; - void Boom() - { - std::list<Creature*> templist; - float x, y, z; - me->GetPosition(x, y, z); + for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i) + { + if (uiAction == 1) + (*i)->SetDisplayId(10056); + else if (uiAction == 2 &&(*i)->GetDisplayId() != 11686) + (*i)->CastSpell(*i, SPELL_HATCH_EGG, false); + } + return true; + } - { - CellPair pair(Trinity::ComputeCellPair(x, y)); - Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); + void Boom() + { + std::list<Creature*> templist; + float x, y, z; + me->GetPosition(x, y, z); - Trinity::AllCreaturesOfEntryInRange check(me, MOB_FIRE_BOMB, 100); - Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, templist, check); + { + CellPair pair(Trinity::ComputeCellPair(x, y)); + Cell cell(pair); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); - TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher); + Trinity::AllCreaturesOfEntryInRange check(me, MOB_FIRE_BOMB, 100); + Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, templist, check); - cell.Visit(pair, cSearcher, *(me->GetMap())); - } - for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i) - { - (*i)->CastSpell(*i, SPELL_FIRE_BOMB_DAMAGE, true); - (*i)->RemoveAllAuras(); - } - } + TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher); - void HandleBombSequence() - { - if (BombCount < 40) - { - if (Unit *FireBomb = Unit::GetUnit((*me), FireBombGUIDs[BombCount])) + cell.Visit(pair, cSearcher, *(me->GetMap())); + } + for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i) + { + (*i)->CastSpell(*i, SPELL_FIRE_BOMB_DAMAGE, true); + (*i)->RemoveAllAuras(); + } + } + + void HandleBombSequence() { - FireBomb->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoCast(FireBomb, SPELL_FIRE_BOMB_THROW, true); - FireBomb->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (BombCount < 40) + { + if (Unit *FireBomb = Unit::GetUnit((*me), FireBombGUIDs[BombCount])) + { + FireBomb->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoCast(FireBomb, SPELL_FIRE_BOMB_THROW, true); + FireBomb->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + ++BombCount; + if (BombCount == 40) + { + BombSequenceTimer = 5000; + } else BombSequenceTimer = 100; + } + else + { + Boom(); + isBombing = false; + BombTimer = urand(20000,40000); + me->RemoveAurasDueToSpell(SPELL_FIRE_BOMB_CHANNEL); + if (EnrageTimer <= 10000) + EnrageTimer = 0; + else + EnrageTimer -= 10000; + } } - ++BombCount; - if (BombCount == 40) + + void UpdateAI(const uint32 diff) { - BombSequenceTimer = 5000; - } else BombSequenceTimer = 100; - } - else - { - Boom(); - isBombing = false; - BombTimer = urand(20000,40000); - me->RemoveAurasDueToSpell(SPELL_FIRE_BOMB_CHANNEL); - if (EnrageTimer <= 10000) - EnrageTimer = 0; - else - EnrageTimer -= 10000; - } - } + if (isFlameBreathing) + { + if (!me->IsNonMeleeSpellCasted(false)) + isFlameBreathing = false; + else + return; + } - void UpdateAI(const uint32 diff) - { - if (isFlameBreathing) - { - if (!me->IsNonMeleeSpellCasted(false)) - isFlameBreathing = false; - else - return; - } + if (isBombing) + { + if (BombSequenceTimer <= diff) + HandleBombSequence(); + else + BombSequenceTimer -= diff; + return; + } - if (isBombing) - { - if (BombSequenceTimer <= diff) - HandleBombSequence(); - else - BombSequenceTimer -= diff; - return; - } + if (!UpdateVictim()) + return; + + //enrage if under 25% hp before 5 min. + if (!enraged && me->GetHealth() * 4 < me->GetMaxHealth()) + EnrageTimer = 0; + + if (EnrageTimer <= diff) + { + if (!enraged) + { + DoCast(me, SPELL_ENRAGE, true); + enraged = true; + EnrageTimer = 300000; + } + else + { + DoScriptText(SAY_BERSERK, me); + DoCast(me, SPELL_BERSERK, true); + EnrageTimer = 300000; + } + } else EnrageTimer -= diff; + + if (BombTimer <= diff) + { + DoScriptText(SAY_FIRE_BOMBS, me); + + me->AttackStop(); + me->GetMotionMaster()->Clear(); + DoTeleportTo(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2]); + me->StopMoving(); + DoCast(me, SPELL_FIRE_BOMB_CHANNEL, false); + //DoTeleportPlayer(me, JanalainPos[0][0], JanalainPos[0][1],JanalainPos[0][2], 0); + //DoCast(me, SPELL_TELE_TO_CENTER, true); + + FireWall(); + SpawnBombs(); + isBombing = true; + BombSequenceTimer = 100; + + //Teleport every Player into the middle + Map* pMap = me->GetMap(); + if (!pMap->IsDungeon()) return; + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Player* i_pl = i->getSource()) + if (i_pl->isAlive()) + DoTeleportPlayer(i_pl, JanalainPos[0][0]-5+rand()%10, JanalainPos[0][1]-5+rand()%10, JanalainPos[0][2], 0); + //DoCast(Temp, SPELL_SUMMON_PLAYERS, true) // core bug, spell does not work if too far + return; + } else BombTimer -= diff; + + if (!noeggs) + { + if (100 * me->GetHealth() < 35 * me->GetMaxHealth()) + { + DoScriptText(SAY_ALL_EGGS, me); + + me->AttackStop(); + me->GetMotionMaster()->Clear(); + DoTeleportTo(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2]); + me->StopMoving(); + DoCast(me, SPELL_HATCH_ALL, false); + HatchAllEggs(2); + noeggs = true; + } + else if (HatcherTimer <= diff) + { + if (HatchAllEggs(0)) + { + DoScriptText(SAY_SUMMON_HATCHER, me); + me->SummonCreature(MOB_AMANI_HATCHER,hatcherway[0][0][0],hatcherway[0][0][1],hatcherway[0][0][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000); + me->SummonCreature(MOB_AMANI_HATCHER,hatcherway[1][0][0],hatcherway[1][0][1],hatcherway[1][0][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000); + HatcherTimer = 90000; + } + else + noeggs = true; + } else HatcherTimer -= diff; + } - if (!UpdateVictim()) - return; + EnterEvadeIfOutOfCombatArea(diff); - //enrage if under 25% hp before 5 min. - if (!enraged && me->GetHealth() * 4 < me->GetMaxHealth()) - EnrageTimer = 0; + DoMeleeAttackIfReady(); - if (EnrageTimer <= diff) - { - if (!enraged) - { - DoCast(me, SPELL_ENRAGE, true); - enraged = true; - EnrageTimer = 300000; - } - else - { - DoScriptText(SAY_BERSERK, me); - DoCast(me, SPELL_BERSERK, true); - EnrageTimer = 300000; + if (FireBreathTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + me->AttackStop(); + me->GetMotionMaster()->Clear(); + DoCast(pTarget, SPELL_FLAME_BREATH, false); + me->StopMoving(); + isFlameBreathing = true; + } + FireBreathTimer = 8000; + } else FireBreathTimer -= diff; } - } else EnrageTimer -= diff; + }; - if (BombTimer <= diff) - { - DoScriptText(SAY_FIRE_BOMBS, me); - - me->AttackStop(); - me->GetMotionMaster()->Clear(); - DoTeleportTo(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2]); - me->StopMoving(); - DoCast(me, SPELL_FIRE_BOMB_CHANNEL, false); - //DoTeleportPlayer(me, JanalainPos[0][0], JanalainPos[0][1],JanalainPos[0][2], 0); - //DoCast(me, SPELL_TELE_TO_CENTER, true); - - FireWall(); - SpawnBombs(); - isBombing = true; - BombSequenceTimer = 100; - - //Teleport every Player into the middle - Map* pMap = me->GetMap(); - if (!pMap->IsDungeon()) return; - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player* i_pl = i->getSource()) - if (i_pl->isAlive()) - DoTeleportPlayer(i_pl, JanalainPos[0][0]-5+rand()%10, JanalainPos[0][1]-5+rand()%10, JanalainPos[0][2], 0); - //DoCast(Temp, SPELL_SUMMON_PLAYERS, true) // core bug, spell does not work if too far - return; - } else BombTimer -= diff; - - if (!noeggs) + + CreatureAI* GetAI(Creature* creature) const { - if (100 * me->GetHealth() < 35 * me->GetMaxHealth()) - { - DoScriptText(SAY_ALL_EGGS, me); - - me->AttackStop(); - me->GetMotionMaster()->Clear(); - DoTeleportTo(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2]); - me->StopMoving(); - DoCast(me, SPELL_HATCH_ALL, false); - HatchAllEggs(2); - noeggs = true; - } - else if (HatcherTimer <= diff) - { - if (HatchAllEggs(0)) - { - DoScriptText(SAY_SUMMON_HATCHER, me); - me->SummonCreature(MOB_AMANI_HATCHER,hatcherway[0][0][0],hatcherway[0][0][1],hatcherway[0][0][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000); - me->SummonCreature(MOB_AMANI_HATCHER,hatcherway[1][0][0],hatcherway[1][0][1],hatcherway[1][0][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000); - HatcherTimer = 90000; - } - else - noeggs = true; - } else HatcherTimer -= diff; + return new boss_janalaiAI(creature); } +}; - EnterEvadeIfOutOfCombatArea(diff); +class mob_janalai_firebomb : public CreatureScript +{ + public: - DoMeleeAttackIfReady(); + mob_janalai_firebomb() + : CreatureScript("mob_janalai_firebomb") + { + } - if (FireBreathTimer <= diff) + struct mob_janalai_firebombAI : public ScriptedAI { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + mob_janalai_firebombAI(Creature *c) : ScriptedAI(c){} + + void Reset() {} + + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) { - me->AttackStop(); - me->GetMotionMaster()->Clear(); - DoCast(pTarget, SPELL_FLAME_BREATH, false); - me->StopMoving(); - isFlameBreathing = true; + if (spell->Id == SPELL_FIRE_BOMB_THROW) + DoCast(me, SPELL_FIRE_BOMB_DUMMY, true); } - FireBreathTimer = 8000; - } else FireBreathTimer -= diff; - } -}; -CreatureAI* GetAI_boss_janalaiAI(Creature* pCreature) -{ - return new boss_janalaiAI(pCreature); -} + void EnterCombat(Unit* /*who*/) {} -struct mob_janalai_firebombAI : public ScriptedAI -{ - mob_janalai_firebombAI(Creature *c) : ScriptedAI(c){} + void AttackStart(Unit* /*who*/) {} - void Reset() {} + void MoveInLineOfSight(Unit* /*who*/) {} - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) - { - if (spell->Id == SPELL_FIRE_BOMB_THROW) - DoCast(me, SPELL_FIRE_BOMB_DUMMY, true); - } + void UpdateAI(const uint32 /*diff*/) {} + }; - void EnterCombat(Unit* /*who*/) {} + CreatureAI* GetAI(Creature* creature) const + { + return new mob_janalai_firebombAI(creature); + } +}; - void AttackStart(Unit* /*who*/) {} +class mob_janalai_hatcher : public CreatureScript +{ + public: - void MoveInLineOfSight(Unit* /*who*/) {} + mob_janalai_hatcher() + : CreatureScript("mob_janalai_hatcher") + { + } - void UpdateAI(const uint32 /*diff*/) {} -}; + struct mob_janalai_hatcherAI : public ScriptedAI + { + mob_amanishi_hatcherAI(Creature *c) : ScriptedAI(c) + { + pInstance =c->GetInstanceData(); + } -CreatureAI* GetAI_mob_janalai_firebombAI(Creature* pCreature) -{ - return new mob_janalai_firebombAI(pCreature); -} + ScriptedInstance *pInstance; -struct mob_amanishi_hatcherAI : public ScriptedAI -{ - mob_amanishi_hatcherAI(Creature *c) : ScriptedAI(c) - { - pInstance =c->GetInstanceData(); - } + uint32 waypoint; + uint32 HatchNum; + uint32 WaitTimer; - ScriptedInstance *pInstance; + bool side; + bool hasChangedSide; + bool isHatching; - uint32 waypoint; - uint32 HatchNum; - uint32 WaitTimer; + void Reset() + { + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + side =(me->GetPositionY() < 1150); + waypoint = 0; + isHatching = false; + hasChangedSide = false; + WaitTimer = 1; + HatchNum = 0; + } - bool side; - bool hasChangedSide; - bool isHatching; + bool HatchEggs(uint32 num) + { + std::list<Creature*> templist; + float x, y, z; + me->GetPosition(x, y, z); - void Reset() - { - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - side =(me->GetPositionY() < 1150); - waypoint = 0; - isHatching = false; - hasChangedSide = false; - WaitTimer = 1; - HatchNum = 0; - } + { + CellPair pair(Trinity::ComputeCellPair(x, y)); + Cell cell(pair); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); - bool HatchEggs(uint32 num) - { - std::list<Creature*> templist; - float x, y, z; - me->GetPosition(x, y, z); + Trinity::AllCreaturesOfEntryInRange check(me, 23817, 50); + Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, templist, check); - { - CellPair pair(Trinity::ComputeCellPair(x, y)); - Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); + TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher); - Trinity::AllCreaturesOfEntryInRange check(me, 23817, 50); - Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, templist, check); + cell.Visit(pair, cSearcher, *(me->GetMap())); + } - TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher); + //sLog.outError("Eggs %d at %d", templist.size(), side); - cell.Visit(pair, cSearcher, *(me->GetMap())); - } + for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end() && num > 0; ++i) + if ((*i)->GetDisplayId() != 11686) + { + (*i)->CastSpell(*i, SPELL_HATCH_EGG, false); + num--; + } - //sLog.outError("Eggs %d at %d", templist.size(), side); + return num == 0; // if num == 0, no more templist + } - for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end() && num > 0; ++i) - if ((*i)->GetDisplayId() != 11686) + void EnterCombat(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void MovementInform(uint32, uint32) { - (*i)->CastSpell(*i, SPELL_HATCH_EGG, false); - num--; + if (waypoint == 5) + { + isHatching = true; + HatchNum = 1; + WaitTimer = 5000; + } + else + WaitTimer = 1; } - return num == 0; // if num == 0, no more templist - } + void UpdateAI(const uint32 diff) + { + if (!pInstance || !(pInstance->GetData(DATA_JANALAIEVENT) == IN_PROGRESS)) + { + me->DisappearAndDie(); + return; + } - void EnterCombat(Unit* /*who*/) {} - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void MovementInform(uint32, uint32) - { - if (waypoint == 5) + if (!isHatching) + { + if (WaitTimer) + { + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(0,hatcherway[side][waypoint][0],hatcherway[side][waypoint][1],hatcherway[side][waypoint][2]); + ++waypoint; + WaitTimer = 0; + } + } + else + { + if (WaitTimer <= diff) + { + if (HatchEggs(HatchNum)) + { + ++HatchNum; + WaitTimer = 10000; + } + else if (!hasChangedSide) + { + side = side ? 0 : 1; + isHatching = false; + waypoint = 3; + WaitTimer = 1; + hasChangedSide = true; + } + else + me->DisappearAndDie(); + + } else WaitTimer -= diff; + } + } + }; + + CreatureAI* GetAI(Creature* creature) const { - isHatching = true; - HatchNum = 1; - WaitTimer = 5000; + return new mob_janalai_hatcherAI(creature); } - else - WaitTimer = 1; - } +}; - void UpdateAI(const uint32 diff) - { - if (!pInstance || !(pInstance->GetData(DATA_JANALAIEVENT) == IN_PROGRESS)) +class mob_janalai_hatchling : public CreatureScript +{ + public: + + mob_janalai_hatchling() + : CreatureScript("mob_janalai_hatchling") { - me->DisappearAndDie(); - return; } - if (!isHatching) + struct mob_janalai_hatchlingAI : public ScriptedAI { - if (WaitTimer) + mob_janalai_hatchlingAI(Creature *c) : ScriptedAI(c) { - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(0,hatcherway[side][waypoint][0],hatcherway[side][waypoint][1],hatcherway[side][waypoint][2]); - ++waypoint; - WaitTimer = 0; + pInstance =c->GetInstanceData(); } - } - else - { - if (WaitTimer <= diff) + + ScriptedInstance *pInstance; + uint32 BuffetTimer; + + void Reset() { - if (HatchEggs(HatchNum)) - { - ++HatchNum; - WaitTimer = 10000; - } - else if (!hasChangedSide) - { - side = side ? 0 : 1; - isHatching = false; - waypoint = 3; - WaitTimer = 1; - hasChangedSide = true; - } + BuffetTimer = 7000; + if (me->GetPositionY() > 1150) + me->GetMotionMaster()->MovePoint(0, hatcherway[0][3][0]+rand()%4-2,1150+rand()%4-2,hatcherway[0][3][2]); else - me->DisappearAndDie(); - - } else WaitTimer -= diff; - } - } -}; + me->GetMotionMaster()->MovePoint(0,hatcherway[1][3][0]+rand()%4-2,1150+rand()%4-2,hatcherway[1][3][2]); -CreatureAI* GetAI_mob_amanishi_hatcherAI(Creature* pCreature) -{ - return new mob_amanishi_hatcherAI(pCreature); -} + me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + } -struct mob_hatchlingAI : public ScriptedAI -{ - mob_hatchlingAI(Creature *c) : ScriptedAI(c) - { - pInstance =c->GetInstanceData(); - } + void EnterCombat(Unit * /*who*/) {/*DoZoneInCombat();*/} - ScriptedInstance *pInstance; - uint32 BuffetTimer; + void UpdateAI(const uint32 diff) + { + if (!pInstance || !(pInstance->GetData(DATA_JANALAIEVENT) == IN_PROGRESS)) + { + me->DisappearAndDie(); + return; + } - void Reset() - { - BuffetTimer = 7000; - if (me->GetPositionY() > 1150) - me->GetMotionMaster()->MovePoint(0, hatcherway[0][3][0]+rand()%4-2,1150+rand()%4-2,hatcherway[0][3][2]); - else - me->GetMotionMaster()->MovePoint(0,hatcherway[1][3][0]+rand()%4-2,1150+rand()%4-2,hatcherway[1][3][2]); + if (!UpdateVictim()) + return; - me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); - } + if (BuffetTimer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAMEBUFFET, false); + BuffetTimer = 10000; + } else BuffetTimer -= diff; - void EnterCombat(Unit * /*who*/) {/*DoZoneInCombat();*/} + DoMeleeAttackIfReady(); + } + }; - void UpdateAI(const uint32 diff) - { - if (!pInstance || !(pInstance->GetData(DATA_JANALAIEVENT) == IN_PROGRESS)) + CreatureAI* GetAI(Creature* creature) const { - me->DisappearAndDie(); - return; + return new mob_janalai_hatchlingAI(creature); } +}; - if (!UpdateVictim()) - return; +class mob_janalai_egg : public CreatureScript +{ + public: - if (BuffetTimer <= diff) + mob_janalai_egg() + : CreatureScript("mob_janalai_egg") { - DoCast(me->getVictim(), SPELL_FLAMEBUFFET, false); - BuffetTimer = 10000; - } else BuffetTimer -= diff; + } - DoMeleeAttackIfReady(); - } -}; + -CreatureAI* GetAI_mob_hatchlingAI(Creature* pCreature) -{ - return new mob_hatchlingAI(pCreature); -} + CreatureAI* GetAI(Creature* creature) const + { + return new mob_janalai_eggAI(creature); + } +}; struct mob_eggAI : public ScriptedAI { @@ -653,37 +710,12 @@ struct mob_eggAI : public ScriptedAI } }; -CreatureAI* GetAI_mob_eggAI(Creature* pCreature) -{ - return new mob_eggAI(pCreature); -} - void AddSC_boss_janalai() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_janalai"; - newscript->GetAI = &GetAI_boss_janalaiAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_janalai_firebomb"; - newscript->GetAI = &GetAI_mob_janalai_firebombAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_janalai_hatcher"; - newscript->GetAI = &GetAI_mob_amanishi_hatcherAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_janalai_hatchling"; - newscript->GetAI = &GetAI_mob_hatchlingAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_janalai_egg"; - newscript->GetAI = &GetAI_mob_eggAI; - newscript->RegisterSelf(); + new boss_janalai(); + new mob_janalai_firebomb(); + new mob_janalai_hatcher(); + new mob_janalai_hatchling(); + new mob_janalai_egg(); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index aa42948f6ed..d1e8912f18e 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -90,364 +90,371 @@ float NalorakkWay[8][3] = #define YELL_SHIFTEDTOBEAR "You call on da beast, you gonna get more dan you bargain for!" #define SOUND_YELL_TOBEAR 12072 -struct boss_nalorakkAI : public ScriptedAI +class boss_nalorakk : public CreatureScript { - boss_nalorakkAI(Creature *c) : ScriptedAI(c) - { - MoveEvent = true; - MovePhase = 0; - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; - - uint32 BrutalSwipe_Timer; - uint32 Mangle_Timer; - uint32 Surge_Timer; - - uint32 LaceratingSlash_Timer; - uint32 RendFlesh_Timer; - uint32 DeafeningRoar_Timer; - - uint32 ShapeShift_Timer; - uint32 Berserk_Timer; - - bool inBearForm; - bool MoveEvent; - bool inMove; - uint32 MovePhase; - uint32 waitTimer; - - void Reset() - { - if (MoveEvent) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - inMove = false; - waitTimer = 0; - me->SetSpeed(MOVE_RUN,2); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - }else + public: + + boss_nalorakk() + : CreatureScript("boss_nalorakk") { - (*me).GetMotionMaster()->MovePoint(0,NalorakkWay[7][0],NalorakkWay[7][1],NalorakkWay[7][2]); } - if (pInstance) - pInstance->SetData(DATA_NALORAKKEVENT, NOT_STARTED); + struct boss_nalorakkAI : public ScriptedAI + { + boss_nalorakkAI(Creature *c) : ScriptedAI(c) + { + MoveEvent = true; + MovePhase = 0; + pInstance = c->GetInstanceData(); + } - Surge_Timer = 15000 + rand()%5000; - BrutalSwipe_Timer = 7000 + rand()%5000; - Mangle_Timer = 10000 + rand()%5000; - ShapeShift_Timer = 45000 + rand()%5000; - Berserk_Timer = 600000; + ScriptedInstance *pInstance; - inBearForm = false; - // me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 5122); // TODO: find the correct equipment id - } + uint32 BrutalSwipe_Timer; + uint32 Mangle_Timer; + uint32 Surge_Timer; - void SendAttacker(Unit *pTarget) - { - std::list<Creature*> templist; - float x, y, z; - me->GetPosition(x, y, z); + uint32 LaceratingSlash_Timer; + uint32 RendFlesh_Timer; + uint32 DeafeningRoar_Timer; - { - CellPair pair(Trinity::ComputeCellPair(x, y)); - Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); + uint32 ShapeShift_Timer; + uint32 Berserk_Timer; - Trinity::AllFriendlyCreaturesInGrid check(me); - Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid> searcher(me, templist, check); + bool inBearForm; + bool MoveEvent; + bool inMove; + uint32 MovePhase; + uint32 waitTimer; - TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>, GridTypeMapContainer> cSearcher(searcher); + void Reset() + { + if (MoveEvent) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + inMove = false; + waitTimer = 0; + me->SetSpeed(MOVE_RUN,2); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + }else + { + (*me).GetMotionMaster()->MovePoint(0,NalorakkWay[7][0],NalorakkWay[7][1],NalorakkWay[7][2]); + } - cell.Visit(pair, cSearcher, *(me->GetMap())); - } + if (pInstance) + pInstance->SetData(DATA_NALORAKKEVENT, NOT_STARTED); - if (!templist.size()) - return; + Surge_Timer = 15000 + rand()%5000; + BrutalSwipe_Timer = 7000 + rand()%5000; + Mangle_Timer = 10000 + rand()%5000; + ShapeShift_Timer = 45000 + rand()%5000; + Berserk_Timer = 600000; - for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i) - { - if ((*i) && me->IsWithinDistInMap((*i),25)) - { - (*i)->SetNoCallAssistance(true); - (*i)->AI()->AttackStart(pTarget); + inBearForm = false; + // me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 5122); // TODO: find the correct equipment id } - } - } - - void AttackStart(Unit* who) - { - if (!MoveEvent) - ScriptedAI::AttackStart(who); - } - void MoveInLineOfSight(Unit *who) - { - if (!MoveEvent) - { - ScriptedAI::MoveInLineOfSight(who); - } - else - { - if (me->IsHostileTo(who)) + void SendAttacker(Unit *pTarget) { - if (!inMove) - { - switch(MovePhase) - { - case 0: - if (me->IsWithinDistInMap(who, 50)) - { - me->MonsterYell(YELL_NALORAKK_WAVE1, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_NALORAKK_WAVE1); - - (*me).GetMotionMaster()->MovePoint(1,NalorakkWay[1][0],NalorakkWay[1][1],NalorakkWay[1][2]); - MovePhase ++; - inMove = true; + std::list<Creature*> templist; + float x, y, z; + me->GetPosition(x, y, z); - SendAttacker(who); - } - break; - case 2: - if (me->IsWithinDistInMap(who, 40)) - { - me->MonsterYell(YELL_NALORAKK_WAVE2, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_NALORAKK_WAVE2); + { + CellPair pair(Trinity::ComputeCellPair(x, y)); + Cell cell(pair); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); - (*me).GetMotionMaster()->MovePoint(3,NalorakkWay[3][0],NalorakkWay[3][1],NalorakkWay[3][2]); - MovePhase ++; - inMove = true; + Trinity::AllFriendlyCreaturesInGrid check(me); + Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid> searcher(me, templist, check); - SendAttacker(who); - } - break; - case 5: - if (me->IsWithinDistInMap(who, 40)) - { - me->MonsterYell(YELL_NALORAKK_WAVE3, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_NALORAKK_WAVE3); + TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>, GridTypeMapContainer> cSearcher(searcher); - (*me).GetMotionMaster()->MovePoint(6,NalorakkWay[6][0],NalorakkWay[6][1],NalorakkWay[6][2]); - MovePhase ++; - inMove = true; + cell.Visit(pair, cSearcher, *(me->GetMap())); + } - SendAttacker(who); - } - break; - case 7: - if (me->IsWithinDistInMap(who, 50)) - { - SendAttacker(who); + if (!templist.size()) + return; - me->MonsterYell(YELL_NALORAKK_WAVE4, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_NALORAKK_WAVE4); + for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i) + { + if ((*i) && me->IsWithinDistInMap((*i),25)) + { + (*i)->SetNoCallAssistance(true); + (*i)->AI()->AttackStart(pTarget); + } + } + } - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + void AttackStart(Unit* who) + { + if (!MoveEvent) + ScriptedAI::AttackStart(who); + } - MoveEvent = false; + void MoveInLineOfSight(Unit *who) + { + if (!MoveEvent) + { + ScriptedAI::MoveInLineOfSight(who); + } + else + { + if (me->IsHostileTo(who)) + { + if (!inMove) + { + switch(MovePhase) + { + case 0: + if (me->IsWithinDistInMap(who, 50)) + { + me->MonsterYell(YELL_NALORAKK_WAVE1, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_NALORAKK_WAVE1); + + (*me).GetMotionMaster()->MovePoint(1,NalorakkWay[1][0],NalorakkWay[1][1],NalorakkWay[1][2]); + MovePhase ++; + inMove = true; + + SendAttacker(who); + } + break; + case 2: + if (me->IsWithinDistInMap(who, 40)) + { + me->MonsterYell(YELL_NALORAKK_WAVE2, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_NALORAKK_WAVE2); + + (*me).GetMotionMaster()->MovePoint(3,NalorakkWay[3][0],NalorakkWay[3][1],NalorakkWay[3][2]); + MovePhase ++; + inMove = true; + + SendAttacker(who); + } + break; + case 5: + if (me->IsWithinDistInMap(who, 40)) + { + me->MonsterYell(YELL_NALORAKK_WAVE3, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_NALORAKK_WAVE3); + + (*me).GetMotionMaster()->MovePoint(6,NalorakkWay[6][0],NalorakkWay[6][1],NalorakkWay[6][2]); + MovePhase ++; + inMove = true; + + SendAttacker(who); + } + break; + case 7: + if (me->IsWithinDistInMap(who, 50)) + { + SendAttacker(who); + + me->MonsterYell(YELL_NALORAKK_WAVE4, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_NALORAKK_WAVE4); + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + MoveEvent = false; + } + break; } - break; + } } } } - } - } - - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_NALORAKKEVENT, IN_PROGRESS); - - me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_YELL_AGGRO); - DoZoneInCombat(); - } - - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(DATA_NALORAKKEVENT, DONE); - - me->MonsterYell(YELL_DEATH,LANG_UNIVERSAL,NULL); - DoPlaySoundToSet(me, SOUND_YELL_DEATH); - } - - void KilledUnit(Unit* /*victim*/) - { - switch (urand(0,1)) - { - case 0: - me->MonsterYell(YELL_KILL_ONE, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_YELL_KILL_ONE); - break; - case 1: - me->MonsterYell(YELL_KILL_TWO, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_YELL_KILL_TWO); - break; - } - } - - void MovementInform(uint32 type, uint32 id) - { - if (MoveEvent) - { - if (type != POINT_MOTION_TYPE) - return; - if (!inMove) - return; + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_NALORAKKEVENT, IN_PROGRESS); - if (MovePhase != id) - return; + me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_YELL_AGGRO); + DoZoneInCombat(); + } - switch(MovePhase) + void JustDied(Unit* /*Killer*/) { - case 2: - me->SetOrientation(3.1415*2); - inMove = false; - return; - case 1: - case 3: - case 4: - case 6: - MovePhase ++; - waitTimer = 1; - inMove = true; - return; - case 5: - me->SetOrientation(3.1415*0.5); - inMove = false; - return; - case 7: - me->SetOrientation(3.1415*0.5); - inMove = false; - return; + if (pInstance) + pInstance->SetData(DATA_NALORAKKEVENT, DONE); + + me->MonsterYell(YELL_DEATH,LANG_UNIVERSAL,NULL); + DoPlaySoundToSet(me, SOUND_YELL_DEATH); } - } - } + void KilledUnit(Unit* /*victim*/) + { + switch (urand(0,1)) + { + case 0: + me->MonsterYell(YELL_KILL_ONE, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_YELL_KILL_ONE); + break; + case 1: + me->MonsterYell(YELL_KILL_TWO, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_YELL_KILL_TWO); + break; + } + } - void UpdateAI(const uint32 diff) - { - if (waitTimer) - { - if (inMove) - if (waitTimer <= diff) + void MovementInform(uint32 type, uint32 id) + { + if (MoveEvent) { - (*me).GetMotionMaster()->MovementExpired(); - (*me).GetMotionMaster()->MovePoint(MovePhase,NalorakkWay[MovePhase][0],NalorakkWay[MovePhase][1],NalorakkWay[MovePhase][2]); - waitTimer = 0; - } else waitTimer -= diff; - } + if (type != POINT_MOTION_TYPE) + return; - if (!UpdateVictim()) - return; + if (!inMove) + return; - if (Berserk_Timer <= diff) - { - DoCast(me, SPELL_BERSERK, true); - me->MonsterYell(YELL_BERSERK, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_YELL_BERSERK); - Berserk_Timer = 600000; - } else Berserk_Timer -= diff; + if (MovePhase != id) + return; - if (ShapeShift_Timer <= diff) - { - if (inBearForm) - { - // me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 5122); - me->MonsterYell(YELL_SHIFTEDTOTROLL, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_YELL_TOTROLL); - me->RemoveAurasDueToSpell(SPELL_BEARFORM); - Surge_Timer = 15000 + rand()%5000; - BrutalSwipe_Timer = 7000 + rand()%5000; - Mangle_Timer = 10000 + rand()%5000; - ShapeShift_Timer = 45000 + rand()%5000; - inBearForm = false; - } - else - { - // me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 0); - me->MonsterYell(YELL_SHIFTEDTOBEAR, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_YELL_TOBEAR); - DoCast(me, SPELL_BEARFORM, true); - LaceratingSlash_Timer = 2000; // dur 18s - RendFlesh_Timer = 3000; // dur 5s - DeafeningRoar_Timer = 5000 + rand()%5000; // dur 2s - ShapeShift_Timer = 20000 + rand()%5000; // dur 30s - inBearForm = true; + switch(MovePhase) + { + case 2: + me->SetOrientation(3.1415*2); + inMove = false; + return; + case 1: + case 3: + case 4: + case 6: + MovePhase ++; + waitTimer = 1; + inMove = true; + return; + case 5: + me->SetOrientation(3.1415*0.5); + inMove = false; + return; + case 7: + me->SetOrientation(3.1415*0.5); + inMove = false; + return; + } + + } } - } else ShapeShift_Timer -= diff; - if (!inBearForm) - { - if (BrutalSwipe_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_BRUTALSWIPE); - BrutalSwipe_Timer = 7000 + rand()%5000; - } else BrutalSwipe_Timer -= diff; + if (waitTimer) + { + if (inMove) + if (waitTimer <= diff) + { + (*me).GetMotionMaster()->MovementExpired(); + (*me).GetMotionMaster()->MovePoint(MovePhase,NalorakkWay[MovePhase][0],NalorakkWay[MovePhase][1],NalorakkWay[MovePhase][2]); + waitTimer = 0; + } else waitTimer -= diff; + } - if (Mangle_Timer <= diff) - { - if (me->getVictim() && !me->getVictim()->HasAura(SPELL_MANGLEEFFECT)) + if (!UpdateVictim()) + return; + + if (Berserk_Timer <= diff) { - DoCast(me->getVictim(), SPELL_MANGLE); - Mangle_Timer = 1000; + DoCast(me, SPELL_BERSERK, true); + me->MonsterYell(YELL_BERSERK, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_YELL_BERSERK); + Berserk_Timer = 600000; + } else Berserk_Timer -= diff; + + if (ShapeShift_Timer <= diff) + { + if (inBearForm) + { + // me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 5122); + me->MonsterYell(YELL_SHIFTEDTOTROLL, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_YELL_TOTROLL); + me->RemoveAurasDueToSpell(SPELL_BEARFORM); + Surge_Timer = 15000 + rand()%5000; + BrutalSwipe_Timer = 7000 + rand()%5000; + Mangle_Timer = 10000 + rand()%5000; + ShapeShift_Timer = 45000 + rand()%5000; + inBearForm = false; + } + else + { + // me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 0); + me->MonsterYell(YELL_SHIFTEDTOBEAR, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_YELL_TOBEAR); + DoCast(me, SPELL_BEARFORM, true); + LaceratingSlash_Timer = 2000; // dur 18s + RendFlesh_Timer = 3000; // dur 5s + DeafeningRoar_Timer = 5000 + rand()%5000; // dur 2s + ShapeShift_Timer = 20000 + rand()%5000; // dur 30s + inBearForm = true; + } + } else ShapeShift_Timer -= diff; + + if (!inBearForm) + { + if (BrutalSwipe_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_BRUTALSWIPE); + BrutalSwipe_Timer = 7000 + rand()%5000; + } else BrutalSwipe_Timer -= diff; + + if (Mangle_Timer <= diff) + { + if (me->getVictim() && !me->getVictim()->HasAura(SPELL_MANGLEEFFECT)) + { + DoCast(me->getVictim(), SPELL_MANGLE); + Mangle_Timer = 1000; + } + else Mangle_Timer = 10000 + rand()%5000; + } else Mangle_Timer -= diff; + + if (Surge_Timer <= diff) + { + me->MonsterYell(YELL_SURGE, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_YELL_SURGE); + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 45, true); + if (pTarget) + DoCast(pTarget, SPELL_SURGE); + Surge_Timer = 15000 + rand()%5000; + } else Surge_Timer -= diff; } - else Mangle_Timer = 10000 + rand()%5000; - } else Mangle_Timer -= diff; + else + { + if (LaceratingSlash_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_LACERATINGSLASH); + LaceratingSlash_Timer = 18000 + rand()%5000; + } else LaceratingSlash_Timer -= diff; - if (Surge_Timer <= diff) - { - me->MonsterYell(YELL_SURGE, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_YELL_SURGE); - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 45, true); - if (pTarget) - DoCast(pTarget, SPELL_SURGE); - Surge_Timer = 15000 + rand()%5000; - } else Surge_Timer -= diff; - } - else - { - if (LaceratingSlash_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_LACERATINGSLASH); - LaceratingSlash_Timer = 18000 + rand()%5000; - } else LaceratingSlash_Timer -= diff; + if (RendFlesh_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_RENDFLESH); + RendFlesh_Timer = 5000 + rand()%5000; + } else RendFlesh_Timer -= diff; - if (RendFlesh_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_RENDFLESH); - RendFlesh_Timer = 5000 + rand()%5000; - } else RendFlesh_Timer -= diff; + if (DeafeningRoar_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DEAFENINGROAR); + DeafeningRoar_Timer = 15000 + rand()%5000; + } else DeafeningRoar_Timer -= diff; + } - if (DeafeningRoar_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_DEAFENINGROAR); - DeafeningRoar_Timer = 15000 + rand()%5000; - } else DeafeningRoar_Timer -= diff; - } + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } -}; -CreatureAI* GetAI_boss_nalorakk(Creature* pCreature) -{ - return new boss_nalorakkAI (pCreature); -} + CreatureAI* GetAI(Creature* creature) const + { + return new boss_nalorakkAI(creature); + } +}; void AddSC_boss_nalorakk() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_nalorakk"; - newscript->GetAI = &GetAI_boss_nalorakk; - newscript->RegisterSelf(); + new boss_nalorakk(); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp index fbd34c34228..6f442afa064 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp @@ -140,486 +140,500 @@ static TransformStruct Transform[] = {SOUND_TRANSFORM_TO_DRAGONHAWK, YELL_TRANSFORM_TO_DRAGONHAWK, SPELL_SHAPE_OF_THE_DRAGONHAWK, SPELL_SHAPE_OF_THE_LYNX} }; -struct boss_zuljinAI : public ScriptedAI +class boss_zuljin : public CreatureScript { - boss_zuljinAI(Creature *c) : ScriptedAI(c), Summons(me) - { - pInstance = c->GetInstanceData(); - } - ScriptedInstance *pInstance; + public: - uint64 SpiritGUID[4]; - uint64 ClawTargetGUID; - uint64 TankGUID; + boss_zuljin() + : CreatureScript("boss_zuljin") + { + } - uint32 Phase; - uint32 health_20; + struct boss_zuljinAI : public ScriptedAI + { + boss_zuljinAI(Creature *c) : ScriptedAI(c), Summons(me) + { + pInstance = c->GetInstanceData(); + } + ScriptedInstance *pInstance; - uint32 Intro_Timer; - uint32 Berserk_Timer; + uint64 SpiritGUID[4]; + uint64 ClawTargetGUID; + uint64 TankGUID; - uint32 Whirlwind_Timer; - uint32 Grievous_Throw_Timer; + uint32 Phase; + uint32 health_20; - uint32 Creeping_Paralysis_Timer; - uint32 Overpower_Timer; + uint32 Intro_Timer; + uint32 Berserk_Timer; - uint32 Claw_Rage_Timer; - uint32 Lynx_Rush_Timer; - uint32 Claw_Counter; - uint32 Claw_Loop_Timer; + uint32 Whirlwind_Timer; + uint32 Grievous_Throw_Timer; - uint32 Flame_Whirl_Timer; - uint32 Flame_Breath_Timer; - uint32 Pillar_Of_Fire_Timer; + uint32 Creeping_Paralysis_Timer; + uint32 Overpower_Timer; - SummonList Summons; + uint32 Claw_Rage_Timer; + uint32 Lynx_Rush_Timer; + uint32 Claw_Counter; + uint32 Claw_Loop_Timer; - void Reset() - { - if (pInstance) - pInstance->SetData(DATA_ZULJINEVENT, NOT_STARTED); + uint32 Flame_Whirl_Timer; + uint32 Flame_Breath_Timer; + uint32 Pillar_Of_Fire_Timer; - Phase = 0; + SummonList Summons; - health_20 = me->GetMaxHealth()*0.2; + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_ZULJINEVENT, NOT_STARTED); - Intro_Timer = 37000; - Berserk_Timer = 600000; + Phase = 0; - Whirlwind_Timer = 7000; - Grievous_Throw_Timer = 8000; + health_20 = me->GetMaxHealth()*0.2; - Creeping_Paralysis_Timer = 7000; - Overpower_Timer = 0; + Intro_Timer = 37000; + Berserk_Timer = 600000; - Claw_Rage_Timer = 5000; - Lynx_Rush_Timer = 14000; - Claw_Loop_Timer = 0; - Claw_Counter = 0; + Whirlwind_Timer = 7000; + Grievous_Throw_Timer = 8000; - Flame_Whirl_Timer = 5000; - Flame_Breath_Timer = 6000; - Pillar_Of_Fire_Timer = 7000; + Creeping_Paralysis_Timer = 7000; + Overpower_Timer = 0; - ClawTargetGUID = 0; - TankGUID = 0; + Claw_Rage_Timer = 5000; + Lynx_Rush_Timer = 14000; + Claw_Loop_Timer = 0; + Claw_Counter = 0; - Summons.DespawnAll(); + Flame_Whirl_Timer = 5000; + Flame_Breath_Timer = 6000; + Pillar_Of_Fire_Timer = 7000; - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 47174); - //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, 218172674); - //me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); - } + ClawTargetGUID = 0; + TankGUID = 0; - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_ZULJINEVENT, IN_PROGRESS); + Summons.DespawnAll(); - DoZoneInCombat(); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 47174); + //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, 218172674); + //me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); + } - me->MonsterYell(YELL_INTRO,LANG_UNIVERSAL,NULL); - DoPlaySoundToSet(me, SOUND_INTRO); - SpawnAdds(); - EnterPhase(0); - } + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_ZULJINEVENT, IN_PROGRESS); - void KilledUnit(Unit* /*victim*/) - { - if (Intro_Timer) - return; + DoZoneInCombat(); - switch (urand(0,1)) - { - case 0: - me->MonsterYell(YELL_KILL_ONE, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_KILL_ONE); - break; - case 1: - me->MonsterYell(YELL_KILL_TWO, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_KILL_TWO); - break; - } - } - - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(DATA_ZULJINEVENT, DONE); - - me->MonsterYell(YELL_DEATH, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_DEATH); - Summons.DespawnEntry(CREATURE_COLUMN_OF_FIRE); - - if (Unit *Temp = Unit::GetUnit(*me, SpiritGUID[3])) - Temp->SetUInt32Value(UNIT_FIELD_BYTES_1,UNIT_STAND_STATE_DEAD); - } - - void AttackStart(Unit *who) - { - if (Phase == 2) - AttackStartNoMove(who); - else - ScriptedAI::AttackStart(who); - } - - void DoMeleeAttackIfReady() - { - if (!me->IsNonMeleeSpellCasted(false)) - { - if (me->isAttackReady() && me->IsWithinMeleeRange(me->getVictim())) - { - if (Phase == 1 && !Overpower_Timer) - { - uint32 health = me->getVictim()->GetHealth(); - me->AttackerStateUpdate(me->getVictim()); - if (me->getVictim() && health == me->getVictim()->GetHealth()) - { - DoCast(me->getVictim(), SPELL_OVERPOWER, false); - Overpower_Timer = 5000; - } - } else me->AttackerStateUpdate(me->getVictim()); - me->resetAttackTimer(); + me->MonsterYell(YELL_INTRO,LANG_UNIVERSAL,NULL); + DoPlaySoundToSet(me, SOUND_INTRO); + SpawnAdds(); + EnterPhase(0); } - } - } - void SpawnAdds() - { - Creature *pCreature = NULL; - for (uint8 i = 0; i < 4; ++i) - { - pCreature = me->SummonCreature(SpiritInfo[i].entry, SpiritInfo[i].x, SpiritInfo[i].y, SpiritInfo[i].z, SpiritInfo[i].orient, TEMPSUMMON_DEAD_DESPAWN, 0); - if (pCreature) + void KilledUnit(Unit* /*victim*/) { - pCreature->CastSpell(pCreature, SPELL_SPIRIT_AURA, true); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - SpiritGUID[i] = pCreature->GetGUID(); - } - } - } + if (Intro_Timer) + return; - void DespawnAdds() - { - for (uint8 i = 0; i < 4; ++i) - { - Unit* Temp = NULL; - if (SpiritGUID[i]) - { - if (Temp = Unit::GetUnit(*me, SpiritGUID[i])) + switch (urand(0,1)) { - Temp->SetVisibility(VISIBILITY_OFF); - Temp->setDeathState(DEAD); + case 0: + me->MonsterYell(YELL_KILL_ONE, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_KILL_ONE); + break; + case 1: + me->MonsterYell(YELL_KILL_TWO, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_KILL_TWO); + break; } } - SpiritGUID[i] = 0; - } - } - void JustSummoned(Creature *summon) - { - Summons.Summon(summon); - } + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + pInstance->SetData(DATA_ZULJINEVENT, DONE); - void SummonedCreatureDespawn(Creature *summon) - { - Summons.Despawn(summon); - } + me->MonsterYell(YELL_DEATH, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_DEATH); + Summons.DespawnEntry(CREATURE_COLUMN_OF_FIRE); - void EnterPhase(uint32 NextPhase) - { - switch(NextPhase) - { - case 0: - break; - case 1: - case 2: - case 3: - case 4: - DoTeleportTo(CENTER_X, CENTER_Y, CENTER_Z, 100); - DoResetThreat(); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 0); - me->RemoveAurasDueToSpell(Transform[Phase].unaura); - DoCast(me, Transform[Phase].spell); - me->MonsterYell(Transform[Phase].text, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, Transform[Phase].sound); - if (Phase > 0) - { - if (Unit *Temp = Unit::GetUnit(*me, SpiritGUID[Phase - 1])) + if (Unit *Temp = Unit::GetUnit(*me, SpiritGUID[3])) Temp->SetUInt32Value(UNIT_FIELD_BYTES_1,UNIT_STAND_STATE_DEAD); } - if (Unit *Temp = Unit::GetUnit(*me, SpiritGUID[NextPhase - 1])) - Temp->CastSpell(me, SPELL_SIPHON_SOUL, false); // should m cast on temp - if (NextPhase == 2) + + void AttackStart(Unit *who) { - me->GetMotionMaster()->Clear(); - DoCast(me, SPELL_ENERGY_STORM, true); // enemy aura - for (uint8 i = 0; i < 4; ++i) + if (Phase == 2) + AttackStartNoMove(who); + else + ScriptedAI::AttackStart(who); + } + + void DoMeleeAttackIfReady() + { + if (!me->IsNonMeleeSpellCasted(false)) { - Creature* Vortex = DoSpawnCreature(CREATURE_FEATHER_VORTEX, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (Vortex) + if (me->isAttackReady() && me->IsWithinMeleeRange(me->getVictim())) { - Vortex->CastSpell(Vortex, SPELL_CYCLONE_PASSIVE, true); - Vortex->CastSpell(Vortex, SPELL_CYCLONE_VISUAL, true); - Vortex->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Vortex->SetSpeed(MOVE_RUN, 1.0f); - Vortex->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); - DoZoneInCombat(Vortex); + if (Phase == 1 && !Overpower_Timer) + { + uint32 health = me->getVictim()->GetHealth(); + me->AttackerStateUpdate(me->getVictim()); + if (me->getVictim() && health == me->getVictim()->GetHealth()) + { + DoCast(me->getVictim(), SPELL_OVERPOWER, false); + Overpower_Timer = 5000; + } + } else me->AttackerStateUpdate(me->getVictim()); + me->resetAttackTimer(); } } } - else - me->AI()->AttackStart(me->getVictim()); - if (NextPhase == 3) - { - me->RemoveAurasDueToSpell(SPELL_ENERGY_STORM); - Summons.DespawnEntry(CREATURE_FEATHER_VORTEX); - me->GetMotionMaster()->MoveChase(me->getVictim()); - } - break; - default: - break; - } - Phase = NextPhase; - } - void UpdateAI(const uint32 diff) - { - if (!TankGUID) - { - if (!UpdateVictim()) - return; - - if (me->GetHealth() < health_20 * (4 - Phase)) - EnterPhase(Phase + 1); - } - - if (Berserk_Timer <= diff) - { - DoCast(me, SPELL_BERSERK, true); - me->MonsterYell(YELL_BERSERK, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_BERSERK); - Berserk_Timer = 60000; - } else Berserk_Timer -= diff; - - switch (Phase) - { - case 0: - if (Intro_Timer) + void SpawnAdds() { - if (Intro_Timer <= diff) + Creature *pCreature = NULL; + for (uint8 i = 0; i < 4; ++i) { - me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_AGGRO); - Intro_Timer = 0; - } else Intro_Timer -= diff; + pCreature = me->SummonCreature(SpiritInfo[i].entry, SpiritInfo[i].x, SpiritInfo[i].y, SpiritInfo[i].z, SpiritInfo[i].orient, TEMPSUMMON_DEAD_DESPAWN, 0); + if (pCreature) + { + pCreature->CastSpell(pCreature, SPELL_SPIRIT_AURA, true); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + SpiritGUID[i] = pCreature->GetGUID(); + } + } } - if (Whirlwind_Timer <= diff) + void DespawnAdds() { - DoCast(me, SPELL_WHIRLWIND); - Whirlwind_Timer = 15000 + rand()%5000; - } else Whirlwind_Timer -= diff; + for (uint8 i = 0; i < 4; ++i) + { + Unit* Temp = NULL; + if (SpiritGUID[i]) + { + if (Temp = Unit::GetUnit(*me, SpiritGUID[i])) + { + Temp->SetVisibility(VISIBILITY_OFF); + Temp->setDeathState(DEAD); + } + } + SpiritGUID[i] = 0; + } + } - if (Grievous_Throw_Timer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_GRIEVOUS_THROW, false); - Grievous_Throw_Timer = 10000; - } else Grievous_Throw_Timer -= diff; - break; - - case 1: - if (Creeping_Paralysis_Timer <= diff) + void JustSummoned(Creature *summon) { - DoCast(me, SPELL_CREEPING_PARALYSIS); - Creeping_Paralysis_Timer = 20000; - } else Creeping_Paralysis_Timer -= diff; + Summons.Summon(summon); + } - if (Overpower_Timer <= diff) + void SummonedCreatureDespawn(Creature *summon) { - // implemented in DoMeleeAttackIfReady() - Overpower_Timer = 0; - } else Overpower_Timer -= diff; - break; - - case 2: - return; + Summons.Despawn(summon); + } - case 3: - if (Claw_Rage_Timer <= diff) + void EnterPhase(uint32 NextPhase) { - if (!TankGUID) + switch(NextPhase) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + case 0: + break; + case 1: + case 2: + case 3: + case 4: + DoTeleportTo(CENTER_X, CENTER_Y, CENTER_Z, 100); + DoResetThreat(); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 0); + me->RemoveAurasDueToSpell(Transform[Phase].unaura); + DoCast(me, Transform[Phase].spell); + me->MonsterYell(Transform[Phase].text, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, Transform[Phase].sound); + if (Phase > 0) { - TankGUID = me->getVictim()->GetGUID(); - me->SetSpeed(MOVE_RUN, 5.0f); - AttackStart(pTarget); // change victim - Claw_Rage_Timer = 0; - Claw_Loop_Timer = 500; - Claw_Counter = 0; + if (Unit *Temp = Unit::GetUnit(*me, SpiritGUID[Phase - 1])) + Temp->SetUInt32Value(UNIT_FIELD_BYTES_1,UNIT_STAND_STATE_DEAD); } - } - else if (!Claw_Rage_Timer) // do not do this when Lynx_Rush - { - if (Claw_Loop_Timer <= diff) + if (Unit *Temp = Unit::GetUnit(*me, SpiritGUID[NextPhase - 1])) + Temp->CastSpell(me, SPELL_SIPHON_SOUL, false); // should m cast on temp + if (NextPhase == 2) { - Unit *pTarget = me->getVictim(); - if (!pTarget || !pTarget->isTargetableForAttack()) pTarget = Unit::GetUnit(*me, TankGUID); - if (!pTarget || !pTarget->isTargetableForAttack()) pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) + me->GetMotionMaster()->Clear(); + DoCast(me, SPELL_ENERGY_STORM, true); // enemy aura + for (uint8 i = 0; i < 4; ++i) { - AttackStart(pTarget); - if (me->IsWithinMeleeRange(pTarget)) + Creature* Vortex = DoSpawnCreature(CREATURE_FEATHER_VORTEX, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + if (Vortex) { - DoCast(pTarget, SPELL_CLAW_RAGE_DAMAGE, true); - ++Claw_Counter; - if (Claw_Counter == 12) - { - Claw_Rage_Timer = 15000 + rand()%5000; - me->SetSpeed(MOVE_RUN, 1.2f); - AttackStart(Unit::GetUnit(*me, TankGUID)); - TankGUID = 0; - return; - } - else - Claw_Loop_Timer = 500; + Vortex->CastSpell(Vortex, SPELL_CYCLONE_PASSIVE, true); + Vortex->CastSpell(Vortex, SPELL_CYCLONE_VISUAL, true); + Vortex->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + Vortex->SetSpeed(MOVE_RUN, 1.0f); + Vortex->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); + DoZoneInCombat(Vortex); } } - else - { - EnterEvadeMode(); // if (pTarget) - return; - } - } else Claw_Loop_Timer -= diff; - } //if (TankGUID) - } else Claw_Rage_Timer -= diff; + } + else + me->AI()->AttackStart(me->getVictim()); + if (NextPhase == 3) + { + me->RemoveAurasDueToSpell(SPELL_ENERGY_STORM); + Summons.DespawnEntry(CREATURE_FEATHER_VORTEX); + me->GetMotionMaster()->MoveChase(me->getVictim()); + } + break; + default: + break; + } + Phase = NextPhase; + } - if (Lynx_Rush_Timer <= diff) + void UpdateAI(const uint32 diff) { if (!TankGUID) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - TankGUID = me->getVictim()->GetGUID(); - me->SetSpeed(MOVE_RUN, 5.0f); - AttackStart(pTarget); // change victim - Lynx_Rush_Timer = 0; - Claw_Counter = 0; - } + if (!UpdateVictim()) + return; + + if (me->GetHealth() < health_20 * (4 - Phase)) + EnterPhase(Phase + 1); } - else if (!Lynx_Rush_Timer) + + if (Berserk_Timer <= diff) + { + DoCast(me, SPELL_BERSERK, true); + me->MonsterYell(YELL_BERSERK, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_BERSERK); + Berserk_Timer = 60000; + } else Berserk_Timer -= diff; + + switch (Phase) { - Unit *pTarget = me->getVictim(); - if (!pTarget || !pTarget->isTargetableForAttack()) + case 0: + if (Intro_Timer) { - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - AttackStart(pTarget); + if (Intro_Timer <= diff) + { + me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_AGGRO); + Intro_Timer = 0; + } else Intro_Timer -= diff; } - if (pTarget) + + if (Whirlwind_Timer <= diff) { - if (me->IsWithinMeleeRange(pTarget)) + DoCast(me, SPELL_WHIRLWIND); + Whirlwind_Timer = 15000 + rand()%5000; + } else Whirlwind_Timer -= diff; + + if (Grievous_Throw_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_GRIEVOUS_THROW, false); + Grievous_Throw_Timer = 10000; + } else Grievous_Throw_Timer -= diff; + break; + + case 1: + if (Creeping_Paralysis_Timer <= diff) + { + DoCast(me, SPELL_CREEPING_PARALYSIS); + Creeping_Paralysis_Timer = 20000; + } else Creeping_Paralysis_Timer -= diff; + + if (Overpower_Timer <= diff) + { + // implemented in DoMeleeAttackIfReady() + Overpower_Timer = 0; + } else Overpower_Timer -= diff; + break; + + case 2: + return; + + case 3: + if (Claw_Rage_Timer <= diff) + { + if (!TankGUID) { - DoCast(pTarget, SPELL_LYNX_RUSH_DAMAGE, true); - ++Claw_Counter; - if (Claw_Counter == 9) + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) { - Lynx_Rush_Timer = 15000 + rand()%5000; - me->SetSpeed(MOVE_RUN, 1.2f); - AttackStart(Unit::GetUnit(*me, TankGUID)); - TankGUID = 0; + TankGUID = me->getVictim()->GetGUID(); + me->SetSpeed(MOVE_RUN, 5.0f); + AttackStart(pTarget); // change victim + Claw_Rage_Timer = 0; + Claw_Loop_Timer = 500; + Claw_Counter = 0; } - else - AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); } - } - else + else if (!Claw_Rage_Timer) // do not do this when Lynx_Rush + { + if (Claw_Loop_Timer <= diff) + { + Unit *pTarget = me->getVictim(); + if (!pTarget || !pTarget->isTargetableForAttack()) pTarget = Unit::GetUnit(*me, TankGUID); + if (!pTarget || !pTarget->isTargetableForAttack()) pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + { + AttackStart(pTarget); + if (me->IsWithinMeleeRange(pTarget)) + { + DoCast(pTarget, SPELL_CLAW_RAGE_DAMAGE, true); + ++Claw_Counter; + if (Claw_Counter == 12) + { + Claw_Rage_Timer = 15000 + rand()%5000; + me->SetSpeed(MOVE_RUN, 1.2f); + AttackStart(Unit::GetUnit(*me, TankGUID)); + TankGUID = 0; + return; + } + else + Claw_Loop_Timer = 500; + } + } + else + { + EnterEvadeMode(); // if (pTarget) + return; + } + } else Claw_Loop_Timer -= diff; + } //if (TankGUID) + } else Claw_Rage_Timer -= diff; + + if (Lynx_Rush_Timer <= diff) { - EnterEvadeMode(); // if (pTarget) - return; - } - } //if (TankGUID) - } else Lynx_Rush_Timer -= diff; + if (!TankGUID) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + TankGUID = me->getVictim()->GetGUID(); + me->SetSpeed(MOVE_RUN, 5.0f); + AttackStart(pTarget); // change victim + Lynx_Rush_Timer = 0; + Claw_Counter = 0; + } + } + else if (!Lynx_Rush_Timer) + { + Unit *pTarget = me->getVictim(); + if (!pTarget || !pTarget->isTargetableForAttack()) + { + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + AttackStart(pTarget); + } + if (pTarget) + { + if (me->IsWithinMeleeRange(pTarget)) + { + DoCast(pTarget, SPELL_LYNX_RUSH_DAMAGE, true); + ++Claw_Counter; + if (Claw_Counter == 9) + { + Lynx_Rush_Timer = 15000 + rand()%5000; + me->SetSpeed(MOVE_RUN, 1.2f); + AttackStart(Unit::GetUnit(*me, TankGUID)); + TankGUID = 0; + } + else + AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); + } + } + else + { + EnterEvadeMode(); // if (pTarget) + return; + } + } //if (TankGUID) + } else Lynx_Rush_Timer -= diff; - break; - case 4: - if (Flame_Whirl_Timer <= diff) - { - DoCast(me, SPELL_FLAME_WHIRL); - Flame_Whirl_Timer = 12000; - }Flame_Whirl_Timer -= diff; + break; + case 4: + if (Flame_Whirl_Timer <= diff) + { + DoCast(me, SPELL_FLAME_WHIRL); + Flame_Whirl_Timer = 12000; + }Flame_Whirl_Timer -= diff; - if (Pillar_Of_Fire_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SUMMON_PILLAR); - Pillar_Of_Fire_Timer = 10000; - } else Pillar_Of_Fire_Timer -= diff; + if (Pillar_Of_Fire_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SUMMON_PILLAR); + Pillar_Of_Fire_Timer = 10000; + } else Pillar_Of_Fire_Timer -= diff; - if (Flame_Breath_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - me->SetInFront(pTarget); - DoCast(me, SPELL_FLAME_BREATH); - Flame_Breath_Timer = 10000; - } else Flame_Breath_Timer -= diff; - break; - - default: - break; - } + if (Flame_Breath_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + me->SetInFront(pTarget); + DoCast(me, SPELL_FLAME_BREATH); + Flame_Breath_Timer = 10000; + } else Flame_Breath_Timer -= diff; + break; + + default: + break; + } + + if (!TankGUID) + DoMeleeAttackIfReady(); + } + }; - if (!TankGUID) - DoMeleeAttackIfReady(); - } + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_zuljinAI(creature); + } }; -CreatureAI* GetAI_boss_zuljin(Creature* pCreature) +class mob_zuljin_vortex : public CreatureScript { - return new boss_zuljinAI (pCreature); -} + public: -struct feather_vortexAI : public ScriptedAI -{ - feather_vortexAI(Creature *c) : ScriptedAI(c) {} + mob_zuljin_vortex() + : CreatureScript("mob_zuljin_vortex") + { + } + + struct mob_zuljin_vortexAI : public ScriptedAI + { + mob_zuljin_vortexAI(Creature *c) : ScriptedAI(c) {} - void Reset() {} + void Reset() {} - void EnterCombat(Unit * /*pTarget*/) {} + void EnterCombat(Unit * /*pTarget*/) {} - void SpellHit(Unit *caster, const SpellEntry *spell) - { - if (spell->Id == SPELL_ZAP_INFORM) - DoCast(caster, SPELL_ZAP_DAMAGE, true); - } + void SpellHit(Unit *caster, const SpellEntry *spell) + { + if (spell->Id == SPELL_ZAP_INFORM) + DoCast(caster, SPELL_ZAP_DAMAGE, true); + } + + void UpdateAI(const uint32 /*diff*/) + { + //if the vortex reach the target, it change his target to another player + if (me->IsWithinMeleeRange(me->getVictim())) + AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); + } + }; - void UpdateAI(const uint32 /*diff*/) - { - //if the vortex reach the target, it change his target to another player - if (me->IsWithinMeleeRange(me->getVictim())) - AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); - } + CreatureAI* GetAI(Creature* creature) const + { + return new mob_zuljin_vortexAI(creature); + } }; -CreatureAI* GetAI_feather_vortexAI(Creature* pCreature) -{ - return new feather_vortexAI (pCreature); -} void AddSC_boss_zuljin() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_zuljin"; - newscript->GetAI = &GetAI_boss_zuljin; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_zuljin_vortex"; - newscript->GetAI = &GetAI_feather_vortexAI; - newscript->RegisterSelf(); + new boss_zuljin(); + new mob_zuljin_vortex(); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp index 4a3096b302e..b600ea26ad9 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp @@ -51,272 +51,277 @@ static SHostageInfo HostageInfo[] = }; -struct instance_zulaman : public ScriptedInstance +class instance_zulaman : public InstanceMapScript { - instance_zulaman(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - uint64 HarkorsSatchelGUID; - uint64 TanzarsTrunkGUID; - uint64 AshlisBagGUID; - uint64 KrazsPackageGUID; - - uint64 HexLordGateGUID; - uint64 ZulJinGateGUID; - uint64 AkilzonDoorGUID; - uint64 ZulJinDoorGUID; - uint64 HalazziDoorGUID; - - uint32 QuestTimer; - uint16 BossKilled; - uint16 QuestMinute; - uint16 ChestLooted; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint32 RandVendor[RAND_VENDOR]; - - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - HarkorsSatchelGUID = 0; - TanzarsTrunkGUID = 0; - AshlisBagGUID = 0; - KrazsPackageGUID = 0; - - HexLordGateGUID = 0; - ZulJinGateGUID = 0; - AkilzonDoorGUID = 0; - HalazziDoorGUID = 0; - ZulJinDoorGUID = 0; - - QuestTimer = 0; - QuestMinute = 21; - BossKilled = 0; - ChestLooted = 0; - - for (uint8 i = 0; i < RAND_VENDOR; ++i) - RandVendor[i] = NOT_STARTED; - } - - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; - - return false; - } - - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + public: + instance_zulaman() + : InstanceMapScript("instance_zulaman") { - case 23578://janalai - case 23863://zuljin - case 24239://hexlord - case 23577://halazzi - case 23576://nalorakk - default: break; } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + struct instance_zulaman_InstanceMapScript : public ScriptedInstance { - case 186303: HalazziDoorGUID = pGo->GetGUID(); break; - case 186304: ZulJinGateGUID = pGo->GetGUID(); break; - case 186305: HexLordGateGUID = pGo->GetGUID(); break; - case 186858: AkilzonDoorGUID = pGo->GetGUID(); break; - case 186859: ZulJinDoorGUID = pGo->GetGUID(); break; - - case 187021: HarkorsSatchelGUID = pGo->GetGUID(); break; - case 186648: TanzarsTrunkGUID = pGo->GetGUID(); break; - case 186672: AshlisBagGUID = pGo->GetGUID(); break; - case 186667: KrazsPackageGUID = pGo->GetGUID(); break; - default: break; + instance_zulaman_InstanceMapScript(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - } - CheckInstanceStatus(); - } + uint64 HarkorsSatchelGUID; + uint64 TanzarsTrunkGUID; + uint64 AshlisBagGUID; + uint64 KrazsPackageGUID; - void SummonHostage(uint8 num) - { - if (!QuestMinute) - return; + uint64 HexLordGateGUID; + uint64 ZulJinGateGUID; + uint64 AkilzonDoorGUID; + uint64 ZulJinDoorGUID; + uint64 HalazziDoorGUID; - Map::PlayerList const &PlayerList = instance->GetPlayers(); - if (PlayerList.isEmpty()) - return; + uint32 QuestTimer; + uint16 BossKilled; + uint16 QuestMinute; + uint16 ChestLooted; - Map::PlayerList::const_iterator i = PlayerList.begin(); - if (Player* i_pl = i->getSource()) - { - if (Unit* Hostage = i_pl->SummonCreature(HostageInfo[num].npc, HostageInfo[num].x, HostageInfo[num].y, HostageInfo[num].z, HostageInfo[num].o, TEMPSUMMON_DEAD_DESPAWN, 0)) + uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint32 RandVendor[RAND_VENDOR]; + + void Initialize() { - Hostage->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - Hostage->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + HarkorsSatchelGUID = 0; + TanzarsTrunkGUID = 0; + AshlisBagGUID = 0; + KrazsPackageGUID = 0; + + HexLordGateGUID = 0; + ZulJinGateGUID = 0; + AkilzonDoorGUID = 0; + HalazziDoorGUID = 0; + ZulJinDoorGUID = 0; + + QuestTimer = 0; + QuestMinute = 21; + BossKilled = 0; + ChestLooted = 0; + + for (uint8 i = 0; i < RAND_VENDOR; ++i) + RandVendor[i] = NOT_STARTED; } - } - } - - void CheckInstanceStatus() - { - if (BossKilled >= 4) - HandleGameObject(HexLordGateGUID, true); - - if (BossKilled >= 5) - HandleGameObject(ZulJinGateGUID, true); - } - - std::string GetSaveData() - { - std::ostringstream ss; - ss << "S " << BossKilled << " " << ChestLooted << " " << QuestMinute; - char* data = new char[ss.str().length()+1]; - strcpy(data, ss.str().c_str()); - //sLog.outError("TSCR: Zul'aman saved, %s.", data); - return data; - } - - void Load(const char* load) - { - if (!load) return; - std::istringstream ss(load); - //sLog.outError("TSCR: Zul'aman loaded, %s.", ss.str().c_str()); - char dataHead; // S - uint16 data1, data2, data3; - ss >> dataHead >> data1 >> data2 >> data3; - //sLog.outError("TSCR: Zul'aman loaded, %d %d %d.", data1, data2, data3); - if (dataHead == 'S') - { - BossKilled = data1; - ChestLooted = data2; - QuestMinute = data3; - } else sLog.outError("TSCR: Zul'aman: corrupted save data."); - } - - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_NALORAKKEVENT: - m_auiEncounter[0] = data; - if (data == DONE) + + bool IsEncounterInProgress() const { - if (QuestMinute) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; + + return false; + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch(pCreature->GetEntry()) { - QuestMinute += 15; - DoUpdateWorldState(3106, QuestMinute); + case 23578://janalai + case 23863://zuljin + case 24239://hexlord + case 23577://halazzi + case 23576://nalorakk + default: break; } - SummonHostage(0); } - break; - case DATA_AKILZONEVENT: - m_auiEncounter[1] = data; - HandleGameObject(AkilzonDoorGUID, data != IN_PROGRESS); - if (data == DONE) + + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - if (QuestMinute) + switch(pGo->GetEntry()) { - QuestMinute += 10; - DoUpdateWorldState(3106, QuestMinute); + case 186303: HalazziDoorGUID = pGo->GetGUID(); break; + case 186304: ZulJinGateGUID = pGo->GetGUID(); break; + case 186305: HexLordGateGUID = pGo->GetGUID(); break; + case 186858: AkilzonDoorGUID = pGo->GetGUID(); break; + case 186859: ZulJinDoorGUID = pGo->GetGUID(); break; + + case 187021: HarkorsSatchelGUID = pGo->GetGUID(); break; + case 186648: TanzarsTrunkGUID = pGo->GetGUID(); break; + case 186672: AshlisBagGUID = pGo->GetGUID(); break; + case 186667: KrazsPackageGUID = pGo->GetGUID(); break; + default: break; + } - SummonHostage(1); - } - break; - case DATA_JANALAIEVENT: - m_auiEncounter[2] = data; - if (data == DONE) SummonHostage(2); - break; - case DATA_HALAZZIEVENT: - m_auiEncounter[3] = data; - HandleGameObject(HalazziDoorGUID, data != IN_PROGRESS); - if (data == DONE) SummonHostage(3); - break; - case DATA_HEXLORDEVENT: - m_auiEncounter[4] = data; - if (data == IN_PROGRESS) - HandleGameObject(HexLordGateGUID, false); - else if (data == NOT_STARTED) CheckInstanceStatus(); - break; - case DATA_ZULJINEVENT: - m_auiEncounter[5] = data; - HandleGameObject(ZulJinDoorGUID, data != IN_PROGRESS); - break; - case DATA_CHESTLOOTED: - ++ChestLooted; - SaveToDB(); - break; - case TYPE_RAND_VENDOR_1: - RandVendor[0] = data; - break; - case TYPE_RAND_VENDOR_2: - RandVendor[1] = data; - break; - } + } - if (data == DONE) - { - ++BossKilled; - if (QuestMinute && BossKilled >= 4) + void SummonHostage(uint8 num) { - QuestMinute = 0; - DoUpdateWorldState(3104, 0); + if (!QuestMinute) + return; + + Map::PlayerList const &PlayerList = instance->GetPlayers(); + if (PlayerList.isEmpty()) + return; + + Map::PlayerList::const_iterator i = PlayerList.begin(); + if (Player* i_pl = i->getSource()) + { + if (Unit* Hostage = i_pl->SummonCreature(HostageInfo[num].npc, HostageInfo[num].x, HostageInfo[num].y, HostageInfo[num].z, HostageInfo[num].o, TEMPSUMMON_DEAD_DESPAWN, 0)) + { + Hostage->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + Hostage->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + } } - CheckInstanceStatus(); - SaveToDB(); - } - } - uint32 GetData(uint32 type) - { - switch(type) - { - case DATA_NALORAKKEVENT: return m_auiEncounter[0]; - case DATA_AKILZONEVENT: return m_auiEncounter[1]; - case DATA_JANALAIEVENT: return m_auiEncounter[2]; - case DATA_HALAZZIEVENT: return m_auiEncounter[3]; - case DATA_HEXLORDEVENT: return m_auiEncounter[4]; - case DATA_ZULJINEVENT: return m_auiEncounter[5]; - case DATA_CHESTLOOTED: return ChestLooted; - case TYPE_RAND_VENDOR_1: return RandVendor[0]; - case TYPE_RAND_VENDOR_2: return RandVendor[1]; - default: return 0; - } - } + void CheckInstanceStatus() + { + if (BossKilled >= 4) + HandleGameObject(HexLordGateGUID, true); - void Update(uint32 diff) - { - if (QuestMinute) - { - if (QuestTimer <= diff) + if (BossKilled >= 5) + HandleGameObject(ZulJinGateGUID, true); + } + + std::string GetSaveData() + { + std::ostringstream ss; + ss << "S " << BossKilled << " " << ChestLooted << " " << QuestMinute; + char* data = new char[ss.str().length()+1]; + strcpy(data, ss.str().c_str()); + //sLog.outError("TSCR: Zul'aman saved, %s.", data); + return data; + } + + void Load(const char* load) + { + if (!load) return; + std::istringstream ss(load); + //sLog.outError("TSCR: Zul'aman loaded, %s.", ss.str().c_str()); + char dataHead; // S + uint16 data1, data2, data3; + ss >> dataHead >> data1 >> data2 >> data3; + //sLog.outError("TSCR: Zul'aman loaded, %d %d %d.", data1, data2, data3); + if (dataHead == 'S') + { + BossKilled = data1; + ChestLooted = data2; + QuestMinute = data3; + } else sLog.outError("TSCR: Zul'aman: corrupted save data."); + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_NALORAKKEVENT: + m_auiEncounter[0] = data; + if (data == DONE) + { + if (QuestMinute) + { + QuestMinute += 15; + DoUpdateWorldState(3106, QuestMinute); + } + SummonHostage(0); + } + break; + case DATA_AKILZONEVENT: + m_auiEncounter[1] = data; + HandleGameObject(AkilzonDoorGUID, data != IN_PROGRESS); + if (data == DONE) + { + if (QuestMinute) + { + QuestMinute += 10; + DoUpdateWorldState(3106, QuestMinute); + } + SummonHostage(1); + } + break; + case DATA_JANALAIEVENT: + m_auiEncounter[2] = data; + if (data == DONE) SummonHostage(2); + break; + case DATA_HALAZZIEVENT: + m_auiEncounter[3] = data; + HandleGameObject(HalazziDoorGUID, data != IN_PROGRESS); + if (data == DONE) SummonHostage(3); + break; + case DATA_HEXLORDEVENT: + m_auiEncounter[4] = data; + if (data == IN_PROGRESS) + HandleGameObject(HexLordGateGUID, false); + else if (data == NOT_STARTED) + CheckInstanceStatus(); + break; + case DATA_ZULJINEVENT: + m_auiEncounter[5] = data; + HandleGameObject(ZulJinDoorGUID, data != IN_PROGRESS); + break; + case DATA_CHESTLOOTED: + ++ChestLooted; + SaveToDB(); + break; + case TYPE_RAND_VENDOR_1: + RandVendor[0] = data; + break; + case TYPE_RAND_VENDOR_2: + RandVendor[1] = data; + break; + } + + if (data == DONE) + { + ++BossKilled; + if (QuestMinute && BossKilled >= 4) + { + QuestMinute = 0; + DoUpdateWorldState(3104, 0); + } + CheckInstanceStatus(); + SaveToDB(); + } + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_NALORAKKEVENT: return m_auiEncounter[0]; + case DATA_AKILZONEVENT: return m_auiEncounter[1]; + case DATA_JANALAIEVENT: return m_auiEncounter[2]; + case DATA_HALAZZIEVENT: return m_auiEncounter[3]; + case DATA_HEXLORDEVENT: return m_auiEncounter[4]; + case DATA_ZULJINEVENT: return m_auiEncounter[5]; + case DATA_CHESTLOOTED: return ChestLooted; + case TYPE_RAND_VENDOR_1: return RandVendor[0]; + case TYPE_RAND_VENDOR_2: return RandVendor[1]; + default: return 0; + } + } + + void Update(uint32 diff) { - QuestMinute--; - SaveToDB(); - QuestTimer += 60000; if (QuestMinute) { - DoUpdateWorldState(3104, 1); - DoUpdateWorldState(3106, QuestMinute); - } else DoUpdateWorldState(3104, 0); + if (QuestTimer <= diff) + { + QuestMinute--; + SaveToDB(); + QuestTimer += 60000; + if (QuestMinute) + { + DoUpdateWorldState(3104, 1); + DoUpdateWorldState(3106, QuestMinute); + } else DoUpdateWorldState(3104, 0); + } + QuestTimer -= diff; + } } - QuestTimer -= diff; + }; + + InstanceData* GetInstanceData(InstanceMap* pMap) const + { + return new instance_zulaman_InstanceMapScript(pMap); } - } }; -InstanceData* GetInstanceData_instance_zulaman(Map* pMap) -{ - return new instance_zulaman(pMap); -} - void AddSC_instance_zulaman() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_zulaman"; - newscript->GetInstanceData = &GetInstanceData_instance_zulaman; - newscript->RegisterSelf(); + new instance_zulaman(); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index c4a2ab4cf2a..4a4a5e06f76 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -38,64 +38,75 @@ EndContentData */ #define SPELL_PUSH_MOJO 43923 #define ENTRY_FOREST_FROG 24396 -struct npc_forest_frogAI : public ScriptedAI +class npc_forest_frog : public CreatureScript { - npc_forest_frogAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } + public: - ScriptedInstance *pInstance; - - void Reset() {} - - void EnterCombat(Unit * /*who*/) {} + npc_forest_frog() + : CreatureScript("npc_forest_frog") + { + } - void DoSpawnRandom() - { - if (pInstance) + struct npc_forest_frogAI : public ScriptedAI { - uint32 cEntry = 0; - switch(rand()%10) + npc_forest_frogAI(Creature* c) : ScriptedAI(c) { - case 0: cEntry = 24397; break; //Mannuth - case 1: cEntry = 24403; break; //Deez - case 2: cEntry = 24404; break; //Galathryn - case 3: cEntry = 24405; break; //Adarrah - case 4: cEntry = 24406; break; //Fudgerick - case 5: cEntry = 24407; break; //Darwen - case 6: cEntry = 24445; break; //Mitzi - case 7: cEntry = 24448; break; //Christian - case 8: cEntry = 24453; break; //Brennan - case 9: cEntry = 24455; break; //Hollee + pInstance = c->GetInstanceData(); } - if (!pInstance->GetData(TYPE_RAND_VENDOR_1)) - if (rand()%10 == 1) cEntry = 24408; //Gunter - if (!pInstance->GetData(TYPE_RAND_VENDOR_2)) - if (rand()%10 == 1) cEntry = 24409; //Kyren + ScriptedInstance *pInstance; - if (cEntry) me->UpdateEntry(cEntry); + void Reset() {} - if (cEntry == 24408) pInstance->SetData(TYPE_RAND_VENDOR_1,DONE); - if (cEntry == 24409) pInstance->SetData(TYPE_RAND_VENDOR_2,DONE); - } - } + void EnterCombat(Unit * /*who*/) {} + + void DoSpawnRandom() + { + if (pInstance) + { + uint32 cEntry = 0; + switch(rand()%10) + { + case 0: cEntry = 24397; break; //Mannuth + case 1: cEntry = 24403; break; //Deez + case 2: cEntry = 24404; break; //Galathryn + case 3: cEntry = 24405; break; //Adarrah + case 4: cEntry = 24406; break; //Fudgerick + case 5: cEntry = 24407; break; //Darwen + case 6: cEntry = 24445; break; //Mitzi + case 7: cEntry = 24448; break; //Christian + case 8: cEntry = 24453; break; //Brennan + case 9: cEntry = 24455; break; //Hollee + } + + if (!pInstance->GetData(TYPE_RAND_VENDOR_1)) + if (rand()%10 == 1) cEntry = 24408; //Gunter + if (!pInstance->GetData(TYPE_RAND_VENDOR_2)) + if (rand()%10 == 1) cEntry = 24409; //Kyren + + if (cEntry) me->UpdateEntry(cEntry); + + if (cEntry == 24408) pInstance->SetData(TYPE_RAND_VENDOR_1,DONE); + if (cEntry == 24409) pInstance->SetData(TYPE_RAND_VENDOR_2,DONE); + } + } + + void SpellHit(Unit *caster, const SpellEntry *spell) + { + if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->GetTypeId() == TYPEID_PLAYER && me->GetEntry() == ENTRY_FOREST_FROG) + { + //increase or decrease chance of mojo? + if (rand()%99 == 50) DoCast(caster, SPELL_PUSH_MOJO, true); + else DoSpawnRandom(); + } + } + }; - void SpellHit(Unit *caster, const SpellEntry *spell) - { - if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->GetTypeId() == TYPEID_PLAYER && me->GetEntry() == ENTRY_FOREST_FROG) + CreatureAI* GetAI(Creature* creature) const { - //increase or decrease chance of mojo? - if (rand()%99 == 50) DoCast(caster, SPELL_PUSH_MOJO, true); - else DoSpawnRandom(); + return new npc_forest_frogAI(creature); } - } }; -CreatureAI* GetAI_npc_forest_frog(Creature* pCreature) -{ - return new npc_forest_frogAI (pCreature); -} /*###### ## npc_zulaman_hostage @@ -106,89 +117,79 @@ CreatureAI* GetAI_npc_forest_frog(Creature* pCreature) static uint32 HostageEntry[] = {23790, 23999, 24024, 24001}; static uint32 ChestEntry[] = {186648, 187021, 186672, 186667}; -struct npc_zulaman_hostageAI : public ScriptedAI +class npc_zulaman_hostage : public CreatureScript { - npc_zulaman_hostageAI(Creature *c) : ScriptedAI(c) {IsLoot = false;} - bool IsLoot; - uint64 PlayerGUID; - void Reset() {} - void EnterCombat(Unit * /*who*/) {} - void JustDied(Unit* /*who*/) - { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (pPlayer) pPlayer->SendLoot(me->GetGUID(), LOOT_CORPSE); - } - void UpdateAI(const uint32 /*diff*/) - { - if (IsLoot) - DoCast(me, 7, false); - } -}; + public: -bool GossipHello_npc_zulaman_hostage(Player* pPlayer, Creature* pCreature) -{ - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HOSTAGE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + npc_zulaman_hostage() + : CreatureScript("npc_zulaman_hostage") + { + } -bool GossipSelect_npc_zulaman_hostage(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) - pPlayer->CLOSE_GOSSIP_MENU(); - - if (!pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - return true; - pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - if (pInstance) - { - //uint8 progress = pInstance->GetData(DATA_CHESTLOOTED); - pInstance->SetData(DATA_CHESTLOOTED, 0); - float x, y, z; - pCreature->GetPosition(x, y, z); - uint32 entry = pCreature->GetEntry(); - for (uint8 i = 0; i < 4; ++i) + struct npc_zulaman_hostageAI : public ScriptedAI { - if (HostageEntry[i] == entry) + npc_zulaman_hostageAI(Creature *c) : ScriptedAI(c) {IsLoot = false;} + bool IsLoot; + uint64 PlayerGUID; + void Reset() {} + void EnterCombat(Unit * /*who*/) {} + void JustDied(Unit* /*who*/) + { + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (pPlayer) pPlayer->SendLoot(me->GetGUID(), LOOT_CORPSE); + } + void UpdateAI(const uint32 /*diff*/) { - pCreature->SummonGameObject(ChestEntry[i], x-2, y, z, 0, 0, 0, 0, 0, 0); - break; + if (IsLoot) + DoCast(me, 7, false); } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_zulaman_hostageAI(creature); } - /*Creature* summon = pCreature->SummonCreature(HostageInfo[progress], x-2, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 0); - if (summon) + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - CAST_AI(npc_zulaman_hostageAI, summon->AI())->PlayerGUID = pPlayer->GetGUID(); - CAST_AI(npc_zulaman_hostageAI, summon->AI())->IsLoot = true; - summon->SetDisplayId(10056); - summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - summon->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - }*/ - } - return true; -} + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HOSTAGE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } -CreatureAI* GetAI_npc_zulaman_hostage(Creature* pCreature) -{ - return new npc_zulaman_hostageAI(pCreature); -} + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + pPlayer->CLOSE_GOSSIP_MENU(); + + if (!pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + return true; + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + + ScriptedInstance* pInstance = pCreature->GetInstanceData(); + if (pInstance) + { + //uint8 progress = pInstance->GetData(DATA_CHESTLOOTED); + pInstance->SetData(DATA_CHESTLOOTED, 0); + float x, y, z; + pCreature->GetPosition(x, y, z); + uint32 entry = pCreature->GetEntry(); + for (uint8 i = 0; i < 4; ++i) + { + if (HostageEntry[i] == entry) + { + pCreature->SummonGameObject(ChestEntry[i], x-2, y, z, 0, 0, 0, 0, 0, 0); + break; + } + } + } + return true; + } +}; void AddSC_zulaman() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_forest_frog"; - newscript->GetAI = &GetAI_npc_forest_frog; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_zulaman_hostage"; - newscript->GetAI = &GetAI_npc_zulaman_hostage; - newscript->pGossipHello = &GossipHello_npc_zulaman_hostage; - newscript->pGossipSelect = &GossipSelect_npc_zulaman_hostage; - newscript->RegisterSelf(); + new npc_forest_frog(); + new npc_zulaman_hostage(); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp index 80d6d76da4d..d20a124f5a0 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp @@ -26,26 +26,15 @@ EndScriptData */ #include "ScriptPCH.h" #include "zulgurub.h" -bool GOHello_go_gong_of_bethekk(Player* /*pPlayer*/, GameObject* pGo) -{ - if (ScriptedInstance* m_pInstance = pGo->GetInstanceData()) - { - if (m_pInstance->GetData(TYPE_ARLOKK) == DONE || m_pInstance->GetData(TYPE_ARLOKK) == IN_PROGRESS) - return true; - - m_pInstance->SetData(TYPE_ARLOKK, IN_PROGRESS); - return true; - } - - return true; -} - -enum eEnums +enum eYells { SAY_AGGRO = -1309011, SAY_FEAST_PANTHER = -1309012, SAY_DEATH = -1309013, +}; +enum eSpells +{ SPELL_SHADOWWORDPAIN = 23952, SPELL_GOUGE = 24698, SPELL_MARK = 24210, @@ -59,222 +48,245 @@ enum eEnums NPC_ZULIAN_PROWLER = 15101 }; -struct boss_arlokkAI : public ScriptedAI +class boss_arlokk : public CreatureScript { - boss_arlokkAI(Creature* pCreature) : ScriptedAI(pCreature) - { - m_pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* m_pInstance; - - uint32 m_uiShadowWordPain_Timer; - uint32 m_uiGouge_Timer; - uint32 m_uiMark_Timer; - uint32 m_uiCleave_Timer; - uint32 m_uiVanish_Timer; - uint32 m_uiVisible_Timer; - - uint32 m_uiSummon_Timer; - uint32 m_uiSummonCount; - - Unit* m_pMarkedTarget; - uint64 MarkedTargetGUID; - - bool m_bIsPhaseTwo; - bool m_bIsVanished; - - void Reset() - { - m_uiShadowWordPain_Timer = 8000; - m_uiGouge_Timer = 14000; - m_uiMark_Timer = 35000; - m_uiCleave_Timer = 4000; - m_uiVanish_Timer = 60000; - m_uiVisible_Timer = 6000; - - m_uiSummon_Timer = 5000; - m_uiSummonCount = 0; - - m_bIsPhaseTwo = false; - m_bIsVanished = false; - - MarkedTargetGUID = 0; - - me->SetDisplayId(MODEL_ID_NORMAL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - } - - void JustReachedHome() - { - if (m_pInstance) - m_pInstance->SetData(TYPE_ARLOKK, NOT_STARTED); - - //we should be summoned, so despawn - me->ForcedDespawn(); - } - - void JustDied(Unit* /*pKiller*/) - { - DoScriptText(SAY_DEATH, me); - - me->SetDisplayId(MODEL_ID_NORMAL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - - if (m_pInstance) - m_pInstance->SetData(TYPE_ARLOKK, DONE); - } - - void DoSummonPhanters() - { - if (Unit *pMarkedTarget = Unit::GetUnit(*me, MarkedTargetGUID)) - DoScriptText(SAY_FEAST_PANTHER, me, pMarkedTarget); - - me->SummonCreature(NPC_ZULIAN_PROWLER, -11532.7998, -1649.6734, 41.4800, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - me->SummonCreature(NPC_ZULIAN_PROWLER, -11532.9970, -1606.4840, 41.2979, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - } - - void JustSummoned(Creature* pSummoned) - { - if (Unit *pMarkedTarget = Unit::GetUnit(*me, MarkedTargetGUID)) - pSummoned->AI()->AttackStart(pMarkedTarget); - - ++m_uiSummonCount; - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - if (!m_bIsPhaseTwo) + public: + + boss_arlokk() + : CreatureScript("boss_arlokk") + { + } + + struct boss_arlokkAI : public ScriptedAI { - if (m_uiShadowWordPain_Timer <= uiDiff) + boss_arlokkAI(Creature* pCreature) : ScriptedAI(pCreature) { - DoCast(me->getVictim(), SPELL_SHADOWWORDPAIN); - m_uiShadowWordPain_Timer = 15000; + m_pInstance = pCreature->GetInstanceData(); } - else - m_uiShadowWordPain_Timer -= uiDiff; - if (m_uiMark_Timer <= uiDiff) + ScriptedInstance* m_pInstance; + + uint32 m_uiShadowWordPain_Timer; + uint32 m_uiGouge_Timer; + uint32 m_uiMark_Timer; + uint32 m_uiCleave_Timer; + uint32 m_uiVanish_Timer; + uint32 m_uiVisible_Timer; + + uint32 m_uiSummon_Timer; + uint32 m_uiSummonCount; + + Unit* m_pMarkedTarget; + uint64 MarkedTargetGUID; + + bool m_bIsPhaseTwo; + bool m_bIsVanished; + + void Reset() { - Unit *pMarkedTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + m_uiShadowWordPain_Timer = 8000; + m_uiGouge_Timer = 14000; + m_uiMark_Timer = 35000; + m_uiCleave_Timer = 4000; + m_uiVanish_Timer = 60000; + m_uiVisible_Timer = 6000; - if (pMarkedTarget) - { - DoCast(pMarkedTarget, SPELL_MARK); - MarkedTargetGUID = pMarkedTarget->GetGUID(); - } - else - sLog.outError("TSCR: boss_arlokk could not accuire pMarkedTarget."); + m_uiSummon_Timer = 5000; + m_uiSummonCount = 0; + + m_bIsPhaseTwo = false; + m_bIsVanished = false; - m_uiMark_Timer = 15000; + MarkedTargetGUID = 0; + + me->SetDisplayId(MODEL_ID_NORMAL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - else - m_uiMark_Timer -= uiDiff; - } - else - { - //Cleave_Timer - if (m_uiCleave_Timer <= uiDiff) + + void EnterCombat(Unit* /*pWho*/) { - DoCast(me->getVictim(), SPELL_CLEAVE); - m_uiCleave_Timer = 16000; + DoScriptText(SAY_AGGRO, me); } - else - m_uiCleave_Timer -= uiDiff; - //Gouge_Timer - if (m_uiGouge_Timer <= uiDiff) + void JustReachedHome() { - DoCast(me->getVictim(), SPELL_GOUGE); + if (m_pInstance) + m_pInstance->SetData(TYPE_ARLOKK, NOT_STARTED); - DoModifyThreatPercent(me->getVictim(),-80); - - m_uiGouge_Timer = 17000+rand()%10000; + //we should be summoned, so despawn + me->ForcedDespawn(); } - else - m_uiGouge_Timer -= uiDiff; - } - if (m_uiSummonCount <= 30) - { - if (m_uiSummon_Timer <= uiDiff) + void JustDied(Unit* /*pKiller*/) { - DoSummonPhanters(); - m_uiSummon_Timer = 5000; + DoScriptText(SAY_DEATH, me); + + me->SetDisplayId(MODEL_ID_NORMAL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + if (m_pInstance) + m_pInstance->SetData(TYPE_ARLOKK, DONE); } - else - m_uiSummon_Timer -= uiDiff; - } - if (m_uiVanish_Timer <= uiDiff) - { - //Invisble Model - me->SetDisplayId(MODEL_ID_BLANK); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + void DoSummonPhanters() + { + if (Unit *pMarkedTarget = Unit::GetUnit(*me, MarkedTargetGUID)) + DoScriptText(SAY_FEAST_PANTHER, me, pMarkedTarget); - me->AttackStop(); - DoResetThreat(); + me->SummonCreature(NPC_ZULIAN_PROWLER, -11532.7998, -1649.6734, 41.4800, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + me->SummonCreature(NPC_ZULIAN_PROWLER, -11532.9970, -1606.4840, 41.2979, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + } - m_bIsVanished = true; + void JustSummoned(Creature* pSummoned) + { + if (Unit *pMarkedTarget = Unit::GetUnit(*me, MarkedTargetGUID)) + pSummoned->AI()->AttackStart(pMarkedTarget); - m_uiVanish_Timer = 45000; - m_uiVisible_Timer = 6000; - } - else - m_uiVanish_Timer -= uiDiff; + ++m_uiSummonCount; + } - if (m_bIsVanished) - { - if (m_uiVisible_Timer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - //The Panther Model - me->SetDisplayId(MODEL_ID_PANTHER); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (!UpdateVictim()) + return; + + if (!m_bIsPhaseTwo) + { + if (m_uiShadowWordPain_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_SHADOWWORDPAIN); + m_uiShadowWordPain_Timer = 15000; + } + else + m_uiShadowWordPain_Timer -= uiDiff; + + if (m_uiMark_Timer <= uiDiff) + { + Unit *pMarkedTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + + if (pMarkedTarget) + { + DoCast(pMarkedTarget, SPELL_MARK); + MarkedTargetGUID = pMarkedTarget->GetGUID(); + } + else + sLog.outError("TSCR: boss_arlokk could not accuire pMarkedTarget."); + + m_uiMark_Timer = 15000; + } + else + m_uiMark_Timer -= uiDiff; + } + else + { + //Cleave_Timer + if (m_uiCleave_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + m_uiCleave_Timer = 16000; + } + else + m_uiCleave_Timer -= uiDiff; + + //Gouge_Timer + if (m_uiGouge_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_GOUGE); + + DoModifyThreatPercent(me->getVictim(),-80); + + m_uiGouge_Timer = 17000+rand()%10000; + } + else + m_uiGouge_Timer -= uiDiff; + } - const CreatureInfo *cinfo = me->GetCreatureInfo(); - me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); - me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); - me->UpdateDamagePhysical(BASE_ATTACK); + if (m_uiSummonCount <= 30) + { + if (m_uiSummon_Timer <= uiDiff) + { + DoSummonPhanters(); + m_uiSummon_Timer = 5000; + } + else + m_uiSummon_Timer -= uiDiff; + } - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - AttackStart(pTarget); + if (m_uiVanish_Timer <= uiDiff) + { + //Invisble Model + me->SetDisplayId(MODEL_ID_BLANK); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_bIsPhaseTwo = true; - m_bIsVanished = false; + me->AttackStop(); + DoResetThreat(); + + m_bIsVanished = true; + + m_uiVanish_Timer = 45000; + m_uiVisible_Timer = 6000; + } + else + m_uiVanish_Timer -= uiDiff; + + if (m_bIsVanished) + { + if (m_uiVisible_Timer <= uiDiff) + { + //The Panther Model + me->SetDisplayId(MODEL_ID_PANTHER); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + const CreatureInfo *cinfo = me->GetCreatureInfo(); + me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); + me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); + me->UpdateDamagePhysical(BASE_ATTACK); + + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + AttackStart(pTarget); + + m_bIsPhaseTwo = true; + m_bIsVanished = false; + } + else + m_uiVisible_Timer -= uiDiff; + } + else + DoMeleeAttackIfReady(); } - else - m_uiVisible_Timer -= uiDiff; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_arlokkAI(creature); } - else - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_arlokk(Creature* pCreature) +class go_gong_of_bethekk : public GameObjectScript { - return new boss_arlokkAI (pCreature); -} + public: + go_gong_of_bethekk() : GameObjectScript("go_gong_of_bethekk") + { + } -void AddSC_boss_arlokk() -{ - Script *newscript; + bool OnGossipHello(Player* /*pPlayer*/, GameObject* pGo) + { + if (ScriptedInstance* m_pInstance = pGo->GetInstanceData()) + { + if (m_pInstance->GetData(TYPE_ARLOKK) == DONE || m_pInstance->GetData(TYPE_ARLOKK) == IN_PROGRESS) + return true; - newscript = new Script; - newscript->Name = "go_gong_of_bethekk"; - newscript->pGOHello = &GOHello_go_gong_of_bethekk; - newscript->RegisterSelf(); + m_pInstance->SetData(TYPE_ARLOKK, IN_PROGRESS); + return true; + } - newscript = new Script; - newscript->Name = "boss_arlokk"; - newscript->GetAI = &GetAI_boss_arlokk; - newscript->RegisterSelf(); + return true; + } +}; + +void AddSC_boss_arlokk() +{ + new boss_arlokk(); + new go_gong_of_bethekk(); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp index ee65b4f5e61..dc22a746e48 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp @@ -29,67 +29,74 @@ EndScriptData */ #define SPELL_MASSIVEGEYSER 22421 //Not working. Cause its a summon... #define SPELL_SLAM 24326 -struct boss_gahzrankaAI : public ScriptedAI +class boss_gahzranka : public CreatureScript { - boss_gahzrankaAI(Creature *c) : ScriptedAI(c) {} - uint32 Frostbreath_Timer; - uint32 MassiveGeyser_Timer; - uint32 Slam_Timer; - - void Reset() - { - Frostbreath_Timer = 8000; - MassiveGeyser_Timer = 25000; - Slam_Timer = 17000; - } - - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Frostbreath_Timer - if (Frostbreath_Timer <= diff) + public: + + boss_gahzranka() + : CreatureScript("boss_gahzranka") { - DoCast(me->getVictim(), SPELL_FROSTBREATH); - Frostbreath_Timer = 7000 + rand()%4000; - } else Frostbreath_Timer -= diff; + } - //MassiveGeyser_Timer - if (MassiveGeyser_Timer <= diff) + struct boss_gahzrankaAI : public ScriptedAI { - DoCast(me->getVictim(), SPELL_MASSIVEGEYSER); - DoResetThreat(); + boss_gahzrankaAI(Creature *c) : ScriptedAI(c) {} + uint32 Frostbreath_Timer; + uint32 MassiveGeyser_Timer; + uint32 Slam_Timer; - MassiveGeyser_Timer = 22000 + rand()%10000; - } else MassiveGeyser_Timer -= diff; + void Reset() + { + Frostbreath_Timer = 8000; + MassiveGeyser_Timer = 25000; + Slam_Timer = 17000; + } - //Slam_Timer - if (Slam_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SLAM); - Slam_Timer = 12000 + rand()%8000; - } else Slam_Timer -= diff; + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Frostbreath_Timer + if (Frostbreath_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROSTBREATH); + Frostbreath_Timer = 7000 + rand()%4000; + } else Frostbreath_Timer -= diff; + + //MassiveGeyser_Timer + if (MassiveGeyser_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MASSIVEGEYSER); + DoResetThreat(); + + MassiveGeyser_Timer = 22000 + rand()%10000; + } else MassiveGeyser_Timer -= diff; - DoMeleeAttackIfReady(); - } + //Slam_Timer + if (Slam_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SLAM); + Slam_Timer = 12000 + rand()%8000; + } else Slam_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_gahzrankaAI(creature); + } }; -CreatureAI* GetAI_boss_gahzranka(Creature* pCreature) -{ - return new boss_gahzrankaAI (pCreature); -} void AddSC_boss_gahzranka() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_gahzranka"; - newscript->GetAI = &GetAI_boss_gahzranka; - newscript->RegisterSelf(); + new boss_gahzranka(); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp index e2914b1e8e0..b09d1626db1 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp @@ -29,67 +29,74 @@ EndScriptData */ #define SPELL_AVARTAR 24646 //The Enrage Spell #define SPELL_GROUNDTREMOR 6524 -struct boss_grilekAI : public ScriptedAI +class boss_grilek : public CreatureScript { - boss_grilekAI(Creature *c) : ScriptedAI(c) {} + public: - uint32 Avartar_Timer; - uint32 GroundTremor_Timer; + boss_grilek() + : CreatureScript("boss_grilek") + { + } - void Reset() - { - Avartar_Timer = 15000 + rand()%10000; - GroundTremor_Timer = 8000 + rand()%8000; - } + struct boss_grilekAI : public ScriptedAI + { + boss_grilekAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit * /*who*/) - { - } + uint32 Avartar_Timer; + uint32 GroundTremor_Timer; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void Reset() + { + Avartar_Timer = 15000 + rand()%10000; + GroundTremor_Timer = 8000 + rand()%8000; + } - //Avartar_Timer - if (Avartar_Timer <= diff) - { + void EnterCombat(Unit * /*who*/) + { + } - DoCast(me, SPELL_AVARTAR); - Unit *pTarget = NULL; + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + //Avartar_Timer + if (Avartar_Timer <= diff) + { - if (DoGetThreat(me->getVictim())) - DoModifyThreatPercent(me->getVictim(),-50); - if (pTarget) - AttackStart(pTarget); + DoCast(me, SPELL_AVARTAR); + Unit *pTarget = NULL; - Avartar_Timer = 25000 + rand()%10000; - } else Avartar_Timer -= diff; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); - //GroundTremor_Timer - if (GroundTremor_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_GROUNDTREMOR); - GroundTremor_Timer = 12000 + rand()%4000; - } else GroundTremor_Timer -= diff; + if (DoGetThreat(me->getVictim())) + DoModifyThreatPercent(me->getVictim(),-50); + if (pTarget) + AttackStart(pTarget); + + Avartar_Timer = 25000 + rand()%10000; + } else Avartar_Timer -= diff; - DoMeleeAttackIfReady(); - } + //GroundTremor_Timer + if (GroundTremor_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_GROUNDTREMOR); + GroundTremor_Timer = 12000 + rand()%4000; + } else GroundTremor_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_grilekAI(creature); + } }; -CreatureAI* GetAI_boss_grilek(Creature* pCreature) -{ - return new boss_grilekAI (pCreature); -} void AddSC_boss_grilek() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_grilek"; - newscript->GetAI = &GetAI_boss_grilek; - newscript->RegisterSelf(); + new boss_grilek(); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp index 8ed073c56d3..680a68f773a 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp @@ -44,209 +44,215 @@ EndScriptData */ #define SPELL_ASPECT_OF_THEKAL 24689 #define SPELL_ASPECT_OF_ARLOKK 24690 -struct boss_hakkarAI : public ScriptedAI +class boss_hakkar : public CreatureScript { - boss_hakkarAI(Creature *c) : ScriptedAI(c) - { - m_pInstance = c->GetInstanceData(); - } - - ScriptedInstance *m_pInstance; - - uint32 BloodSiphon_Timer; - uint32 CorruptedBlood_Timer; - uint32 CauseInsanity_Timer; - uint32 WillOfHakkar_Timer; - uint32 Enrage_Timer; - - uint32 CheckJeklik_Timer; - uint32 CheckVenoxis_Timer; - uint32 CheckMarli_Timer; - uint32 CheckThekal_Timer; - uint32 CheckArlokk_Timer; - - uint32 AspectOfJeklik_Timer; - uint32 AspectOfVenoxis_Timer; - uint32 AspectOfMarli_Timer; - uint32 AspectOfThekal_Timer; - uint32 AspectOfArlokk_Timer; - - bool Enraged; - - void Reset() - { - BloodSiphon_Timer = 90000; - CorruptedBlood_Timer = 25000; - CauseInsanity_Timer = 17000; - WillOfHakkar_Timer = 17000; - Enrage_Timer = 600000; - - CheckJeklik_Timer = 1000; - CheckVenoxis_Timer = 2000; - CheckMarli_Timer = 3000; - CheckThekal_Timer = 4000; - CheckArlokk_Timer = 5000; - - AspectOfJeklik_Timer = 4000; - AspectOfVenoxis_Timer = 7000; - AspectOfMarli_Timer = 12000; - AspectOfThekal_Timer = 8000; - AspectOfArlokk_Timer = 18000; - - Enraged = false; - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //BloodSiphon_Timer - if (BloodSiphon_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_BLOODSIPHON); - BloodSiphon_Timer = 90000; - } else BloodSiphon_Timer -= diff; + public: - //CorruptedBlood_Timer - if (CorruptedBlood_Timer <= diff) + boss_hakkar() + : CreatureScript("boss_hakkar") { - DoCast(me->getVictim(), SPELL_CORRUPTEDBLOOD); - CorruptedBlood_Timer = 30000 + rand()%15000; - } else CorruptedBlood_Timer -= diff; + } - //CauseInsanity_Timer - /*if (CauseInsanity_Timer <= diff) + struct boss_hakkarAI : public ScriptedAI { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_CAUSEINSANITY); + boss_hakkarAI(Creature *c) : ScriptedAI(c) + { + m_pInstance = c->GetInstanceData(); + } - CauseInsanity_Timer = 35000 + rand()%8000; - } else CauseInsanity_Timer -= diff;*/ + ScriptedInstance *m_pInstance; - //WillOfHakkar_Timer - if (WillOfHakkar_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_WILLOFHAKKAR); + uint32 BloodSiphon_Timer; + uint32 CorruptedBlood_Timer; + uint32 CauseInsanity_Timer; + uint32 WillOfHakkar_Timer; + uint32 Enrage_Timer; - WillOfHakkar_Timer = 25000 + rand()%10000; - } else WillOfHakkar_Timer -= diff; + uint32 CheckJeklik_Timer; + uint32 CheckVenoxis_Timer; + uint32 CheckMarli_Timer; + uint32 CheckThekal_Timer; + uint32 CheckArlokk_Timer; - if (!Enraged && Enrage_Timer <= diff) - { - DoCast(me, SPELL_ENRAGE); - Enraged = true; - } else Enrage_Timer -= diff; + uint32 AspectOfJeklik_Timer; + uint32 AspectOfVenoxis_Timer; + uint32 AspectOfMarli_Timer; + uint32 AspectOfThekal_Timer; + uint32 AspectOfArlokk_Timer; - //Checking if Jeklik is dead. If not we cast her Aspect - if (CheckJeklik_Timer <= diff) - { - if (m_pInstance) + bool Enraged; + + void Reset() { - if (m_pInstance->GetData(TYPE_JEKLIK) != DONE) - { - if (AspectOfJeklik_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ASPECT_OF_JEKLIK); - AspectOfJeklik_Timer = 10000 + rand()%4000; - } else AspectOfJeklik_Timer -= diff; - } + BloodSiphon_Timer = 90000; + CorruptedBlood_Timer = 25000; + CauseInsanity_Timer = 17000; + WillOfHakkar_Timer = 17000; + Enrage_Timer = 600000; + + CheckJeklik_Timer = 1000; + CheckVenoxis_Timer = 2000; + CheckMarli_Timer = 3000; + CheckThekal_Timer = 4000; + CheckArlokk_Timer = 5000; + + AspectOfJeklik_Timer = 4000; + AspectOfVenoxis_Timer = 7000; + AspectOfMarli_Timer = 12000; + AspectOfThekal_Timer = 8000; + AspectOfArlokk_Timer = 18000; + + Enraged = false; } - CheckJeklik_Timer = 1000; - } else CheckJeklik_Timer -= diff; - //Checking if Venoxis is dead. If not we cast his Aspect - if (CheckVenoxis_Timer <= diff) - { - if (m_pInstance) + void EnterCombat(Unit * /*who*/) { - if (m_pInstance->GetData(TYPE_VENOXIS) != DONE) - { - if (AspectOfVenoxis_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ASPECT_OF_VENOXIS); - AspectOfVenoxis_Timer = 8000; - } else AspectOfVenoxis_Timer -= diff; - } + DoScriptText(SAY_AGGRO, me); } - CheckVenoxis_Timer = 1000; - } else CheckVenoxis_Timer -= diff; - //Checking if Marli is dead. If not we cast her Aspect - if (CheckMarli_Timer <= diff) - { - if (m_pInstance) + void UpdateAI(const uint32 diff) { - if (m_pInstance->GetData(TYPE_MARLI) != DONE) + if (!UpdateVictim()) + return; + + //BloodSiphon_Timer + if (BloodSiphon_Timer <= diff) { - if (AspectOfMarli_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ASPECT_OF_MARLI); - AspectOfMarli_Timer = 10000; - } else AspectOfMarli_Timer -= diff; + DoCast(me->getVictim(), SPELL_BLOODSIPHON); + BloodSiphon_Timer = 90000; + } else BloodSiphon_Timer -= diff; - } - } - CheckMarli_Timer = 1000; - } else CheckMarli_Timer -= diff; + //CorruptedBlood_Timer + if (CorruptedBlood_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CORRUPTEDBLOOD); + CorruptedBlood_Timer = 30000 + rand()%15000; + } else CorruptedBlood_Timer -= diff; - //Checking if Thekal is dead. If not we cast his Aspect - if (CheckThekal_Timer <= diff) - { - if (m_pInstance) - { - if (m_pInstance->GetData(TYPE_THEKAL) != DONE) + //CauseInsanity_Timer + /*if (CauseInsanity_Timer <= diff) { - if (AspectOfThekal_Timer <= diff) - { - DoCast(me, SPELL_ASPECT_OF_THEKAL); - AspectOfThekal_Timer = 15000; - } else AspectOfThekal_Timer -= diff; - } - } - CheckThekal_Timer = 1000; - } else CheckThekal_Timer -= diff; + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_CAUSEINSANITY); - //Checking if Arlokk is dead. If yes we cast her Aspect - if (CheckArlokk_Timer <= diff) - { - if (m_pInstance) - { - if (m_pInstance->GetData(TYPE_ARLOKK) != DONE) + CauseInsanity_Timer = 35000 + rand()%8000; + } else CauseInsanity_Timer -= diff;*/ + + //WillOfHakkar_Timer + if (WillOfHakkar_Timer <= diff) { - if (AspectOfArlokk_Timer <= diff) - { - DoCast(me, SPELL_ASPECT_OF_ARLOKK); - DoResetThreat(); + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_WILLOFHAKKAR); - AspectOfArlokk_Timer = 10000 + rand()%5000; - } else AspectOfArlokk_Timer -= diff; - } - } - CheckArlokk_Timer = 1000; - } else CheckArlokk_Timer -= diff; + WillOfHakkar_Timer = 25000 + rand()%10000; + } else WillOfHakkar_Timer -= diff; - DoMeleeAttackIfReady(); - } -}; + if (!Enraged && Enrage_Timer <= diff) + { + DoCast(me, SPELL_ENRAGE); + Enraged = true; + } else Enrage_Timer -= diff; -CreatureAI* GetAI_boss_hakkar(Creature* pCreature) -{ - return new boss_hakkarAI (pCreature); -} + //Checking if Jeklik is dead. If not we cast her Aspect + if (CheckJeklik_Timer <= diff) + { + if (m_pInstance) + { + if (m_pInstance->GetData(TYPE_JEKLIK) != DONE) + { + if (AspectOfJeklik_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ASPECT_OF_JEKLIK); + AspectOfJeklik_Timer = 10000 + rand()%4000; + } else AspectOfJeklik_Timer -= diff; + } + } + CheckJeklik_Timer = 1000; + } else CheckJeklik_Timer -= diff; + + //Checking if Venoxis is dead. If not we cast his Aspect + if (CheckVenoxis_Timer <= diff) + { + if (m_pInstance) + { + if (m_pInstance->GetData(TYPE_VENOXIS) != DONE) + { + if (AspectOfVenoxis_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ASPECT_OF_VENOXIS); + AspectOfVenoxis_Timer = 8000; + } else AspectOfVenoxis_Timer -= diff; + } + } + CheckVenoxis_Timer = 1000; + } else CheckVenoxis_Timer -= diff; + + //Checking if Marli is dead. If not we cast her Aspect + if (CheckMarli_Timer <= diff) + { + if (m_pInstance) + { + if (m_pInstance->GetData(TYPE_MARLI) != DONE) + { + if (AspectOfMarli_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ASPECT_OF_MARLI); + AspectOfMarli_Timer = 10000; + } else AspectOfMarli_Timer -= diff; + + } + } + CheckMarli_Timer = 1000; + } else CheckMarli_Timer -= diff; + + //Checking if Thekal is dead. If not we cast his Aspect + if (CheckThekal_Timer <= diff) + { + if (m_pInstance) + { + if (m_pInstance->GetData(TYPE_THEKAL) != DONE) + { + if (AspectOfThekal_Timer <= diff) + { + DoCast(me, SPELL_ASPECT_OF_THEKAL); + AspectOfThekal_Timer = 15000; + } else AspectOfThekal_Timer -= diff; + } + } + CheckThekal_Timer = 1000; + } else CheckThekal_Timer -= diff; + + //Checking if Arlokk is dead. If yes we cast her Aspect + if (CheckArlokk_Timer <= diff) + { + if (m_pInstance) + { + if (m_pInstance->GetData(TYPE_ARLOKK) != DONE) + { + if (AspectOfArlokk_Timer <= diff) + { + DoCast(me, SPELL_ASPECT_OF_ARLOKK); + DoResetThreat(); + + AspectOfArlokk_Timer = 10000 + rand()%5000; + } else AspectOfArlokk_Timer -= diff; + } + } + CheckArlokk_Timer = 1000; + } else CheckArlokk_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_hakkarAI(creature); + } +}; void AddSC_boss_hakkar() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_hakkar"; - newscript->GetAI = &GetAI_boss_hakkar; - newscript->RegisterSelf(); + new boss_hakkar(); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp index a079a451f43..24de32a2f2e 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp @@ -29,78 +29,85 @@ EndScriptData */ #define SPELL_MANABURN 26046 #define SPELL_SLEEP 24664 -struct boss_hazzarahAI : public ScriptedAI +class boss_hazzarah : public CreatureScript { - boss_hazzarahAI(Creature *c) : ScriptedAI(c) {} - - uint32 ManaBurn_Timer; - uint32 Sleep_Timer; - uint32 Illusions_Timer; - - void Reset() - { - ManaBurn_Timer = 4000 + rand()%6000; - Sleep_Timer = 10000 + rand()%8000; - Illusions_Timer = 10000 + rand()%8000; - } - - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //ManaBurn_Timer - if (ManaBurn_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MANABURN); - ManaBurn_Timer = 8000 + rand()%8000; - } else ManaBurn_Timer -= diff; + public: - //Sleep_Timer - if (Sleep_Timer <= diff) + boss_hazzarah() + : CreatureScript("boss_hazzarah") { - DoCast(me->getVictim(), SPELL_SLEEP); - Sleep_Timer = 12000 + rand()%8000; - } else Sleep_Timer -= diff; + } - //Illusions_Timer - if (Illusions_Timer <= diff) + struct boss_hazzarahAI : public ScriptedAI { - //We will summon 3 illusions that will spawn on a random gamer and attack this gamer - //We will just use one model for the beginning - Unit *pTarget = NULL; - for (uint8 i = 0; i < 3; ++i) + boss_hazzarahAI(Creature *c) : ScriptedAI(c) {} + + uint32 ManaBurn_Timer; + uint32 Sleep_Timer; + uint32 Illusions_Timer; + + void Reset() { - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (!pTarget) - return; + ManaBurn_Timer = 4000 + rand()%6000; + Sleep_Timer = 10000 + rand()%8000; + Illusions_Timer = 10000 + rand()%8000; + } - Creature *Illusion = me->SummonCreature(15163,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,30000); - if (Illusion) - Illusion->AI()->AttackStart(pTarget); + void EnterCombat(Unit * /*who*/) + { } - Illusions_Timer = 15000 + rand()%10000; - } else Illusions_Timer -= diff; + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //ManaBurn_Timer + if (ManaBurn_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MANABURN); + ManaBurn_Timer = 8000 + rand()%8000; + } else ManaBurn_Timer -= diff; + + //Sleep_Timer + if (Sleep_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SLEEP); + Sleep_Timer = 12000 + rand()%8000; + } else Sleep_Timer -= diff; + + //Illusions_Timer + if (Illusions_Timer <= diff) + { + //We will summon 3 illusions that will spawn on a random gamer and attack this gamer + //We will just use one model for the beginning + Unit *pTarget = NULL; + for (uint8 i = 0; i < 3; ++i) + { + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (!pTarget) + return; + + Creature *Illusion = me->SummonCreature(15163,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,30000); + if (Illusion) + Illusion->AI()->AttackStart(pTarget); + } + + Illusions_Timer = 15000 + rand()%10000; + } else Illusions_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_hazzarahAI(creature); + } }; -CreatureAI* GetAI_boss_hazzarah(Creature* pCreature) -{ - return new boss_hazzarahAI (pCreature); -} void AddSC_boss_hazzarah() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_hazzarah"; - newscript->GetAI = &GetAI_boss_hazzarah; - newscript->RegisterSelf(); + new boss_hazzarah(); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp index 3642ffa6a1b..34340ba7896 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp @@ -43,251 +43,263 @@ EndScriptData */ #define SPELL_BOMB 40332 //Wrong ID but Magmadars bomb is not working... -struct boss_jeklikAI : public ScriptedAI +class boss_jeklik : public CreatureScript { - boss_jeklikAI(Creature *c) : ScriptedAI(c) - { - m_pInstance = c->GetInstanceData(); - } - - ScriptedInstance *m_pInstance; - - uint32 Charge_Timer; - uint32 SonicBurst_Timer; - uint32 Screech_Timer; - uint32 SpawnBats_Timer; - uint32 ShadowWordPain_Timer; - uint32 MindFlay_Timer; - uint32 ChainMindFlay_Timer; - uint32 GreaterHeal_Timer; - uint32 SpawnFlyingBats_Timer; - - bool PhaseTwo; - - void Reset() - { - Charge_Timer = 20000; - SonicBurst_Timer = 8000; - Screech_Timer = 13000; - SpawnBats_Timer = 60000; - ShadowWordPain_Timer = 6000; - MindFlay_Timer = 11000; - ChainMindFlay_Timer = 26000; - GreaterHeal_Timer = 50000; - SpawnFlyingBats_Timer = 10000; - - PhaseTwo = false; - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - DoCast(me, SPELL_BAT_FORM); - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (m_pInstance) - m_pInstance->SetData(TYPE_JEKLIK, DONE); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (me->getVictim() && me->isAlive()) - { - if ((me->GetHealth()*100 / me->GetMaxHealth() > 50)) - { - if (Charge_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - { - DoCast(pTarget, SPELL_CHARGE); - AttackStart(pTarget); - } + public: - Charge_Timer = 15000 + rand()%15000; - } else Charge_Timer -= diff; - - if (SonicBurst_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SONICBURST); - SonicBurst_Timer = 8000 + rand()%5000; - } else SonicBurst_Timer -= diff; + boss_jeklik() + : CreatureScript("boss_jeklik") + { + } - if (Screech_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SCREECH); - Screech_Timer = 18000 + rand()%8000; - } else Screech_Timer -= diff; + struct boss_jeklikAI : public ScriptedAI + { + boss_jeklikAI(Creature *c) : ScriptedAI(c) + { + m_pInstance = c->GetInstanceData(); + } - if (SpawnBats_Timer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + ScriptedInstance *m_pInstance; - Creature* Bat = NULL; - Bat = me->SummonCreature(11368,-12291.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (pTarget && Bat) Bat ->AI()->AttackStart(pTarget); + uint32 Charge_Timer; + uint32 SonicBurst_Timer; + uint32 Screech_Timer; + uint32 SpawnBats_Timer; + uint32 ShadowWordPain_Timer; + uint32 MindFlay_Timer; + uint32 ChainMindFlay_Timer; + uint32 GreaterHeal_Timer; + uint32 SpawnFlyingBats_Timer; - Bat = me->SummonCreature(11368,-12289.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (pTarget && Bat) Bat ->AI()->AttackStart(pTarget); + bool PhaseTwo; - Bat = me->SummonCreature(11368,-12293.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (pTarget && Bat) Bat ->AI()->AttackStart(pTarget); + void Reset() + { + Charge_Timer = 20000; + SonicBurst_Timer = 8000; + Screech_Timer = 13000; + SpawnBats_Timer = 60000; + ShadowWordPain_Timer = 6000; + MindFlay_Timer = 11000; + ChainMindFlay_Timer = 26000; + GreaterHeal_Timer = 50000; + SpawnFlyingBats_Timer = 10000; + + PhaseTwo = false; + } - Bat = me->SummonCreature(11368,-12291.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (pTarget && Bat) Bat ->AI()->AttackStart(pTarget); + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + DoCast(me, SPELL_BAT_FORM); + } - Bat = me->SummonCreature(11368,-12289.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (pTarget && Bat) Bat ->AI()->AttackStart(pTarget); - Bat = me->SummonCreature(11368,-12293.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (pTarget && Bat) Bat ->AI()->AttackStart(pTarget); + void JustDied(Unit* /*Killer*/) + { + DoScriptText(SAY_DEATH, me); - SpawnBats_Timer = 60000; - } else SpawnBats_Timer -= diff; + if (m_pInstance) + m_pInstance->SetData(TYPE_JEKLIK, DONE); } - else + + void UpdateAI(const uint32 diff) { - if (PhaseTwo) + if (!UpdateVictim()) + return; + + if (me->getVictim() && me->isAlive()) { - if (PhaseTwo && ShadowWordPain_Timer <= diff) + if ((me->GetHealth()*100 / me->GetMaxHealth() > 50)) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (Charge_Timer <= diff) { - DoCast(pTarget, SPELL_SHADOW_WORD_PAIN); - ShadowWordPain_Timer = 12000 + rand()%6000; - } - }ShadowWordPain_Timer -=diff; + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + DoCast(pTarget, SPELL_CHARGE); + AttackStart(pTarget); + } - if (MindFlay_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MIND_FLAY); - MindFlay_Timer = 16000; - }MindFlay_Timer -=diff; + Charge_Timer = 15000 + rand()%15000; + } else Charge_Timer -= diff; - if (ChainMindFlay_Timer <= diff) - { - me->InterruptNonMeleeSpells(false); - DoCast(me->getVictim(), SPELL_CHAIN_MIND_FLAY); - ChainMindFlay_Timer = 15000 + rand()%15000; - }ChainMindFlay_Timer -=diff; + if (SonicBurst_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SONICBURST); + SonicBurst_Timer = 8000 + rand()%5000; + } else SonicBurst_Timer -= diff; - if (GreaterHeal_Timer <= diff) - { - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_GREATERHEAL); - GreaterHeal_Timer = 25000 + rand()%10000; - }GreaterHeal_Timer -=diff; + if (Screech_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SCREECH); + Screech_Timer = 18000 + rand()%8000; + } else Screech_Timer -= diff; - if (SpawnFlyingBats_Timer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (!pTarget) - return; + if (SpawnBats_Timer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - Creature* FlyingBat = me->SummonCreature(14965, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ()+15, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (FlyingBat) - FlyingBat->AI()->AttackStart(pTarget); + Creature* Bat = NULL; + Bat = me->SummonCreature(11368,-12291.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (pTarget && Bat) Bat ->AI()->AttackStart(pTarget); - SpawnFlyingBats_Timer = 10000 + rand()%5000; - } else SpawnFlyingBats_Timer -=diff; - } - else - { - me->SetDisplayId(15219); - DoResetThreat(); - PhaseTwo = true; + Bat = me->SummonCreature(11368,-12289.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (pTarget && Bat) Bat ->AI()->AttackStart(pTarget); + + Bat = me->SummonCreature(11368,-12293.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (pTarget && Bat) Bat ->AI()->AttackStart(pTarget); + + Bat = me->SummonCreature(11368,-12291.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (pTarget && Bat) Bat ->AI()->AttackStart(pTarget); + + Bat = me->SummonCreature(11368,-12289.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (pTarget && Bat) Bat ->AI()->AttackStart(pTarget); + Bat = me->SummonCreature(11368,-12293.6220,-1380.2640,144.8304,5.483, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (pTarget && Bat) Bat ->AI()->AttackStart(pTarget); + + SpawnBats_Timer = 60000; + } else SpawnBats_Timer -= diff; + } + else + { + if (PhaseTwo) + { + if (PhaseTwo && ShadowWordPain_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + DoCast(pTarget, SPELL_SHADOW_WORD_PAIN); + ShadowWordPain_Timer = 12000 + rand()%6000; + } + }ShadowWordPain_Timer -=diff; + + if (MindFlay_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MIND_FLAY); + MindFlay_Timer = 16000; + }MindFlay_Timer -=diff; + + if (ChainMindFlay_Timer <= diff) + { + me->InterruptNonMeleeSpells(false); + DoCast(me->getVictim(), SPELL_CHAIN_MIND_FLAY); + ChainMindFlay_Timer = 15000 + rand()%15000; + }ChainMindFlay_Timer -=diff; + + if (GreaterHeal_Timer <= diff) + { + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_GREATERHEAL); + GreaterHeal_Timer = 25000 + rand()%10000; + }GreaterHeal_Timer -=diff; + + if (SpawnFlyingBats_Timer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (!pTarget) + return; + + Creature* FlyingBat = me->SummonCreature(14965, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ()+15, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (FlyingBat) + FlyingBat->AI()->AttackStart(pTarget); + + SpawnFlyingBats_Timer = 10000 + rand()%5000; + } else SpawnFlyingBats_Timer -=diff; + } + else + { + me->SetDisplayId(15219); + DoResetThreat(); + PhaseTwo = true; + } + } + + DoMeleeAttackIfReady(); } } + }; - DoMeleeAttackIfReady(); + CreatureAI* GetAI(Creature* creature) const + { + return new boss_jeklikAI(creature); } - } }; //Flying Bat -struct mob_batriderAI : public ScriptedAI +class mob_batrider : public CreatureScript { - mob_batriderAI(Creature *c) : ScriptedAI(c) - { - m_pInstance = c->GetInstanceData(); - } - - ScriptedInstance *m_pInstance; - - uint32 Bomb_Timer; - uint32 Check_Timer; + public: - void Reset() - { - Bomb_Timer = 2000; - Check_Timer = 1000; + mob_batrider() + : CreatureScript("mob_batrider") + { + } - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } + struct mob_batriderAI : public ScriptedAI + { + mob_batriderAI(Creature *c) : ScriptedAI(c) + { + m_pInstance = c->GetInstanceData(); + } - void EnterCombat(Unit * /*who*/) {} + ScriptedInstance *m_pInstance; - void UpdateAI (const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Bomb_Timer; + uint32 Check_Timer; - //Bomb_Timer - if (Bomb_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + void Reset() { - DoCast(pTarget, SPELL_BOMB); - Bomb_Timer = 5000; + Bomb_Timer = 2000; + Check_Timer = 1000; + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - } else Bomb_Timer -= diff; - //Check_Timer - if (Check_Timer <= diff) - { - if (m_pInstance) + void EnterCombat(Unit * /*who*/) {} + + void UpdateAI (const uint32 diff) { - if (m_pInstance->GetData(TYPE_JEKLIK) == DONE) - { - me->setDeathState(JUST_DIED); - me->RemoveCorpse(); + if (!UpdateVictim()) return; - } - } - Check_Timer = 1000; - } else Check_Timer -= diff; + //Bomb_Timer + if (Bomb_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + DoCast(pTarget, SPELL_BOMB); + Bomb_Timer = 5000; + } + } else Bomb_Timer -= diff; - DoMeleeAttackIfReady(); - } -}; + //Check_Timer + if (Check_Timer <= diff) + { + if (m_pInstance) + { + if (m_pInstance->GetData(TYPE_JEKLIK) == DONE) + { + me->setDeathState(JUST_DIED); + me->RemoveCorpse(); + return; + } + } -CreatureAI* GetAI_boss_jeklik(Creature* pCreature) -{ - return new boss_jeklikAI (pCreature); -} + Check_Timer = 1000; + } else Check_Timer -= diff; -CreatureAI* GetAI_mob_batrider(Creature* pCreature) -{ - return new mob_batriderAI (pCreature); -} + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new mob_batriderAI(creature); + } +}; void AddSC_boss_jeklik() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_jeklik"; - newscript->GetAI = &GetAI_boss_jeklik; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_batrider"; - newscript->GetAI = &GetAI_mob_batrider; - newscript->RegisterSelf(); + new boss_jeklik(); + new mob_batrider(); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp index a192a1fcbf3..689cc4dae27 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp @@ -41,225 +41,242 @@ EndScriptData */ #define SPELL_SHADOWSHOCK 19460 #define SPELL_INVISIBLE 24699 -struct boss_jindoAI : public ScriptedAI +class boss_jindo : public CreatureScript { - boss_jindoAI(Creature *c) : ScriptedAI(c) {} - - uint32 BrainWashTotem_Timer; - uint32 HealingWard_Timer; - uint32 Hex_Timer; - uint32 Delusions_Timer; - uint32 Teleport_Timer; - - void Reset() - { - BrainWashTotem_Timer = 20000; - HealingWard_Timer = 16000; - Hex_Timer = 8000; - Delusions_Timer = 10000; - Teleport_Timer = 5000; - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //BrainWashTotem_Timer - if (BrainWashTotem_Timer <= diff) - { - DoCast(me, SPELL_BRAINWASHTOTEM); - BrainWashTotem_Timer = 18000 + rand()%8000; - } else BrainWashTotem_Timer -= diff; + public: - //HealingWard_Timer - if (HealingWard_Timer <= diff) + boss_jindo() + : CreatureScript("boss_jindo") { - //DoCast(me, SPELL_POWERFULLHEALINGWARD); - me->SummonCreature(14987, me->GetPositionX()+3, me->GetPositionY()-2, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,30000); - HealingWard_Timer = 14000 + rand()%6000; - } else HealingWard_Timer -= diff; + } - //Hex_Timer - if (Hex_Timer <= diff) + struct boss_jindoAI : public ScriptedAI { - DoCast(me->getVictim(), SPELL_HEX); - - if (DoGetThreat(me->getVictim())) - DoModifyThreatPercent(me->getVictim(),-80); + boss_jindoAI(Creature *c) : ScriptedAI(c) {} - Hex_Timer = 12000 + rand()%8000; - } else Hex_Timer -= diff; + uint32 BrainWashTotem_Timer; + uint32 HealingWard_Timer; + uint32 Hex_Timer; + uint32 Delusions_Timer; + uint32 Teleport_Timer; - //Casting the delusion curse with a shade. So shade will attack the same target with the curse. - if (Delusions_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + void Reset() { - DoCast(pTarget, SPELL_DELUSIONSOFJINDO); - - Creature *Shade = me->SummonCreature(14986, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Shade) - Shade->AI()->AttackStart(pTarget); + BrainWashTotem_Timer = 20000; + HealingWard_Timer = 16000; + Hex_Timer = 8000; + Delusions_Timer = 10000; + Teleport_Timer = 5000; } - Delusions_Timer = 4000 + rand()%8000; - } else Delusions_Timer -= diff; - - //Teleporting a random gamer and spawning 9 skeletons that will attack this gamer - if (Teleport_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) + void EnterCombat(Unit * /*who*/) { - DoTeleportPlayer(pTarget, -11583.7783,-1249.4278,77.5471,4.745); - - if (DoGetThreat(me->getVictim())) - DoModifyThreatPercent(pTarget,-100); - - Creature *Skeletons; - Skeletons = me->SummonCreature(14826, pTarget->GetPositionX()+2, pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Skeletons) - Skeletons->AI()->AttackStart(pTarget); - Skeletons = me->SummonCreature(14826, pTarget->GetPositionX()-2, pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Skeletons) - Skeletons->AI()->AttackStart(pTarget); - Skeletons = me->SummonCreature(14826, pTarget->GetPositionX()+4, pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Skeletons) - Skeletons->AI()->AttackStart(pTarget); - Skeletons = me->SummonCreature(14826, pTarget->GetPositionX()-4, pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Skeletons) - Skeletons->AI()->AttackStart(pTarget); - Skeletons = me->SummonCreature(14826, pTarget->GetPositionX(), pTarget->GetPositionY()+2, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Skeletons) - Skeletons->AI()->AttackStart(pTarget); - Skeletons = me->SummonCreature(14826, pTarget->GetPositionX(), pTarget->GetPositionY()-2, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Skeletons) - Skeletons->AI()->AttackStart(pTarget); - Skeletons = me->SummonCreature(14826, pTarget->GetPositionX(), pTarget->GetPositionY()+4, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Skeletons) - Skeletons->AI()->AttackStart(pTarget); - Skeletons = me->SummonCreature(14826, pTarget->GetPositionX(), pTarget->GetPositionY()-4, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Skeletons) - Skeletons->AI()->AttackStart(pTarget); - Skeletons = me->SummonCreature(14826, pTarget->GetPositionX()+3, pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Skeletons) - Skeletons->AI()->AttackStart(pTarget); + DoScriptText(SAY_AGGRO, me); } - Teleport_Timer = 15000 + rand()%8000; - } else Teleport_Timer -= diff; + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //BrainWashTotem_Timer + if (BrainWashTotem_Timer <= diff) + { + DoCast(me, SPELL_BRAINWASHTOTEM); + BrainWashTotem_Timer = 18000 + rand()%8000; + } else BrainWashTotem_Timer -= diff; + + //HealingWard_Timer + if (HealingWard_Timer <= diff) + { + //DoCast(me, SPELL_POWERFULLHEALINGWARD); + me->SummonCreature(14987, me->GetPositionX()+3, me->GetPositionY()-2, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,30000); + HealingWard_Timer = 14000 + rand()%6000; + } else HealingWard_Timer -= diff; + + //Hex_Timer + if (Hex_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_HEX); + + if (DoGetThreat(me->getVictim())) + DoModifyThreatPercent(me->getVictim(),-80); + + Hex_Timer = 12000 + rand()%8000; + } else Hex_Timer -= diff; + + //Casting the delusion curse with a shade. So shade will attack the same target with the curse. + if (Delusions_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + DoCast(pTarget, SPELL_DELUSIONSOFJINDO); + + Creature *Shade = me->SummonCreature(14986, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Shade) + Shade->AI()->AttackStart(pTarget); + } + + Delusions_Timer = 4000 + rand()%8000; + } else Delusions_Timer -= diff; + + //Teleporting a random gamer and spawning 9 skeletons that will attack this gamer + if (Teleport_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) + { + DoTeleportPlayer(pTarget, -11583.7783,-1249.4278,77.5471,4.745); + + if (DoGetThreat(me->getVictim())) + DoModifyThreatPercent(pTarget,-100); + + Creature *Skeletons; + Skeletons = me->SummonCreature(14826, pTarget->GetPositionX()+2, pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Skeletons) + Skeletons->AI()->AttackStart(pTarget); + Skeletons = me->SummonCreature(14826, pTarget->GetPositionX()-2, pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Skeletons) + Skeletons->AI()->AttackStart(pTarget); + Skeletons = me->SummonCreature(14826, pTarget->GetPositionX()+4, pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Skeletons) + Skeletons->AI()->AttackStart(pTarget); + Skeletons = me->SummonCreature(14826, pTarget->GetPositionX()-4, pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Skeletons) + Skeletons->AI()->AttackStart(pTarget); + Skeletons = me->SummonCreature(14826, pTarget->GetPositionX(), pTarget->GetPositionY()+2, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Skeletons) + Skeletons->AI()->AttackStart(pTarget); + Skeletons = me->SummonCreature(14826, pTarget->GetPositionX(), pTarget->GetPositionY()-2, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Skeletons) + Skeletons->AI()->AttackStart(pTarget); + Skeletons = me->SummonCreature(14826, pTarget->GetPositionX(), pTarget->GetPositionY()+4, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Skeletons) + Skeletons->AI()->AttackStart(pTarget); + Skeletons = me->SummonCreature(14826, pTarget->GetPositionX(), pTarget->GetPositionY()-4, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Skeletons) + Skeletons->AI()->AttackStart(pTarget); + Skeletons = me->SummonCreature(14826, pTarget->GetPositionX()+3, pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Skeletons) + Skeletons->AI()->AttackStart(pTarget); + } + + Teleport_Timer = 15000 + rand()%8000; + } else Teleport_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_jindoAI(creature); + } }; //Healing Ward -struct mob_healing_wardAI : public ScriptedAI +class mob_healing_ward : public CreatureScript { - mob_healing_wardAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } + public: - uint32 Heal_Timer; + mob_healing_ward() + : CreatureScript("mob_healing_ward") + { + } - ScriptedInstance *pInstance; + struct mob_healing_wardAI : public ScriptedAI + { + mob_healing_wardAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + } - void Reset() - { - Heal_Timer = 2000; - } + uint32 Heal_Timer; - void EnterCombat(Unit * /*who*/) - { - } + ScriptedInstance *pInstance; - void UpdateAI (const uint32 diff) - { - //Heal_Timer - if (Heal_Timer <= diff) - { - if (pInstance) + void Reset() { - Unit *pJindo = Unit::GetUnit((*me), pInstance->GetData64(DATA_JINDO)); - if (pJindo) - DoCast(pJindo, SPELL_HEAL); + Heal_Timer = 2000; } - Heal_Timer = 3000; - } else Heal_Timer -= diff; - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI (const uint32 diff) + { + //Heal_Timer + if (Heal_Timer <= diff) + { + if (pInstance) + { + Unit *pJindo = Unit::GetUnit((*me), pInstance->GetData64(DATA_JINDO)); + if (pJindo) + DoCast(pJindo, SPELL_HEAL); + } + Heal_Timer = 3000; + } else Heal_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new mob_healing_wardAI(creature); + } }; //Shade of Jindo -struct mob_shade_of_jindoAI : public ScriptedAI +class mob_shade_of_jindo : public CreatureScript { - mob_shade_of_jindoAI(Creature *c) : ScriptedAI(c) {} + public: - uint32 ShadowShock_Timer; + mob_shade_of_jindo() + : CreatureScript("mob_shade_of_jindo") + { + } - void Reset() - { - ShadowShock_Timer = 1000; - DoCast(me, SPELL_INVISIBLE, true); - } + struct mob_shade_of_jindoAI : public ScriptedAI + { + mob_shade_of_jindoAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit * /*who*/){} + uint32 ShadowShock_Timer; - void UpdateAI (const uint32 diff) - { + void Reset() + { + ShadowShock_Timer = 1000; + DoCast(me, SPELL_INVISIBLE, true); + } - //ShadowShock_Timer - if (ShadowShock_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHADOWSHOCK); - ShadowShock_Timer = 2000; - } else ShadowShock_Timer -= diff; + void EnterCombat(Unit * /*who*/){} - DoMeleeAttackIfReady(); - } -}; + void UpdateAI (const uint32 diff) + { -CreatureAI* GetAI_boss_jindo(Creature* pCreature) -{ - return new boss_jindoAI (pCreature); -} + //ShadowShock_Timer + if (ShadowShock_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWSHOCK); + ShadowShock_Timer = 2000; + } else ShadowShock_Timer -= diff; -CreatureAI* GetAI_mob_healing_ward(Creature* pCreature) -{ - return new mob_healing_wardAI (pCreature); -} + DoMeleeAttackIfReady(); + } + }; -CreatureAI* GetAI_mob_shade_of_jindo(Creature* pCreature) -{ - return new mob_shade_of_jindoAI (pCreature); -} + CreatureAI* GetAI(Creature* creature) const + { + return new mob_shade_of_jindoAI(creature); + } +}; void AddSC_boss_jindo() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_jindo"; - newscript->GetAI = &GetAI_boss_jindo; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_healing_ward"; - newscript->GetAI = &GetAI_mob_healing_ward; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_shade_of_jindo"; - newscript->GetAI = &GetAI_mob_shade_of_jindo; - newscript->RegisterSelf(); + new boss_jindo(); + new mob_healing_ward(); + new mob_shade_of_jindo(); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index 2fdae639e46..3c8ab2fdf23 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -44,292 +44,303 @@ EndScriptData */ //Ohgans Spells #define SPELL_SUNDERARMOR 24317 -struct boss_mandokirAI : public ScriptedAI +class boss_mandokir : public CreatureScript { - boss_mandokirAI(Creature *c) : ScriptedAI(c) - { - m_pInstance = c->GetInstanceData(); - } - - uint32 KillCount; - uint32 Watch_Timer; - uint32 TargetInRange; - uint32 Cleave_Timer; - uint32 Whirlwind_Timer; - uint32 Fear_Timer; - uint32 MortalStrike_Timer; - uint32 Check_Timer; - float targetX; - float targetY; - float targetZ; - - ScriptedInstance *m_pInstance; - - bool endWatch; - bool someWatched; - bool RaptorDead; - bool CombatStart; - - uint64 WatchTarget; - - void Reset() - { - KillCount = 0; - Watch_Timer = 33000; - Cleave_Timer = 7000; - Whirlwind_Timer = 20000; - Fear_Timer = 1000; - MortalStrike_Timer = 1000; - Check_Timer = 1000; - - targetX = 0.0; - targetY = 0.0; - targetZ = 0.0; - TargetInRange = 0; - - WatchTarget = 0; - - someWatched = false; - endWatch = false; - RaptorDead = false; - CombatStart = false; - - DoCast(me, 23243); - } - - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() == TYPEID_PLAYER) + public: + + boss_mandokir() + : CreatureScript("boss_mandokir") { - ++KillCount; + } - if (KillCount == 3) + struct boss_mandokirAI : public ScriptedAI + { + boss_mandokirAI(Creature *c) : ScriptedAI(c) { - DoScriptText(SAY_DING_KILL, me); - - if (m_pInstance) - { - uint64 JindoGUID = m_pInstance->GetData64(DATA_JINDO); - if (JindoGUID) - { - if (Unit* jTemp = Unit::GetUnit(*me,JindoGUID)) - { - if (jTemp->isAlive()) - DoScriptText(SAY_GRATS_JINDO, jTemp); - } - } - } - DoCast(me, SPELL_LEVEL_UP, true); - KillCount = 0; + m_pInstance = c->GetInstanceData(); } - } - } - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } + uint32 KillCount; + uint32 Watch_Timer; + uint32 TargetInRange; + uint32 Cleave_Timer; + uint32 Whirlwind_Timer; + uint32 Fear_Timer; + uint32 MortalStrike_Timer; + uint32 Check_Timer; + float targetX; + float targetY; + float targetZ; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + ScriptedInstance *m_pInstance; - if (me->getVictim() && me->isAlive()) - { - if (!CombatStart) + bool endWatch; + bool someWatched; + bool RaptorDead; + bool CombatStart; + + uint64 WatchTarget; + + void Reset() { - //At combat Start Mandokir is mounted so we must unmount it first - me->Unmount(); + KillCount = 0; + Watch_Timer = 33000; + Cleave_Timer = 7000; + Whirlwind_Timer = 20000; + Fear_Timer = 1000; + MortalStrike_Timer = 1000; + Check_Timer = 1000; + + targetX = 0.0; + targetY = 0.0; + targetZ = 0.0; + TargetInRange = 0; - //And summon his raptor - me->SummonCreature(14988, me->getVictim()->GetPositionX(), me->getVictim()->GetPositionY(), me->getVictim()->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 35000); - CombatStart = true; + WatchTarget = 0; + + someWatched = false; + endWatch = false; + RaptorDead = false; + CombatStart = false; + + DoCast(me, 23243); } - if (Watch_Timer <= diff) //Every 20 Sec Mandokir will check this + void KilledUnit(Unit* victim) { - if (WatchTarget) //If someone is watched and If the Position of the watched target is different from the one stored, or are attacking, mandokir will charge him + if (victim->GetTypeId() == TYPEID_PLAYER) { - Unit* pUnit = Unit::GetUnit(*me, WatchTarget); + ++KillCount; - if (pUnit && ( - targetX != pUnit->GetPositionX() || - targetY != pUnit->GetPositionY() || - targetZ != pUnit->GetPositionZ() || - pUnit->isInCombat())) + if (KillCount == 3) { - if (me->IsWithinMeleeRange(pUnit)) - { - DoCast(pUnit, 24316); - } - else + DoScriptText(SAY_DING_KILL, me); + + if (m_pInstance) { - DoCast(pUnit, SPELL_CHARGE); - //me->SendMonsterMove(pUnit->GetPositionX(), pUnit->GetPositionY(), pUnit->GetPositionZ(), 0, true,1); - AttackStart(pUnit); + uint64 JindoGUID = m_pInstance->GetData64(DATA_JINDO); + if (JindoGUID) + { + if (Unit* jTemp = Unit::GetUnit(*me,JindoGUID)) + { + if (jTemp->isAlive()) + DoScriptText(SAY_GRATS_JINDO, jTemp); + } + } } + DoCast(me, SPELL_LEVEL_UP, true); + KillCount = 0; } } - someWatched = false; - Watch_Timer = 20000; - } else Watch_Timer -= diff; - - if ((Watch_Timer < 8000) && !someWatched) //8 sec(cast time + expire time) before the check for the watch effect mandokir will cast watch debuff on a random target - { - if (Unit* p = SelectUnit(SELECT_TARGET_RANDOM,0)) - { - DoScriptText(SAY_WATCH, me, p); - DoCast(p, SPELL_WATCH); - WatchTarget = p->GetGUID(); - someWatched = true; - endWatch = true; - } } - if ((Watch_Timer < 1000) && endWatch) //1 sec before the debuf expire, store the target position + void EnterCombat(Unit * /*who*/) { - Unit* pUnit = Unit::GetUnit(*me, WatchTarget); - if (pUnit) - { - targetX = pUnit->GetPositionX(); - targetY = pUnit->GetPositionY(); - targetZ = pUnit->GetPositionZ(); - } - endWatch = false; + DoScriptText(SAY_AGGRO, me); } - if (!someWatched) + void UpdateAI(const uint32 diff) { - //Cleave - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + if (!UpdateVictim()) + return; - //Whirlwind - if (Whirlwind_Timer <= diff) + if (me->getVictim() && me->isAlive()) { - DoCast(me, SPELL_WHIRLWIND); - Whirlwind_Timer = 18000; - } else Whirlwind_Timer -= diff; - - //If more then 3 targets in melee range mandokir will cast fear - if (Fear_Timer <= diff) - { - TargetInRange = 0; - - std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (; i != me->getThreatManager().getThreatList().end(); ++i) + if (!CombatStart) { - Unit* pUnit = Unit::GetUnit(*me, (*i)->getUnitGuid()); - if (pUnit && me->IsWithinMeleeRange(pUnit)) - ++TargetInRange; + //At combat Start Mandokir is mounted so we must unmount it first + me->Unmount(); + + //And summon his raptor + me->SummonCreature(14988, me->getVictim()->GetPositionX(), me->getVictim()->GetPositionY(), me->getVictim()->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 35000); + CombatStart = true; } - if (TargetInRange > 3) - DoCast(me->getVictim(), SPELL_FEAR); + if (Watch_Timer <= diff) //Every 20 Sec Mandokir will check this + { + if (WatchTarget) //If someone is watched and If the Position of the watched target is different from the one stored, or are attacking, mandokir will charge him + { + Unit* pUnit = Unit::GetUnit(*me, WatchTarget); + + if (pUnit && ( + targetX != pUnit->GetPositionX() || + targetY != pUnit->GetPositionY() || + targetZ != pUnit->GetPositionZ() || + pUnit->isInCombat())) + { + if (me->IsWithinMeleeRange(pUnit)) + { + DoCast(pUnit, 24316); + } + else + { + DoCast(pUnit, SPELL_CHARGE); + //me->SendMonsterMove(pUnit->GetPositionX(), pUnit->GetPositionY(), pUnit->GetPositionZ(), 0, true,1); + AttackStart(pUnit); + } + } + } + someWatched = false; + Watch_Timer = 20000; + } else Watch_Timer -= diff; - Fear_Timer = 4000; - } else Fear_Timer -=diff; + if ((Watch_Timer < 8000) && !someWatched) //8 sec(cast time + expire time) before the check for the watch effect mandokir will cast watch debuff on a random target + { + if (Unit* p = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + DoScriptText(SAY_WATCH, me, p); + DoCast(p, SPELL_WATCH); + WatchTarget = p->GetGUID(); + someWatched = true; + endWatch = true; + } + } - //Mortal Strike if target below 50% hp - if (me->getVictim() && me->getVictim()->GetHealth() < me->getVictim()->GetMaxHealth()*0.5) - { - if (MortalStrike_Timer <= diff) + if ((Watch_Timer < 1000) && endWatch) //1 sec before the debuf expire, store the target position { - DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); - MortalStrike_Timer = 15000; - } else MortalStrike_Timer -= diff; - } - } - //Checking if Ohgan is dead. If yes Mandokir will enrage. - if (Check_Timer <= diff) - { - if (m_pInstance) - { - if (m_pInstance->GetData(TYPE_OHGAN) == DONE) + Unit* pUnit = Unit::GetUnit(*me, WatchTarget); + if (pUnit) + { + targetX = pUnit->GetPositionX(); + targetY = pUnit->GetPositionY(); + targetZ = pUnit->GetPositionZ(); + } + endWatch = false; + } + + if (!someWatched) { - if (!RaptorDead) + //Cleave + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 7000; + } else Cleave_Timer -= diff; + + //Whirlwind + if (Whirlwind_Timer <= diff) + { + DoCast(me, SPELL_WHIRLWIND); + Whirlwind_Timer = 18000; + } else Whirlwind_Timer -= diff; + + //If more then 3 targets in melee range mandokir will cast fear + if (Fear_Timer <= diff) { - DoCast(me, SPELL_ENRAGE); - RaptorDead = true; + TargetInRange = 0; + + std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (; i != me->getThreatManager().getThreatList().end(); ++i) + { + Unit* pUnit = Unit::GetUnit(*me, (*i)->getUnitGuid()); + if (pUnit && me->IsWithinMeleeRange(pUnit)) + ++TargetInRange; + } + + if (TargetInRange > 3) + DoCast(me->getVictim(), SPELL_FEAR); + + Fear_Timer = 4000; + } else Fear_Timer -=diff; + + //Mortal Strike if target below 50% hp + if (me->getVictim() && me->getVictim()->GetHealth() < me->getVictim()->GetMaxHealth()*0.5) + { + if (MortalStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); + MortalStrike_Timer = 15000; + } else MortalStrike_Timer -= diff; } } - } + //Checking if Ohgan is dead. If yes Mandokir will enrage. + if (Check_Timer <= diff) + { + if (m_pInstance) + { + if (m_pInstance->GetData(TYPE_OHGAN) == DONE) + { + if (!RaptorDead) + { + DoCast(me, SPELL_ENRAGE); + RaptorDead = true; + } + } + } - Check_Timer = 1000; - } else Check_Timer -= diff; + Check_Timer = 1000; + } else Check_Timer -= diff; + + DoMeleeAttackIfReady(); + } + } + }; - DoMeleeAttackIfReady(); + CreatureAI* GetAI(Creature* creature) const + { + return new boss_mandokirAI(creature); } - } }; //Ohgan -struct mob_ohganAI : public ScriptedAI +class mob_ohgan : public CreatureScript { - mob_ohganAI(Creature *c) : ScriptedAI(c) - { - m_pInstance = c->GetInstanceData(); - } - - uint32 SunderArmor_Timer; - ScriptedInstance *m_pInstance; - - void Reset() - { - SunderArmor_Timer = 5000; - } - - void EnterCombat(Unit * /*who*/) {} - - void JustDied(Unit* /*Killer*/) - { - if (m_pInstance) - m_pInstance->SetData(TYPE_OHGAN, DONE); - } - - void UpdateAI (const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //SunderArmor_Timer - if (SunderArmor_Timer <= diff) + public: + + mob_ohgan() + : CreatureScript("mob_ohgan") { - DoCast(me->getVictim(), SPELL_SUNDERARMOR); - SunderArmor_Timer = 10000 + rand()%5000; - } else SunderArmor_Timer -= diff; + } - DoMeleeAttackIfReady(); - } -}; + struct mob_ohganAI : public ScriptedAI + { + mob_ohganAI(Creature *c) : ScriptedAI(c) + { + m_pInstance = c->GetInstanceData(); + } -CreatureAI* GetAI_boss_mandokir(Creature* pCreature) -{ - return new boss_mandokirAI (pCreature); -} + uint32 SunderArmor_Timer; + ScriptedInstance *m_pInstance; -CreatureAI* GetAI_mob_ohgan(Creature* pCreature) -{ - return new mob_ohganAI (pCreature); -} + void Reset() + { + SunderArmor_Timer = 5000; + } -void AddSC_boss_mandokir() -{ - Script *newscript; + void EnterCombat(Unit * /*who*/) {} - newscript = new Script; - newscript->Name = "boss_mandokir"; - newscript->GetAI = &GetAI_boss_mandokir; - newscript->RegisterSelf(); + void JustDied(Unit* /*Killer*/) + { + if (m_pInstance) + m_pInstance->SetData(TYPE_OHGAN, DONE); + } - newscript = new Script; - newscript->Name = "mob_ohgan"; - newscript->GetAI = &GetAI_mob_ohgan; - newscript->RegisterSelf(); + void UpdateAI (const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //SunderArmor_Timer + if (SunderArmor_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SUNDERARMOR); + SunderArmor_Timer = 10000 + rand()%5000; + } else SunderArmor_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new mob_ohganAI(creature); + } +}; + +void AddSC_boss_mandokir() +{ + new boss_mandokir(); + new mob_ohgan(); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp index 76f89ebf6ca..644ccc6788a 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp @@ -40,224 +40,236 @@ EndScriptData */ //The Spider Spells #define SPELL_LEVELUP 24312 //Not right Spell. -struct boss_marliAI : public ScriptedAI +class boss_marli : public CreatureScript { - boss_marliAI(Creature *c) : ScriptedAI(c) - { - m_pInstance = c->GetInstanceData(); - } - - ScriptedInstance *m_pInstance; - - uint32 SpawnStartSpiders_Timer; - uint32 PoisonVolley_Timer; - uint32 SpawnSpider_Timer; - uint32 Charge_Timer; - uint32 Aspect_Timer; - uint32 Transform_Timer; - uint32 TransformBack_Timer; - - bool Spawned; - bool PhaseTwo; - - void Reset() - { - SpawnStartSpiders_Timer = 1000; - PoisonVolley_Timer = 15000; - SpawnSpider_Timer = 30000; - Charge_Timer = 1500; - Aspect_Timer = 12000; - Transform_Timer = 45000; - TransformBack_Timer = 25000; - - Spawned = false; - PhaseTwo = false; - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - if (m_pInstance) - m_pInstance->SetData(TYPE_MARLI, DONE); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (me->getVictim() && me->isAlive()) + public: + + boss_marli() + : CreatureScript("boss_marli") { - if (PoisonVolley_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_POISONVOLLEY); - PoisonVolley_Timer = 10000 + rand()%10000; - } else PoisonVolley_Timer -= diff; + } - if (!PhaseTwo && Aspect_Timer <= diff) + struct boss_marliAI : public ScriptedAI + { + boss_marliAI(Creature *c) : ScriptedAI(c) { - DoCast(me->getVictim(), SPELL_ASPECT_OF_MARLI); - Aspect_Timer = 13000 + rand()%5000; - } else Aspect_Timer -= diff; + m_pInstance = c->GetInstanceData(); + } - if (!Spawned && SpawnStartSpiders_Timer <= diff) - { - DoScriptText(SAY_SPIDER_SPAWN, me); + ScriptedInstance *m_pInstance; - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (!pTarget) - return; + uint32 SpawnStartSpiders_Timer; + uint32 PoisonVolley_Timer; + uint32 SpawnSpider_Timer; + uint32 Charge_Timer; + uint32 Aspect_Timer; + uint32 Transform_Timer; + uint32 TransformBack_Timer; - Creature *Spider = NULL; - - Spider = me->SummonCreature(15041,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Spider) - Spider->AI()->AttackStart(pTarget); - Spider = me->SummonCreature(15041,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Spider) - Spider->AI()->AttackStart(pTarget); - Spider = me->SummonCreature(15041,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Spider) - Spider->AI()->AttackStart(pTarget); - Spider = me->SummonCreature(15041,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Spider) - Spider->AI()->AttackStart(pTarget); - - Spawned = true; - } else SpawnStartSpiders_Timer -= diff; - - if (SpawnSpider_Timer <= diff) + bool Spawned; + bool PhaseTwo; + + void Reset() { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (!pTarget) - return; + SpawnStartSpiders_Timer = 1000; + PoisonVolley_Timer = 15000; + SpawnSpider_Timer = 30000; + Charge_Timer = 1500; + Aspect_Timer = 12000; + Transform_Timer = 45000; + TransformBack_Timer = 25000; + + Spawned = false; + PhaseTwo = false; + } - Creature *Spider = me->SummonCreature(15041,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Spider) - Spider->AI()->AttackStart(pTarget); - SpawnSpider_Timer = 12000 + rand()%5000; - } else SpawnSpider_Timer -= diff; + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } - if (!PhaseTwo && Transform_Timer <= diff) + void JustDied(Unit* /*Killer*/) { - DoScriptText(SAY_TRANSFORM, me); - DoCast(me, SPELL_SPIDER_FORM); - const CreatureInfo *cinfo = me->GetCreatureInfo(); - me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); - me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); - me->UpdateDamagePhysical(BASE_ATTACK); - DoCast(me->getVictim(), SPELL_ENVOLWINGWEB); - - if (DoGetThreat(me->getVictim())) - DoModifyThreatPercent(me->getVictim(),-100); - - PhaseTwo = true; - Transform_Timer = urand(35000,60000); - } else Transform_Timer -= diff; - - if (PhaseTwo) + DoScriptText(SAY_DEATH, me); + if (m_pInstance) + m_pInstance->SetData(TYPE_MARLI, DONE); + } + + void UpdateAI(const uint32 diff) { - if (Charge_Timer <= diff) + if (!UpdateVictim()) + return; + + if (me->getVictim() && me->isAlive()) { - Unit *pTarget = NULL; - int i = 0; - while (i < 3) // max 3 tries to get a random target with power_mana + if (PoisonVolley_Timer <= diff) { - ++i; - pTarget = SelectTarget(SELECT_TARGET_RANDOM,1, 100, true); // not aggro leader - if (pTarget && pTarget->getPowerType() == POWER_MANA) - i = 3; - } - if (pTarget) + DoCast(me->getVictim(), SPELL_POISONVOLLEY); + PoisonVolley_Timer = 10000 + rand()%10000; + } else PoisonVolley_Timer -= diff; + + if (!PhaseTwo && Aspect_Timer <= diff) { - DoCast(pTarget, SPELL_CHARGE); - //me->GetMap()->CreatureRelocation(me, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0); - //me->SendMonsterMove(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, true,1); - AttackStart(pTarget); - } + DoCast(me->getVictim(), SPELL_ASPECT_OF_MARLI); + Aspect_Timer = 13000 + rand()%5000; + } else Aspect_Timer -= diff; - Charge_Timer = 8000; - } else Charge_Timer -= diff; + if (!Spawned && SpawnStartSpiders_Timer <= diff) + { + DoScriptText(SAY_SPIDER_SPAWN, me); + + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (!pTarget) + return; + + Creature *Spider = NULL; + + Spider = me->SummonCreature(15041,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Spider) + Spider->AI()->AttackStart(pTarget); + Spider = me->SummonCreature(15041,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Spider) + Spider->AI()->AttackStart(pTarget); + Spider = me->SummonCreature(15041,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Spider) + Spider->AI()->AttackStart(pTarget); + Spider = me->SummonCreature(15041,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Spider) + Spider->AI()->AttackStart(pTarget); + + Spawned = true; + } else SpawnStartSpiders_Timer -= diff; + + if (SpawnSpider_Timer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (!pTarget) + return; - if (TransformBack_Timer <= diff) - { - me->SetDisplayId(15220); - const CreatureInfo *cinfo = me->GetCreatureInfo(); - me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1))); - me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1))); - me->UpdateDamagePhysical(BASE_ATTACK); + Creature *Spider = me->SummonCreature(15041,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Spider) + Spider->AI()->AttackStart(pTarget); + SpawnSpider_Timer = 12000 + rand()%5000; + } else SpawnSpider_Timer -= diff; + + if (!PhaseTwo && Transform_Timer <= diff) + { + DoScriptText(SAY_TRANSFORM, me); + DoCast(me, SPELL_SPIDER_FORM); + const CreatureInfo *cinfo = me->GetCreatureInfo(); + me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); + me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); + me->UpdateDamagePhysical(BASE_ATTACK); + DoCast(me->getVictim(), SPELL_ENVOLWINGWEB); + + if (DoGetThreat(me->getVictim())) + DoModifyThreatPercent(me->getVictim(),-100); + + PhaseTwo = true; + Transform_Timer = urand(35000,60000); + } else Transform_Timer -= diff; + + if (PhaseTwo) + { + if (Charge_Timer <= diff) + { + Unit *pTarget = NULL; + int i = 0; + while (i < 3) // max 3 tries to get a random target with power_mana + { + ++i; + pTarget = SelectTarget(SELECT_TARGET_RANDOM,1, 100, true); // not aggro leader + if (pTarget && pTarget->getPowerType() == POWER_MANA) + i = 3; + } + if (pTarget) + { + DoCast(pTarget, SPELL_CHARGE); + //me->GetMap()->CreatureRelocation(me, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0); + //me->SendMonsterMove(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, true,1); + AttackStart(pTarget); + } + + Charge_Timer = 8000; + } else Charge_Timer -= diff; + + if (TransformBack_Timer <= diff) + { + me->SetDisplayId(15220); + const CreatureInfo *cinfo = me->GetCreatureInfo(); + me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1))); + me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1))); + me->UpdateDamagePhysical(BASE_ATTACK); + + PhaseTwo = false; + TransformBack_Timer = urand(25000,40000); + } else TransformBack_Timer -= diff; - PhaseTwo = false; - TransformBack_Timer = urand(25000,40000); - } else TransformBack_Timer -= diff; + } + DoMeleeAttackIfReady(); + } } + }; + - DoMeleeAttackIfReady(); + CreatureAI* GetAI(Creature* creature) const + { + return new example_creatureAI(creature); } - } }; //Spawn of Marli -struct mob_spawn_of_marliAI : public ScriptedAI +class mob_spawn_of_marli : public CreatureScript { - mob_spawn_of_marliAI(Creature *c) : ScriptedAI(c) {} + public: - uint32 LevelUp_Timer; + mob_spawn_of_marli() + : CreatureScript("mob_spawn_of_marli") + { + } - void Reset() - { - LevelUp_Timer = 3000; - } + struct mob_spawn_of_marliAI : public ScriptedAI + { + mob_spawn_of_marliAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit * /*who*/) - { - } + uint32 LevelUp_Timer; - void UpdateAI (const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void Reset() + { + LevelUp_Timer = 3000; + } - //LevelUp_Timer - if (LevelUp_Timer <= diff) - { - DoCast(me, SPELL_LEVELUP); - LevelUp_Timer = 3000; - } else LevelUp_Timer -= diff; + void EnterCombat(Unit * /*who*/) + { + } - DoMeleeAttackIfReady(); - } -}; + void UpdateAI (const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; -CreatureAI* GetAI_boss_marli(Creature* pCreature) -{ - return new boss_marliAI (pCreature); -} + //LevelUp_Timer + if (LevelUp_Timer <= diff) + { + DoCast(me, SPELL_LEVELUP); + LevelUp_Timer = 3000; + } else LevelUp_Timer -= diff; -CreatureAI* GetAI_mob_spawn_of_marli(Creature* pCreature) -{ - return new mob_spawn_of_marliAI (pCreature); -} + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new mob_spawn_of_marliAI(creature); + } +}; void AddSC_boss_marli() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_marli"; - newscript->GetAI = &GetAI_boss_marli; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_spawn_of_marli"; - newscript->GetAI = &GetAI_mob_spawn_of_marli; - newscript->RegisterSelf(); + new boss_marli(); + new mob_spawn_of_marli(); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp index 3d1d19bed40..be335b5b00c 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp @@ -31,124 +31,131 @@ EndScriptData */ #define EQUIP_ID_MAIN_HAND 0 //was item display id 31818, but this id does not exist -struct boss_renatakiAI : public ScriptedAI +class boss_renataki : public CreatureScript { - boss_renatakiAI(Creature *c) : ScriptedAI(c) {} - - uint32 Invisible_Timer; - uint32 Ambush_Timer; - uint32 Visible_Timer; - uint32 Aggro_Timer; - uint32 ThousandBlades_Timer; - - bool Invisible; - bool Ambushed; - - void Reset() - { - Invisible_Timer = 8000 + rand()%10000; - Ambush_Timer = 3000; - Visible_Timer = 4000; - Aggro_Timer = 15000 + rand()%10000; - ThousandBlades_Timer = 4000 + rand()%4000; - - Invisible = false; - Ambushed = false; - } - - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //Invisible_Timer - if (Invisible_Timer <= diff) + public: + + boss_renataki() + : CreatureScript("boss_renataki") { - me->InterruptSpell(CURRENT_GENERIC_SPELL); + } - SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - me->SetDisplayId(11686); + struct boss_renatakiAI : public ScriptedAI + { + boss_renatakiAI(Creature *c) : ScriptedAI(c) {} - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Invisible = true; + uint32 Invisible_Timer; + uint32 Ambush_Timer; + uint32 Visible_Timer; + uint32 Aggro_Timer; + uint32 ThousandBlades_Timer; - Invisible_Timer = 15000 + rand()%15000; - } else Invisible_Timer -= diff; + bool Invisible; + bool Ambushed; - if (Invisible) - { - if (Ambush_Timer <= diff) + void Reset() + { + Invisible_Timer = 8000 + rand()%10000; + Ambush_Timer = 3000; + Visible_Timer = 4000; + Aggro_Timer = 15000 + rand()%10000; + ThousandBlades_Timer = 4000 + rand()%4000; + + Invisible = false; + Ambushed = false; + } + + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) + if (!UpdateVictim()) + return; + + //Invisible_Timer + if (Invisible_Timer <= diff) + { + me->InterruptSpell(CURRENT_GENERIC_SPELL); + + SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + me->SetDisplayId(11686); + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + Invisible = true; + + Invisible_Timer = 15000 + rand()%15000; + } else Invisible_Timer -= diff; + + if (Invisible) { - DoTeleportTo(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ()); - DoCast(pTarget, SPELL_AMBUSH); + if (Ambush_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) + { + DoTeleportTo(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ()); + DoCast(pTarget, SPELL_AMBUSH); + } + + Ambushed = true; + Ambush_Timer = 3000; + } else Ambush_Timer -= diff; } - Ambushed = true; - Ambush_Timer = 3000; - } else Ambush_Timer -= diff; - } + if (Ambushed) + { + if (Visible_Timer <= diff) + { + me->InterruptSpell(CURRENT_GENERIC_SPELL); - if (Ambushed) - { - if (Visible_Timer <= diff) - { - me->InterruptSpell(CURRENT_GENERIC_SPELL); + me->SetDisplayId(15268); + SetEquipmentSlots(false, EQUIP_ID_MAIN_HAND, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - me->SetDisplayId(15268); - SetEquipmentSlots(false, EQUIP_ID_MAIN_HAND, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + Invisible = false; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Invisible = false; + Visible_Timer = 4000; + } else Visible_Timer -= diff; + } - Visible_Timer = 4000; - } else Visible_Timer -= diff; - } + //Resetting some aggro so he attacks other gamers + if (!Invisible) + if (Aggro_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); - //Resetting some aggro so he attacks other gamers - if (!Invisible) - if (Aggro_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + if (DoGetThreat(me->getVictim())) + DoModifyThreatPercent(me->getVictim(),-50); - if (DoGetThreat(me->getVictim())) - DoModifyThreatPercent(me->getVictim(),-50); + if (pTarget) + AttackStart(pTarget); - if (pTarget) - AttackStart(pTarget); + Aggro_Timer = 7000 + rand()%13000; + } else Aggro_Timer -= diff; - Aggro_Timer = 7000 + rand()%13000; - } else Aggro_Timer -= diff; + if (!Invisible) + if (ThousandBlades_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_THOUSANDBLADES); + ThousandBlades_Timer = 7000 + rand()%5000; + } else ThousandBlades_Timer -= diff; - if (!Invisible) - if (ThousandBlades_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_THOUSANDBLADES); - ThousandBlades_Timer = 7000 + rand()%5000; - } else ThousandBlades_Timer -= diff; + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_renatakiAI(creature); + } }; -CreatureAI* GetAI_boss_renataki(Creature* pCreature) -{ - return new boss_renatakiAI (pCreature); -} void AddSC_boss_renataki() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_renataki"; - newscript->GetAI = &GetAI_boss_renataki; - newscript->RegisterSelf(); + new boss_renataki(); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp index 7e1aa2db350..d4bbf4704ca 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp @@ -29,530 +29,550 @@ EndScriptData */ #define SAY_AGGRO -1309009 #define SAY_DEATH -1309010 -#define SPELL_MORTALCLEAVE 22859 -#define SPELL_SILENCE 23207 -#define SPELL_FRENZY 23342 -#define SPELL_FORCEPUNCH 24189 -#define SPELL_CHARGE 24408 -#define SPELL_ENRAGE 23537 -#define SPELL_SUMMONTIGERS 24183 -#define SPELL_TIGER_FORM 24169 -#define SPELL_RESURRECT 24173 //We will not use this spell. +enum eSpells +{ + SPELL_MORTALCLEAVE = 22859, + SPELL_SILENCE = 23207, + SPELL_FRENZY = 23342, + SPELL_FORCEPUNCH = 24189, + SPELL_CHARGE = 24408, + SPELL_ENRAGE = 23537, + SPELL_SUMMONTIGERS = 24183, + SPELL_TIGER_FORM = 24169, + SPELL_RESURRECT = 24173, //We will not use this spell. //Zealot Lor'Khan Spells -#define SPELL_SHIELD 25020 -#define SPELL_BLOODLUST 24185 -#define SPELL_GREATERHEAL 24208 -#define SPELL_DISARM 22691 + SPELL_SHIELD = 25020, + SPELL_BLOODLUST = 24185, + SPELL_GREATERHEAL = 24208, + SPELL_DISARM = 22691, //Zealot Lor'Khan Spells -#define SPELL_SWEEPINGSTRIKES 18765 -#define SPELL_SINISTERSTRIKE 15667 -#define SPELL_GOUGE 24698 -#define SPELL_KICK 15614 -#define SPELL_BLIND 21060 + SPELL_SWEEPINGSTRIKES = 18765, + SPELL_SINISTERSTRIKE = 15667, + SPELL_GOUGE = 24698, + SPELL_KICK = 15614, + SPELL_BLIND = 21060, +}; -struct boss_thekalAI : public ScriptedAI +class boss_thekal : public CreatureScript { - boss_thekalAI(Creature *c) : ScriptedAI(c) - { - m_pInstance = c->GetInstanceData(); - } - - uint32 MortalCleave_Timer; - uint32 Silence_Timer; - uint32 Frenzy_Timer; - uint32 ForcePunch_Timer; - uint32 Charge_Timer; - uint32 Enrage_Timer; - uint32 SummonTigers_Timer; - uint32 Check_Timer; - uint32 Resurrect_Timer; - - ScriptedInstance *m_pInstance; - bool Enraged; - bool PhaseTwo; - bool WasDead; - - void Reset() - { - MortalCleave_Timer = 4000; - Silence_Timer = 9000; - Frenzy_Timer = 30000; - ForcePunch_Timer = 4000; - Charge_Timer = 12000; - Enrage_Timer = 32000; - SummonTigers_Timer = 25000; - Check_Timer = 10000; - Resurrect_Timer = 10000; - - Enraged = false; - PhaseTwo = false; - WasDead = false; - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - if (m_pInstance) - m_pInstance->SetData(TYPE_THEKAL, DONE); - } - - void JustReachedHome() - { - if (m_pInstance) - m_pInstance->SetData(TYPE_THEKAL, NOT_STARTED); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //Check_Timer for the death of LorKhan and Zath. - if (!WasDead && Check_Timer <= diff) - { - if (m_pInstance) - { - if (m_pInstance->GetData(TYPE_LORKHAN) == SPECIAL) - { - //Resurrect LorKhan - if (Unit *pLorKhan = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_LORKHAN))) - { - pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - pLorKhan->setFaction(14); - pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pLorKhan->SetHealth(int(pLorKhan->GetMaxHealth()*1.0)); - - m_pInstance->SetData(TYPE_LORKHAN, DONE); - } - } - - if (m_pInstance->GetData(TYPE_ZATH) == SPECIAL) - { - //Resurrect Zath - Unit *pZath = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_ZATH)); - if (pZath) - { - pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - pZath->setFaction(14); - pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pZath->SetHealth(int(pZath->GetMaxHealth()*1.0)); + public: - m_pInstance->SetData(TYPE_ZATH, DONE); - } - } - } - - Check_Timer = 5000; - } else Check_Timer -= diff; + boss_thekal() + : CreatureScript("boss_thekal") + { + } - if (!PhaseTwo && MortalCleave_Timer <= diff) + struct boss_thekalAI : public ScriptedAI + { + boss_thekalAI(Creature *c) : ScriptedAI(c) { - DoCast(me->getVictim(), SPELL_MORTALCLEAVE); - MortalCleave_Timer = 15000 + rand()%5000; - } else MortalCleave_Timer -= diff; + m_pInstance = c->GetInstanceData(); + } - if (!PhaseTwo && Silence_Timer <= diff) + uint32 MortalCleave_Timer; + uint32 Silence_Timer; + uint32 Frenzy_Timer; + uint32 ForcePunch_Timer; + uint32 Charge_Timer; + uint32 Enrage_Timer; + uint32 SummonTigers_Timer; + uint32 Check_Timer; + uint32 Resurrect_Timer; + + ScriptedInstance *m_pInstance; + bool Enraged; + bool PhaseTwo; + bool WasDead; + + void Reset() { - DoCast(me->getVictim(), SPELL_SILENCE); - Silence_Timer = 20000 + rand()%5000; - } else Silence_Timer -= diff; + MortalCleave_Timer = 4000; + Silence_Timer = 9000; + Frenzy_Timer = 30000; + ForcePunch_Timer = 4000; + Charge_Timer = 12000; + Enrage_Timer = 32000; + SummonTigers_Timer = 25000; + Check_Timer = 10000; + Resurrect_Timer = 10000; + + Enraged = false; + PhaseTwo = false; + WasDead = false; + } - if (!PhaseTwo && !WasDead && me->GetHealth() <= me->GetMaxHealth() * 0.05) + void EnterCombat(Unit * /*who*/) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetStandState(UNIT_STAND_STATE_SLEEP); - me->AttackStop(); - - if (m_pInstance) - m_pInstance->SetData(TYPE_THEKAL, SPECIAL); - - WasDead=true; + DoScriptText(SAY_AGGRO, me); } - //Thekal will transform to Tiger if he died and was not resurrected after 10 seconds. - if (!PhaseTwo && WasDead) + void JustDied(Unit* /*Killer*/) { - if (Resurrect_Timer <= diff) - { - DoCast(me, SPELL_TIGER_FORM); - me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetHealth(int(me->GetMaxHealth()*1.0)); - const CreatureInfo *cinfo = me->GetCreatureInfo(); - me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 40))); - me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 40))); - me->UpdateDamagePhysical(BASE_ATTACK); - DoResetThreat(); - PhaseTwo = true; - } else Resurrect_Timer -= diff; + DoScriptText(SAY_DEATH, me); + if (m_pInstance) + m_pInstance->SetData(TYPE_THEKAL, DONE); } - if ((me->GetHealth()*100 / me->GetMaxHealth() == 100) && WasDead) + void JustReachedHome() { - WasDead = false; + if (m_pInstance) + m_pInstance->SetData(TYPE_THEKAL, NOT_STARTED); } - if (PhaseTwo) + void UpdateAI(const uint32 diff) { - if (Charge_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - { - DoCast(pTarget, SPELL_CHARGE); - DoResetThreat(); - AttackStart(pTarget); - } + if (!UpdateVictim()) + return; - Charge_Timer = 15000 + rand()%7000; - } else Charge_Timer -= diff; + //Check_Timer for the death of LorKhan and Zath. + if (!WasDead && Check_Timer <= diff) + { + if (m_pInstance) + { + if (m_pInstance->GetData(TYPE_LORKHAN) == SPECIAL) + { + //Resurrect LorKhan + if (Unit *pLorKhan = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_LORKHAN))) + { + pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + pLorKhan->setFaction(14); + pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pLorKhan->SetHealth(int(pLorKhan->GetMaxHealth()*1.0)); + + m_pInstance->SetData(TYPE_LORKHAN, DONE); + } + } + + if (m_pInstance->GetData(TYPE_ZATH) == SPECIAL) + { + //Resurrect Zath + Unit *pZath = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_ZATH)); + if (pZath) + { + pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + pZath->setFaction(14); + pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pZath->SetHealth(int(pZath->GetMaxHealth()*1.0)); + + m_pInstance->SetData(TYPE_ZATH, DONE); + } + } + } - if (Frenzy_Timer <= diff) - { - DoCast(me, SPELL_FRENZY); - Frenzy_Timer = 30000; - } else Frenzy_Timer -= diff; + Check_Timer = 5000; + } else Check_Timer -= diff; - if (ForcePunch_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SILENCE); - ForcePunch_Timer = 16000 + rand()%5000; - } else ForcePunch_Timer -= diff; + if (!PhaseTwo && MortalCleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTALCLEAVE); + MortalCleave_Timer = 15000 + rand()%5000; + } else MortalCleave_Timer -= diff; - if (SummonTigers_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SUMMONTIGERS); - SummonTigers_Timer = 10000 + rand()%4000; - } else SummonTigers_Timer -= diff; + if (!PhaseTwo && Silence_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SILENCE); + Silence_Timer = 20000 + rand()%5000; + } else Silence_Timer -= diff; - if ((me->GetHealth()*100 / me->GetMaxHealth() < 11) && !Enraged) - { - DoCast(me, SPELL_ENRAGE); - Enraged = true; - } - } + if (!PhaseTwo && !WasDead && me->GetHealth() <= me->GetMaxHealth() * 0.05) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetStandState(UNIT_STAND_STATE_SLEEP); + me->AttackStop(); - DoMeleeAttackIfReady(); + if (m_pInstance) + m_pInstance->SetData(TYPE_THEKAL, SPECIAL); - } -}; + WasDead=true; + } -//Zealot Lor'Khan -struct mob_zealot_lorkhanAI : public ScriptedAI -{ - mob_zealot_lorkhanAI(Creature *c) : ScriptedAI(c) - { - m_pInstance = c->GetInstanceData(); - } + //Thekal will transform to Tiger if he died and was not resurrected after 10 seconds. + if (!PhaseTwo && WasDead) + { + if (Resurrect_Timer <= diff) + { + DoCast(me, SPELL_TIGER_FORM); + me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetHealth(int(me->GetMaxHealth()*1.0)); + const CreatureInfo *cinfo = me->GetCreatureInfo(); + me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 40))); + me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 40))); + me->UpdateDamagePhysical(BASE_ATTACK); + DoResetThreat(); + PhaseTwo = true; + } else Resurrect_Timer -= diff; + } - uint32 Shield_Timer; - uint32 BloodLust_Timer; - uint32 GreaterHeal_Timer; - uint32 Disarm_Timer; - uint32 Check_Timer; + if ((me->GetHealth()*100 / me->GetMaxHealth() == 100) && WasDead) + { + WasDead = false; + } - bool FakeDeath; + if (PhaseTwo) + { + if (Charge_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + DoCast(pTarget, SPELL_CHARGE); + DoResetThreat(); + AttackStart(pTarget); + } - ScriptedInstance *m_pInstance; + Charge_Timer = 15000 + rand()%7000; + } else Charge_Timer -= diff; - void Reset() - { - Shield_Timer = 1000; - BloodLust_Timer = 16000; - GreaterHeal_Timer = 32000; - Disarm_Timer = 6000; - Check_Timer = 10000; + if (Frenzy_Timer <= diff) + { + DoCast(me, SPELL_FRENZY); + Frenzy_Timer = 30000; + } else Frenzy_Timer -= diff; - FakeDeath = false; + if (ForcePunch_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SILENCE); + ForcePunch_Timer = 16000 + rand()%5000; + } else ForcePunch_Timer -= diff; - if (m_pInstance) - m_pInstance->SetData(TYPE_LORKHAN, NOT_STARTED); + if (SummonTigers_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SUMMONTIGERS); + SummonTigers_Timer = 10000 + rand()%4000; + } else SummonTigers_Timer -= diff; - me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } + if ((me->GetHealth()*100 / me->GetMaxHealth() < 11) && !Enraged) + { + DoCast(me, SPELL_ENRAGE); + Enraged = true; + } + } - void EnterCombat(Unit * /*who*/) - { - } + DoMeleeAttackIfReady(); - void UpdateAI (const uint32 diff) - { - if (!UpdateVictim()) - return; + } + }; - //Shield_Timer - if (Shield_Timer <= diff) + CreatureAI* GetAI(Creature* creature) const { - DoCast(me, SPELL_SHIELD); - Shield_Timer = 61000; - } else Shield_Timer -= diff; + return new boss_thekalAI(creature); + } +}; + +//Zealot Lor'Khan +class mob_zealot_lorkhan : public CreatureScript +{ + public: - //BloodLust_Timer - if (BloodLust_Timer <= diff) + mob_zealot_lorkhan() + : CreatureScript("mob_zealot_lorkhan") { - DoCast(me, SPELL_BLOODLUST); - BloodLust_Timer = 20000+rand()%8000; - } else BloodLust_Timer -= diff; + } - //Casting Greaterheal to Thekal or Zath if they are in meele range. - if (GreaterHeal_Timer <= diff) + struct mob_zealot_lorkhanAI : public ScriptedAI { - if (m_pInstance) + mob_zealot_lorkhanAI(Creature *c) : ScriptedAI(c) { - Unit *pThekal = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_THEKAL)); - Unit *pZath = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_ZATH)); + m_pInstance = c->GetInstanceData(); + } - if (!pThekal || !pZath) - return; + uint32 Shield_Timer; + uint32 BloodLust_Timer; + uint32 GreaterHeal_Timer; + uint32 Disarm_Timer; + uint32 Check_Timer; - switch (urand(0,1)) - { - case 0: - if (me->IsWithinMeleeRange(pThekal)) - DoCast(pThekal, SPELL_GREATERHEAL); - break; - case 1: - if (me->IsWithinMeleeRange(pZath)) - DoCast(pZath, SPELL_GREATERHEAL); - break; - } - } + bool FakeDeath; - GreaterHeal_Timer = 15000+rand()%5000; - } else GreaterHeal_Timer -= diff; + ScriptedInstance *m_pInstance; - //Disarm_Timer - if (Disarm_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_DISARM); - Disarm_Timer = 15000+rand()%10000; - } else Disarm_Timer -= diff; + void Reset() + { + Shield_Timer = 1000; + BloodLust_Timer = 16000; + GreaterHeal_Timer = 32000; + Disarm_Timer = 6000; + Check_Timer = 10000; - //Check_Timer for the death of LorKhan and Zath. - if (!FakeDeath && Check_Timer <= diff) - { - if (m_pInstance) + FakeDeath = false; + + if (m_pInstance) + m_pInstance->SetData(TYPE_LORKHAN, NOT_STARTED); + + me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI (const uint32 diff) { - if (m_pInstance->GetData(TYPE_THEKAL) == SPECIAL) + if (!UpdateVictim()) + return; + + //Shield_Timer + if (Shield_Timer <= diff) { - //Resurrect Thekal - if (Unit *pThekal = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_THEKAL))) + DoCast(me, SPELL_SHIELD); + Shield_Timer = 61000; + } else Shield_Timer -= diff; + + //BloodLust_Timer + if (BloodLust_Timer <= diff) + { + DoCast(me, SPELL_BLOODLUST); + BloodLust_Timer = 20000+rand()%8000; + } else BloodLust_Timer -= diff; + + //Casting Greaterheal to Thekal or Zath if they are in meele range. + if (GreaterHeal_Timer <= diff) + { + if (m_pInstance) { - pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pThekal->setFaction(14); - pThekal->SetHealth(int(pThekal->GetMaxHealth()*1.0)); + Unit *pThekal = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_THEKAL)); + Unit *pZath = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_ZATH)); + + if (!pThekal || !pZath) + return; + + switch (urand(0,1)) + { + case 0: + if (me->IsWithinMeleeRange(pThekal)) + DoCast(pThekal, SPELL_GREATERHEAL); + break; + case 1: + if (me->IsWithinMeleeRange(pZath)) + DoCast(pZath, SPELL_GREATERHEAL); + break; + } } - } - if (m_pInstance->GetData(TYPE_ZATH) == SPECIAL) + GreaterHeal_Timer = 15000+rand()%5000; + } else GreaterHeal_Timer -= diff; + + //Disarm_Timer + if (Disarm_Timer <= diff) { - //Resurrect Zath - if (Unit *pZath = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_ZATH))) + DoCast(me->getVictim(), SPELL_DISARM); + Disarm_Timer = 15000+rand()%10000; + } else Disarm_Timer -= diff; + + //Check_Timer for the death of LorKhan and Zath. + if (!FakeDeath && Check_Timer <= diff) + { + if (m_pInstance) { - pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pZath->setFaction(14); - pZath->SetHealth(int(pZath->GetMaxHealth()*1.0)); + if (m_pInstance->GetData(TYPE_THEKAL) == SPECIAL) + { + //Resurrect Thekal + if (Unit *pThekal = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_THEKAL))) + { + pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pThekal->setFaction(14); + pThekal->SetHealth(int(pThekal->GetMaxHealth()*1.0)); + } + } + + if (m_pInstance->GetData(TYPE_ZATH) == SPECIAL) + { + //Resurrect Zath + if (Unit *pZath = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_ZATH))) + { + pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pZath->setFaction(14); + pZath->SetHealth(int(pZath->GetMaxHealth()*1.0)); + } + } } - } - } - Check_Timer = 5000; - } else Check_Timer -= diff; + Check_Timer = 5000; + } else Check_Timer -= diff; - if (me->GetHealth() <= me->GetMaxHealth() * 0.05) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetStandState(UNIT_STAND_STATE_SLEEP); - me->setFaction(35); - me->AttackStop(); + if (me->GetHealth() <= me->GetMaxHealth() * 0.05) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetStandState(UNIT_STAND_STATE_SLEEP); + me->setFaction(35); + me->AttackStop(); - if (m_pInstance) - m_pInstance->SetData(TYPE_LORKHAN, SPECIAL); + if (m_pInstance) + m_pInstance->SetData(TYPE_LORKHAN, SPECIAL); - FakeDeath = true; - } + FakeDeath = true; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new mob_zealot_lorkhanAI(creature); + } }; //Zealot Zath -struct mob_zealot_zathAI : public ScriptedAI +class mob_zealot_zath : public CreatureScript { - mob_zealot_zathAI(Creature *c) : ScriptedAI(c) - { - m_pInstance = c->GetInstanceData(); - } - - uint32 SweepingStrikes_Timer; - uint32 SinisterStrike_Timer; - uint32 Gouge_Timer; - uint32 Kick_Timer; - uint32 Blind_Timer; - uint32 Check_Timer; - - bool FakeDeath; - - ScriptedInstance *m_pInstance; - - void Reset() - { - SweepingStrikes_Timer = 13000; - SinisterStrike_Timer = 8000; - Gouge_Timer = 25000; - Kick_Timer = 18000; - Blind_Timer = 5000; - Check_Timer = 10000; - - FakeDeath = false; - - if (m_pInstance) - m_pInstance->SetData(TYPE_ZATH, NOT_STARTED); - - me->SetStandState(UNIT_STAND_STATE_STAND); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI (const uint32 diff) - { - if (!UpdateVictim()) - return; - - //SweepingStrikes_Timer - if (SweepingStrikes_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SWEEPINGSTRIKES); - SweepingStrikes_Timer = 22000+rand()%4000; - } else SweepingStrikes_Timer -= diff; + public: - //SinisterStrike_Timer - if (SinisterStrike_Timer <= diff) + mob_zealot_zath() + : CreatureScript("mob_zealot_zath") { - DoCast(me->getVictim(), SPELL_SINISTERSTRIKE); - SinisterStrike_Timer = 8000+rand()%8000; - } else SinisterStrike_Timer -= diff; + } - //Gouge_Timer - if (Gouge_Timer <= diff) + struct mob_zealot_zathAI : public ScriptedAI { - DoCast(me->getVictim(), SPELL_GOUGE); + mob_zealot_zathAI(Creature *c) : ScriptedAI(c) + { + m_pInstance = c->GetInstanceData(); + } - if (DoGetThreat(me->getVictim())) - DoModifyThreatPercent(me->getVictim(),-100); + uint32 SweepingStrikes_Timer; + uint32 SinisterStrike_Timer; + uint32 Gouge_Timer; + uint32 Kick_Timer; + uint32 Blind_Timer; + uint32 Check_Timer; - Gouge_Timer = 17000+rand()%10000; - } else Gouge_Timer -= diff; + bool FakeDeath; - //Kick_Timer - if (Kick_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_KICK); - Kick_Timer = 15000+rand()%10000; - } else Kick_Timer -= diff; + ScriptedInstance *m_pInstance; - //Blind_Timer - if (Blind_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_BLIND); - Blind_Timer = 10000+rand()%10000; - } else Blind_Timer -= diff; + void Reset() + { + SweepingStrikes_Timer = 13000; + SinisterStrike_Timer = 8000; + Gouge_Timer = 25000; + Kick_Timer = 18000; + Blind_Timer = 5000; + Check_Timer = 10000; - //Check_Timer for the death of LorKhan and Zath. - if (!FakeDeath && Check_Timer <= diff) - { - if (m_pInstance) + FakeDeath = false; + + if (m_pInstance) + m_pInstance->SetData(TYPE_ZATH, NOT_STARTED); + + me->SetStandState(UNIT_STAND_STATE_STAND); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI (const uint32 diff) { - if (m_pInstance->GetData(TYPE_LORKHAN) == SPECIAL) + if (!UpdateVictim()) + return; + + //SweepingStrikes_Timer + if (SweepingStrikes_Timer <= diff) { - //Resurrect LorKhan - if (Unit *pLorKhan = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_LORKHAN))) - { - pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pLorKhan->setFaction(14); - pLorKhan->SetHealth(int(pLorKhan->GetMaxHealth()*1.0)); - } - } + DoCast(me->getVictim(), SPELL_SWEEPINGSTRIKES); + SweepingStrikes_Timer = 22000+rand()%4000; + } else SweepingStrikes_Timer -= diff; - if (m_pInstance->GetData(TYPE_THEKAL) == SPECIAL) + //SinisterStrike_Timer + if (SinisterStrike_Timer <= diff) { - //Resurrect Thekal - if (Unit *pThekal = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_THEKAL))) - { - pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pThekal->setFaction(14); - pThekal->SetHealth(int(pThekal->GetMaxHealth()*1.0)); - } - } - } + DoCast(me->getVictim(), SPELL_SINISTERSTRIKE); + SinisterStrike_Timer = 8000+rand()%8000; + } else SinisterStrike_Timer -= diff; - Check_Timer = 5000; - } else Check_Timer -= diff; + //Gouge_Timer + if (Gouge_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_GOUGE); - if (me->GetHealth() <= me->GetMaxHealth() * 0.05) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetStandState(UNIT_STAND_STATE_SLEEP); - me->setFaction(35); - me->AttackStop(); + if (DoGetThreat(me->getVictim())) + DoModifyThreatPercent(me->getVictim(),-100); - if (m_pInstance) - m_pInstance->SetData(TYPE_ZATH, SPECIAL); + Gouge_Timer = 17000+rand()%10000; + } else Gouge_Timer -= diff; - FakeDeath = true; - } + //Kick_Timer + if (Kick_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KICK); + Kick_Timer = 15000+rand()%10000; + } else Kick_Timer -= diff; - DoMeleeAttackIfReady(); - } -}; + //Blind_Timer + if (Blind_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_BLIND); + Blind_Timer = 10000+rand()%10000; + } else Blind_Timer -= diff; -CreatureAI* GetAI_boss_thekal(Creature* pCreature) -{ - return new boss_thekalAI (pCreature); -} + //Check_Timer for the death of LorKhan and Zath. + if (!FakeDeath && Check_Timer <= diff) + { + if (m_pInstance) + { + if (m_pInstance->GetData(TYPE_LORKHAN) == SPECIAL) + { + //Resurrect LorKhan + if (Unit *pLorKhan = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_LORKHAN))) + { + pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pLorKhan->setFaction(14); + pLorKhan->SetHealth(int(pLorKhan->GetMaxHealth()*1.0)); + } + } -CreatureAI* GetAI_mob_zealot_lorkhan(Creature* pCreature) -{ - return new mob_zealot_lorkhanAI (pCreature); -} + if (m_pInstance->GetData(TYPE_THEKAL) == SPECIAL) + { + //Resurrect Thekal + if (Unit *pThekal = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_THEKAL))) + { + pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pThekal->setFaction(14); + pThekal->SetHealth(int(pThekal->GetMaxHealth()*1.0)); + } + } + } -CreatureAI* GetAI_mob_zealot_zath(Creature* pCreature) -{ - return new mob_zealot_zathAI (pCreature); -} + Check_Timer = 5000; + } else Check_Timer -= diff; + + if (me->GetHealth() <= me->GetMaxHealth() * 0.05) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetStandState(UNIT_STAND_STATE_SLEEP); + me->setFaction(35); + me->AttackStop(); + + if (m_pInstance) + m_pInstance->SetData(TYPE_ZATH, SPECIAL); + + FakeDeath = true; + } + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new mob_zealot_zathAI(creature); + } +}; void AddSC_boss_thekal() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_thekal"; - newscript->GetAI = &GetAI_boss_thekal; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_zealot_lorkhan"; - newscript->GetAI = &GetAI_mob_zealot_lorkhan; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_zealot_zath"; - newscript->GetAI = &GetAI_mob_zealot_zath; - newscript->RegisterSelf(); + new boss_thekal(); + new mob_zealot_lorkhan(); + new mob_zealot_zath(); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp index f7e1ae27296..b3530fb1a29 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp @@ -39,163 +39,169 @@ EndScriptData */ #define SPELL_BERSERK 23537 #define SPELL_DISPELL 23859 -struct boss_venoxisAI : public ScriptedAI +class boss_venoxis : public CreatureScript { - boss_venoxisAI(Creature *c) : ScriptedAI(c) - { - m_pInstance = c->GetInstanceData(); - } - - ScriptedInstance *m_pInstance; - - uint32 HolyFire_Timer; - uint32 HolyWrath_Timer; - uint32 VenomSpit_Timer; - uint32 Renew_Timer; - uint32 PoisonCloud_Timer; - uint32 HolyNova_Timer; - uint32 Dispell_Timer; - uint32 TargetInRange; - - bool PhaseTwo; - bool InBerserk; - - void Reset() - { - HolyFire_Timer = 10000; - HolyWrath_Timer = 60500; - VenomSpit_Timer = 5500; - Renew_Timer = 30500; - PoisonCloud_Timer = 2000; - HolyNova_Timer = 5000; - Dispell_Timer = 35000; - TargetInRange = 0; - - PhaseTwo = false; - InBerserk= false; - } - - void EnterCombat(Unit * /*who*/) - { - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - if (m_pInstance) - m_pInstance->SetData(TYPE_VENOXIS, DONE); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if ((me->GetHealth()*100 / me->GetMaxHealth() > 50)) + public: + + boss_venoxis() + : CreatureScript("boss_venoxis") + { + } + + struct boss_venoxisAI : public ScriptedAI + { + boss_venoxisAI(Creature *c) : ScriptedAI(c) { - if (Dispell_Timer <= diff) - { - DoCast(me, SPELL_DISPELL); - Dispell_Timer = 15000 + rand()%15000; - } else Dispell_Timer -= diff; - - if (Renew_Timer <= diff) - { - DoCast(me, SPELL_RENEW); - Renew_Timer = 20000 + rand()%10000; - } else Renew_Timer -= diff; - - if (HolyWrath_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_HOLY_WRATH); - HolyWrath_Timer = 15000 + rand()%10000; - } else HolyWrath_Timer -= diff; - - if (HolyNova_Timer <= diff) - { - TargetInRange = 0; - for (uint8 i = 0; i < 10; ++i) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,i)) - if (me->IsWithinMeleeRange(pTarget)) - ++TargetInRange; - } + m_pInstance = c->GetInstanceData(); + } - if (TargetInRange > 1) - { - DoCast(me->getVictim(), SPELL_HOLY_NOVA); - HolyNova_Timer = 1000; - } - else - { - HolyNova_Timer = 2000; - } + ScriptedInstance *m_pInstance; - } else HolyNova_Timer -= diff; + uint32 HolyFire_Timer; + uint32 HolyWrath_Timer; + uint32 VenomSpit_Timer; + uint32 Renew_Timer; + uint32 PoisonCloud_Timer; + uint32 HolyNova_Timer; + uint32 Dispell_Timer; + uint32 TargetInRange; + + bool PhaseTwo; + bool InBerserk; + + void Reset() + { + HolyFire_Timer = 10000; + HolyWrath_Timer = 60500; + VenomSpit_Timer = 5500; + Renew_Timer = 30500; + PoisonCloud_Timer = 2000; + HolyNova_Timer = 5000; + Dispell_Timer = 35000; + TargetInRange = 0; + + PhaseTwo = false; + InBerserk= false; + } - if (HolyFire_Timer < diff && TargetInRange < 3) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_HOLY_FIRE); + void EnterCombat(Unit * /*who*/) + { + } - HolyFire_Timer = 8000; - } else HolyFire_Timer -= diff; + void JustDied(Unit* /*Killer*/) + { + DoScriptText(SAY_DEATH, me); + if (m_pInstance) + m_pInstance->SetData(TYPE_VENOXIS, DONE); } - else + + void UpdateAI(const uint32 diff) { - if (!PhaseTwo) - { - DoScriptText(SAY_TRANSFORM, me); - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_SNAKE_FORM); - me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f); - const CreatureInfo *cinfo = me->GetCreatureInfo(); - me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 25))); - me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 25))); - me->UpdateDamagePhysical(BASE_ATTACK); - DoResetThreat(); - PhaseTwo = true; - } - - if (PhaseTwo && PoisonCloud_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_POISON_CLOUD); - PoisonCloud_Timer = 15000; - }PoisonCloud_Timer -=diff; - - if (PhaseTwo && VenomSpit_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_VENOMSPIT); - - VenomSpit_Timer = 15000 + rand()%5000; - } else VenomSpit_Timer -= diff; - - if (PhaseTwo && (me->GetHealth()*100 / me->GetMaxHealth() < 11)) - { - if (!InBerserk) + if (!UpdateVictim()) + return; + + if ((me->GetHealth()*100 / me->GetMaxHealth() > 50)) { - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_BERSERK); - InBerserk = true; + if (Dispell_Timer <= diff) + { + DoCast(me, SPELL_DISPELL); + Dispell_Timer = 15000 + rand()%15000; + } else Dispell_Timer -= diff; + + if (Renew_Timer <= diff) + { + DoCast(me, SPELL_RENEW); + Renew_Timer = 20000 + rand()%10000; + } else Renew_Timer -= diff; + + if (HolyWrath_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_HOLY_WRATH); + HolyWrath_Timer = 15000 + rand()%10000; + } else HolyWrath_Timer -= diff; + + if (HolyNova_Timer <= diff) + { + TargetInRange = 0; + for (uint8 i = 0; i < 10; ++i) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,i)) + if (me->IsWithinMeleeRange(pTarget)) + ++TargetInRange; + } + + if (TargetInRange > 1) + { + DoCast(me->getVictim(), SPELL_HOLY_NOVA); + HolyNova_Timer = 1000; + } + else + { + HolyNova_Timer = 2000; + } + + } else HolyNova_Timer -= diff; + + if (HolyFire_Timer < diff && TargetInRange < 3) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_HOLY_FIRE); + + HolyFire_Timer = 8000; + } else HolyFire_Timer -= diff; } - } + else + { + if (!PhaseTwo) + { + DoScriptText(SAY_TRANSFORM, me); + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_SNAKE_FORM); + me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f); + const CreatureInfo *cinfo = me->GetCreatureInfo(); + me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 25))); + me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 25))); + me->UpdateDamagePhysical(BASE_ATTACK); + DoResetThreat(); + PhaseTwo = true; + } + + if (PhaseTwo && PoisonCloud_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_POISON_CLOUD); + PoisonCloud_Timer = 15000; + }PoisonCloud_Timer -=diff; + + if (PhaseTwo && VenomSpit_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_VENOMSPIT); + + VenomSpit_Timer = 15000 + rand()%5000; + } else VenomSpit_Timer -= diff; + + if (PhaseTwo && (me->GetHealth()*100 / me->GetMaxHealth() < 11)) + { + if (!InBerserk) + { + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_BERSERK); + InBerserk = true; + } + } + } + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } -}; + }; -CreatureAI* GetAI_boss_venoxis(Creature* pCreature) -{ - return new boss_venoxisAI (pCreature); -} + CreatureAI* GetAI(Creature* creature) const + { + return new boss_venoxisAI(creature); + } +}; void AddSC_boss_venoxis() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_venoxis"; - newscript->GetAI = &GetAI_boss_venoxis; - newscript->RegisterSelf(); + new boss_venoxis(); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp index 051e556b698..829bfe3354a 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp @@ -29,59 +29,66 @@ EndScriptData */ #define SPELL_LIGHTNINGCLOUD 25033 #define SPELL_LIGHTNINGWAVE 24819 -struct boss_wushoolayAI : public ScriptedAI +class boss_wushoolay : public CreatureScript { - boss_wushoolayAI(Creature *c) : ScriptedAI(c) {} + public: - uint32 LightningCloud_Timer; - uint32 LightningWave_Timer; + boss_wushoolay() + : CreatureScript("boss_wushoolay") + { + } - void Reset() - { - LightningCloud_Timer = 5000 + rand()%5000; - LightningWave_Timer = 8000 + rand()%8000; - } + struct boss_wushoolayAI : public ScriptedAI + { + boss_wushoolayAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit * /*who*/) - { - } + uint32 LightningCloud_Timer; + uint32 LightningWave_Timer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void Reset() + { + LightningCloud_Timer = 5000 + rand()%5000; + LightningWave_Timer = 8000 + rand()%8000; + } - //LightningCloud_Timer - if (LightningCloud_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_LIGHTNINGCLOUD); - LightningCloud_Timer = 15000 + rand()%5000; - } else LightningCloud_Timer -= diff; + void EnterCombat(Unit * /*who*/) + { + } - //LightningWave_Timer - if (LightningWave_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) DoCast(pTarget, SPELL_LIGHTNINGWAVE); + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //LightningCloud_Timer + if (LightningCloud_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_LIGHTNINGCLOUD); + LightningCloud_Timer = 15000 + rand()%5000; + } else LightningCloud_Timer -= diff; - LightningWave_Timer = 12000 + rand()%4000; - } else LightningWave_Timer -= diff; + //LightningWave_Timer + if (LightningWave_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) DoCast(pTarget, SPELL_LIGHTNINGWAVE); - DoMeleeAttackIfReady(); - } + LightningWave_Timer = 12000 + rand()%4000; + } else LightningWave_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_wushoolayAI(creature); + } }; -CreatureAI* GetAI_boss_wushoolay(Creature* pCreature) -{ - return new boss_wushoolayAI (pCreature); -} void AddSC_boss_wushoolay() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_wushoolay"; - newscript->GetAI = &GetAI_boss_wushoolay; - newscript->RegisterSelf(); + new boss_wushoolay(); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp index 89f30ff134e..6649ea66528 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp @@ -26,136 +26,140 @@ EndScriptData */ #include "ScriptPCH.h" #include "zulgurub.h" -struct instance_zulgurub : public ScriptedInstance +class instance_zulgurub : public InstanceMapScript { - instance_zulgurub(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - //If all High Priest bosses were killed. Lorkhan, Zath and Ohgan are added too. - uint32 m_auiEncounter[MAX_ENCOUNTERS]; - - //Storing Lorkhan, Zath and Thekal because we need to cast on them later. Jindo is needed for healfunction too. - uint64 m_uiLorKhanGUID; - uint64 m_uiZathGUID; - uint64 m_uiThekalGUID; - uint64 m_uiJindoGUID; - - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - m_uiLorKhanGUID = 0; - m_uiZathGUID = 0; - m_uiThekalGUID = 0; - m_uiJindoGUID = 0; - } - - bool IsEncounterInProgress() const - { - //not active in Zul'Gurub - return false; - } - - void OnCreatureCreate(Creature* pCreature) - { - switch(pCreature->GetEntry()) + public: + instance_zulgurub() + : InstanceMapScript("instance_zulgurub") { - case 11347: m_uiLorKhanGUID = pCreature->GetGUID(); break; - case 11348: m_uiZathGUID = pCreature->GetGUID(); break; - case 14509: m_uiThekalGUID = pCreature->GetGUID(); break; - case 11380: m_uiJindoGUID = pCreature->GetGUID(); break; } - } - void SetData(uint32 uiType, uint32 uiData) - { - switch(uiType) + struct instance_zulgurub_InstanceMapScript : public ScriptedInstance { - case TYPE_ARLOKK: - m_auiEncounter[0] = uiData; - break; - - case TYPE_JEKLIK: - m_auiEncounter[1] = uiData; - break; - - case TYPE_VENOXIS: - m_auiEncounter[2] = uiData; - break; - - case TYPE_MARLI: - m_auiEncounter[3] = uiData; - break; - - case TYPE_THEKAL: - m_auiEncounter[4] = uiData; - break; - - case TYPE_LORKHAN: - m_auiEncounter[5] = uiData; - break; - - case TYPE_ZATH: - m_auiEncounter[6] = uiData; - break; - - case TYPE_OHGAN: - m_auiEncounter[7] = uiData; - break; - } - } - - uint32 GetData(uint32 uiType) - { - switch(uiType) - { - case TYPE_ARLOKK: - return m_auiEncounter[0]; - case TYPE_JEKLIK: - return m_auiEncounter[1]; - case TYPE_VENOXIS: - return m_auiEncounter[2]; - case TYPE_MARLI: - return m_auiEncounter[3]; - case TYPE_THEKAL: - return m_auiEncounter[4]; - case TYPE_LORKHAN: - return m_auiEncounter[5]; - case TYPE_ZATH: - return m_auiEncounter[6]; - case TYPE_OHGAN: - return m_auiEncounter[7]; - } - return 0; - } - - uint64 GetData64(uint32 uiData) - { - switch(uiData) + instance_zulgurub(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + + //If all High Priest bosses were killed. Lorkhan, Zath and Ohgan are added too. + uint32 m_auiEncounter[MAX_ENCOUNTERS]; + + //Storing Lorkhan, Zath and Thekal because we need to cast on them later. Jindo is needed for healfunction too. + uint64 m_uiLorKhanGUID; + uint64 m_uiZathGUID; + uint64 m_uiThekalGUID; + uint64 m_uiJindoGUID; + + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + m_uiLorKhanGUID = 0; + m_uiZathGUID = 0; + m_uiThekalGUID = 0; + m_uiJindoGUID = 0; + } + + bool IsEncounterInProgress() const + { + //not active in Zul'Gurub + return false; + } + + void OnCreatureCreate(Creature* pCreature) + { + switch(pCreature->GetEntry()) + { + case 11347: m_uiLorKhanGUID = pCreature->GetGUID(); break; + case 11348: m_uiZathGUID = pCreature->GetGUID(); break; + case 14509: m_uiThekalGUID = pCreature->GetGUID(); break; + case 11380: m_uiJindoGUID = pCreature->GetGUID(); break; + } + } + + void SetData(uint32 uiType, uint32 uiData) + { + switch(uiType) + { + case TYPE_ARLOKK: + m_auiEncounter[0] = uiData; + break; + + case TYPE_JEKLIK: + m_auiEncounter[1] = uiData; + break; + + case TYPE_VENOXIS: + m_auiEncounter[2] = uiData; + break; + + case TYPE_MARLI: + m_auiEncounter[3] = uiData; + break; + + case TYPE_THEKAL: + m_auiEncounter[4] = uiData; + break; + + case TYPE_LORKHAN: + m_auiEncounter[5] = uiData; + break; + + case TYPE_ZATH: + m_auiEncounter[6] = uiData; + break; + + case TYPE_OHGAN: + m_auiEncounter[7] = uiData; + break; + } + } + + uint32 GetData(uint32 uiType) + { + switch(uiType) + { + case TYPE_ARLOKK: + return m_auiEncounter[0]; + case TYPE_JEKLIK: + return m_auiEncounter[1]; + case TYPE_VENOXIS: + return m_auiEncounter[2]; + case TYPE_MARLI: + return m_auiEncounter[3]; + case TYPE_THEKAL: + return m_auiEncounter[4]; + case TYPE_LORKHAN: + return m_auiEncounter[5]; + case TYPE_ZATH: + return m_auiEncounter[6]; + case TYPE_OHGAN: + return m_auiEncounter[7]; + } + return 0; + } + + uint64 GetData64(uint32 uiData) + { + switch(uiData) + { + case DATA_LORKHAN: + return m_uiLorKhanGUID; + case DATA_ZATH: + return m_uiZathGUID; + case DATA_THEKAL: + return m_uiThekalGUID; + case DATA_JINDO: + return m_uiJindoGUID; + } + return 0; + } + }; + + InstanceData* OnGetInstanceData(InstanceMap* pMap) { - case DATA_LORKHAN: - return m_uiLorKhanGUID; - case DATA_ZATH: - return m_uiZathGUID; - case DATA_THEKAL: - return m_uiThekalGUID; - case DATA_JINDO: - return m_uiJindoGUID; + return new instance_zulgurub_InstanceMapScript(pMap); } - return 0; - } }; -InstanceData* GetInstanceData_instance_zulgurub(Map* pMap) -{ - return new instance_zulgurub(pMap); -} - void AddSC_instance_zulgurub() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_zulgurub"; - newscript->GetInstanceData = &GetInstanceData_instance_zulgurub; - newscript->RegisterSelf(); -} - + new instance_zulgurub(); +}
\ No newline at end of file |