diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index 216aa247b..ff07548e3 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -212,6 +212,13 @@ enum Misc WAYPOINT_BLUE = 18, }; +enum AlliesGroup +{ + GROUP_TRIO = 0, + GROUP_CONSERVATOR = 1, + GROUP_LASHERS = 2, +}; + struct boss_freya : public BossAI { boss_freya(Creature* pCreature) : BossAI(pCreature, BOSS_FREYA) @@ -220,9 +227,9 @@ struct boss_freya : public BossAI instance->SetBossState(BOSS_FREYA, DONE); } - uint8 _waveNumber; uint8 _trioKilled; uint8 _spawnedAmount; + uint8 _setPermutation; uint8 _lumberjacked; bool _respawningTrio; bool _backToNature; @@ -248,7 +255,7 @@ struct boss_freya : public BossAI _lumberjacked = 0; _spawnedAmount = 0; _trioKilled = 0; - _waveNumber = urand(1, 3); + _setPermutation = urand(0, 5); _respawningTrio = false; _backToNature = true; _deforestation = 0; @@ -329,37 +336,42 @@ struct boss_freya : public BossAI void SpawnWave() { - _waveNumber = _waveNumber == 1 ? 3 : _waveNumber - 1; Talk(EMOTE_ALLIES_OF_NATURE); - // Wave of three - if (_waveNumber == 1) + static constexpr uint8 permTable[6][3] = { + {GROUP_TRIO, GROUP_CONSERVATOR, GROUP_LASHERS}, + {GROUP_TRIO, GROUP_LASHERS, GROUP_CONSERVATOR}, + {GROUP_CONSERVATOR, GROUP_TRIO, GROUP_LASHERS}, + {GROUP_CONSERVATOR, GROUP_LASHERS, GROUP_TRIO}, + {GROUP_LASHERS, GROUP_TRIO, GROUP_CONSERVATOR}, + {GROUP_LASHERS, GROUP_CONSERVATOR, GROUP_TRIO} + }; + + switch (permTable[_setPermutation][_spawnedAmount % 3]) { - Talk(SAY_SUMMON_TRIO); - me->SummonCreature(NPC_ANCIENT_WATER_SPIRIT, me->GetPositionX() + urand(5, 15), me->GetPositionY() + urand(5, 15), me->GetMapHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - me->SummonCreature(NPC_STORM_LASHER, me->GetPositionX() + urand(5, 15), me->GetPositionY() + urand(5, 15), me->GetMapHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - me->SummonCreature(NPC_SNAPLASHER, me->GetPositionX() + urand(5, 15), me->GetPositionY() + urand(5, 15), me->GetMapHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - } - // Ancient Conservator - else if (_waveNumber == 2) - { - Talk(SAY_SUMMON_CONSERVATOR); - me->SummonCreature(NPC_ANCIENT_CONSERVATOR, me->GetPositionX() + urand(5, 15), me->GetPositionY() + urand(5, 15), me->GetMapHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()), 0, TEMPSUMMON_CORPSE_DESPAWN); - } - // Detonating Lashers - else if (_waveNumber == 3) - { - Talk(SAY_SUMMON_LASHERS); - // Spread the lashers evenly in a ring around Freya instead of - // clustering them in one spot, matching retail. - for (uint8 i = 0; i < 10; ++i) - { - float angle = i * 2.0f * float(M_PI) / 10.0f + frand(-0.35f, 0.35f); - float dist = frand(18.0f, 28.0f); - float x = me->GetPositionX() + dist * std::cos(angle); - float y = me->GetPositionY() + dist * std::sin(angle); - me->SummonCreature(NPC_DETONATING_LASHER, x, y, me->GetMapHeight(x, y, me->GetPositionZ()), 0, TEMPSUMMON_CORPSE_DESPAWN); - } + case GROUP_TRIO: + Talk(SAY_SUMMON_TRIO); + me->SummonCreature(NPC_ANCIENT_WATER_SPIRIT, me->GetPositionX() + urand(5, 15), me->GetPositionY() + urand(5, 15), me->GetMapHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + me->SummonCreature(NPC_STORM_LASHER, me->GetPositionX() + urand(5, 15), me->GetPositionY() + urand(5, 15), me->GetMapHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + me->SummonCreature(NPC_SNAPLASHER, me->GetPositionX() + urand(5, 15), me->GetPositionY() + urand(5, 15), me->GetMapHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + break; + case GROUP_CONSERVATOR: // Ancient Conservator + Talk(SAY_SUMMON_CONSERVATOR); + me->SummonCreature(NPC_ANCIENT_CONSERVATOR, me->GetPositionX() + urand(5, 15), me->GetPositionY() + urand(5, 15), me->GetMapHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()), 0, TEMPSUMMON_CORPSE_DESPAWN); + break; + case GROUP_LASHERS: // Detonating Lashers + Talk(SAY_SUMMON_LASHERS); + // Spread the lashers evenly in a ring around Freya instead of + // clustering them in one spot, matching retail. + for (uint8 i = 0; i < 10; ++i) + { + float angle = i * 2.0f * float(M_PI) / 10.0f + frand(-0.35f, 0.35f); + float dist = frand(18.0f, 28.0f); + float x = me->GetPositionX() + dist * std::cos(angle); + float y = me->GetPositionY() + dist * std::sin(angle); + me->SummonCreature(NPC_DETONATING_LASHER, x, y, me->GetMapHeight(x, y, me->GetPositionZ()), 0, TEMPSUMMON_CORPSE_DESPAWN); + } + break; } }