diff options
Diffstat (limited to 'src/server/scripts')
44 files changed, 216 insertions, 203 deletions
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 9cf8c041883..66988b499d2 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -1403,7 +1403,7 @@ public: // place pet before player float x, y, z; player->GetClosePoint (x, y, z, creatureTarget->GetObjectSize(), CONTACT_DISTANCE); - pet->Relocate(x, y, z, M_PI-player->GetOrientation()); + pet->Relocate(x, y, z, float(M_PI) - player->GetOrientation()); // set pet to defensive mode by default (some classes can't control controlled pets in fact). pet->SetReactState(REACT_DEFENSIVE); @@ -1458,8 +1458,8 @@ public: FormationInfo* group_member; group_member = new FormationInfo; - group_member->follow_angle = (creature->GetAngle(chr) - chr->GetOrientation()) * 180 / M_PI; - group_member->follow_dist = sqrtf(pow(chr->GetPositionX() - creature->GetPositionX(), int(2))+pow(chr->GetPositionY() - creature->GetPositionY(), int(2))); + group_member->follow_angle = (creature->GetAngle(chr) - chr->GetOrientation()) * 180 / float(M_PI); + group_member->follow_dist = std::sqrt(std::pow(chr->GetPositionX() - creature->GetPositionX(), 2.f) + std::pow(chr->GetPositionY() - creature->GetPositionY(), 2.f)); group_member->leaderGUID = leaderGUID; group_member->groupAI = 0; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index e495cae71fc..ac24f868670 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -124,7 +124,7 @@ public: float dist(float xa, float ya, float xb, float yb) // auxiliary method for distance { - return sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb)); + return std::sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb)); } void Reset() override diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index c8df08937b9..af9f8b72abf 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -328,7 +328,7 @@ public: if (TailSweepTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - if (!me->HasInArc(M_PI, target)) + if (!me->HasInArc(float(M_PI), target)) DoCast(target, SPELL_TAIL_SWEEP); TailSweepTimer = 15000; } else TailSweepTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index f86f267b6b9..19ec8da7fc9 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -1290,7 +1290,7 @@ public: if (BackwardLungeTimer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); - if (target && !me->HasInArc(M_PI, target)) + if (target && !me->HasInArc(float(M_PI), target)) { DoCast(target, SPELL_BACKWARD_LUNGE); BackwardLungeTimer = urand(15000, 30000); diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp index 72874bba510..71a5343d160 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp @@ -37,7 +37,7 @@ enum Events { EVENT_CALL_OF_GRAVE = 1, EVENT_TERRIFY, - EVENT_SOUL_SIPHON + EVENT_SOUL_SIPHON }; class boss_azshir_the_sleepless : public CreatureScript @@ -84,7 +84,7 @@ class boss_azshir_the_sleepless : public CreatureScript { if (!UpdateVictim()) return; - + events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp index 43a9ef32be6..18369c7adfc 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp @@ -39,7 +39,7 @@ enum Events EVENT_FLAME_SHOCK = 1, EVENT_SHADOW_BOLT, EVENT_FLAME_SPIKE, - EVENT_FIRE_NOVA + EVENT_FIRE_NOVA }; class boss_bloodmage_thalnos : public CreatureScript diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp index 0b7ad73fefd..d1d25dd2ba6 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp @@ -133,7 +133,7 @@ class boss_herod : public CreatureScript { BossAI::UpdateAI(diff); } - + private: bool _enrage; }; diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h b/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h index 40089cd9817..d4ce3f1614f 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h @@ -45,7 +45,7 @@ enum CreatureIds NPC_MOGRAINE = 3976, NPC_WHITEMANE = 3977, NPC_VORREL = 3981, - + NPC_HORSEMAN = 23682, NPC_HEAD = 23775, NPC_PUMPKIN = 23694 diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index e6029acc61f..1f66f834b28 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -1191,8 +1191,8 @@ public: bPointReached = false; uiCheckTimer = 1000; me->GetMotionMaster()->MovePoint(1, x, y, SHIELD_ORB_Z); - c += M_PI/32; - if (c >= 2*M_PI) c = 0; + c += float(M_PI)/32; + if (c >= 2 * float(M_PI)) c = 0; } else { diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index fa2b9430682..d5260c18add 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -188,7 +188,7 @@ class boss_janalai : public CreatureScript { if (isFlameBreathing) { - if (!me->HasInArc(M_PI/6, target)) + if (!me->HasInArc(float(M_PI) / 6, target)) damage = 0; } } diff --git a/src/server/scripts/Events/childrens_week.cpp b/src/server/scripts/Events/childrens_week.cpp index 353b5ab9501..683b8d36011 100644 --- a/src/server/scripts/Events/childrens_week.cpp +++ b/src/server/scripts/Events/childrens_week.cpp @@ -193,7 +193,7 @@ class npc_winterfin_playmate : public CreatureScript switch (phase) { case 1: - orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ()); + orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ()); orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_1); timer = 3000; break; @@ -292,7 +292,7 @@ class npc_snowfall_glade_playmate : public CreatureScript switch (phase) { case 1: - orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ()); + orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ()); orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_1); timer = 5000; break; @@ -393,7 +393,7 @@ class npc_the_biggest_tree : public CreatureScript switch (phase) { case 1: - orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ()); + orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ()); timer = 2000; break; case 2: @@ -480,7 +480,7 @@ class npc_high_oracle_soo_roo : public CreatureScript switch (phase) { case 1: - orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ()); + orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ()); orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_5); timer = 3000; break; @@ -569,7 +569,7 @@ class npc_elder_kekek : public CreatureScript switch (phase) { case 1: - orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ()); + orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ()); orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_4); timer = 3000; break; @@ -658,7 +658,7 @@ class npc_the_etymidian : public CreatureScript switch (phase) { case 1: - orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ()); + orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ()); orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_7); timer = 5000; break; @@ -780,7 +780,7 @@ class npc_alexstraza_the_lifebinder : public CreatureScript switch (phase) { case 1: - orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ()); + orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ()); orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_11); timer = 5000; break; @@ -811,7 +811,7 @@ class npc_alexstraza_the_lifebinder : public CreatureScript Reset(); return; case 7: - orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ()); + orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ()); orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_11); timer = 5000; break; diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp index ef6d7da5116..ce9ed4f36c8 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp @@ -280,8 +280,8 @@ public: me->SummonCreature(NPC_WITHERED_BATTLE_BOAR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); if (data > 0 && me->GetOrientation() < 4.0f) me->SummonCreature(NPC_WITHERED_BATTLE_BOAR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - me->SummonCreature(NPC_DEATHS_HEAD_GEOMANCER, me->GetPositionX() + (cos(me->GetOrientation() - (M_PI/2)) * 2), me->GetPositionY() + (sin(me->GetOrientation() - (M_PI/2)) * 2), me->GetPositionZ(), me->GetOrientation()); - me->SummonCreature(NPC_WITHERED_QUILGUARD, me->GetPositionX() + (cos(me->GetOrientation() + (M_PI/2)) * 2), me->GetPositionY() + (sin(me->GetOrientation() + (M_PI/2)) * 2), me->GetPositionZ(), me->GetOrientation()); + me->SummonCreature(NPC_DEATHS_HEAD_GEOMANCER, me->GetPositionX() + (std::cos(me->GetOrientation() - (float(M_PI) / 2)) * 2), me->GetPositionY() + (std::sin(me->GetOrientation() - (float(M_PI) / 2)) * 2), me->GetPositionZ(), me->GetOrientation()); + me->SummonCreature(NPC_WITHERED_QUILGUARD, me->GetPositionX() + (std::cos(me->GetOrientation() + (float(M_PI) / 2)) * 2), me->GetPositionY() + (std::sin(me->GetOrientation() + (float(M_PI) / 2)) * 2), me->GetPositionZ(), me->GetOrientation()); } else if (data == 7) me->SummonCreature(NPC_PLAGUEMAW_THE_ROTTING, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index dd0c93e8a28..2cfd977fe99 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -334,9 +334,9 @@ public: { //Set angle and cast if (ClockWise) - me->SetOrientation(DarkGlareAngle + DarkGlareTick * M_PI / 35); + me->SetOrientation(DarkGlareAngle + DarkGlareTick * float(M_PI) / 35); else - me->SetOrientation(DarkGlareAngle - DarkGlareTick * M_PI / 35); + me->SetOrientation(DarkGlareAngle - DarkGlareTick * float(M_PI) / 35); me->StopMoving(); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp index d49a6a312da..a9ec3007e5d 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp @@ -120,7 +120,7 @@ class boss_viscidus : public CreatureScript uint8 NumGlobes = me->GetHealthPct() / 5.0f; for (uint8 i = 0; i < NumGlobes; ++i) { - float Angle = i * 2 * M_PI / NumGlobes; + float Angle = i * 2 * float(M_PI) / NumGlobes; float X = ViscidusCoord.GetPositionX() + std::cos(Angle) * RoomRadius; float Y = ViscidusCoord.GetPositionY() + std::sin(Angle) * RoomRadius; float Z = -35.0f; diff --git a/src/server/scripts/Kalimdor/zone_durotar.cpp b/src/server/scripts/Kalimdor/zone_durotar.cpp index 358814d440a..a1df70522a8 100644 --- a/src/server/scripts/Kalimdor/zone_durotar.cpp +++ b/src/server/scripts/Kalimdor/zone_durotar.cpp @@ -386,7 +386,7 @@ class npc_troll_volunteer : public CreatureScript } me->SetDisplayId(trollmodel[urand(0, 39)]); if (Player* player = me->GetOwner()->ToPlayer()) - me->GetMotionMaster()->MoveFollow(player, 5.0f, float(rand_norm() + 1.0f) * M_PI / 3.0f * 4.0f); + me->GetMotionMaster()->MoveFollow(player, 5.0f, float(rand_norm() + 1.0f) * float(M_PI) / 3.0f * 4.0f); } void Reset() override diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp index 8bafdfebcd5..3ddf97c164d 100644 --- a/src/server/scripts/Kalimdor/zone_silithus.cpp +++ b/src/server/scripts/Kalimdor/zone_silithus.cpp @@ -1258,7 +1258,7 @@ class go_wind_stone : public GameObjectScript void SummonNPC(GameObject* go, Player* player, uint32 npc, uint32 spell) { go->CastSpell(player, spell); - TempSummon* summons = go->SummonCreature(npc, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), player->GetOrientation() - M_PI, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10 * 60 * 1000); + TempSummon* summons = go->SummonCreature(npc, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), player->GetOrientation() - float(M_PI), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10 * 60 * 1000); summons->CastSpell(summons, SPELL_SPAWN_IN, false); switch (summons->GetEntry()) { diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index c5b87eb48e8..9cc8540342f 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -50,7 +50,7 @@ enum Misc }; #define DATA_SPHERE_DISTANCE 25.0f -#define DATA_SPHERE_ANGLE_OFFSET M_PI / 2 +#define DATA_SPHERE_ANGLE_OFFSET float(M_PI) / 2 #define DATA_GROUND_POSITION_Z 11.30809f enum Yells diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp index 4015467501e..e0930a1ae2e 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp @@ -289,13 +289,13 @@ public: switch (i) { case 0: - pAdd->GetMotionMaster()->MoveFollow(pBoss, 2.0f, M_PI); + pAdd->GetMotionMaster()->MoveFollow(pBoss, 2.0f, float(M_PI)); break; case 1: - pAdd->GetMotionMaster()->MoveFollow(pBoss, 2.0f, M_PI / 2); + pAdd->GetMotionMaster()->MoveFollow(pBoss, 2.0f, float(M_PI) / 2); break; case 2: - pAdd->GetMotionMaster()->MoveFollow(pBoss, 2.0f, M_PI / 2 + M_PI); + pAdd->GetMotionMaster()->MoveFollow(pBoss, 2.0f, float(M_PI) / 2 + float(M_PI)); break; } } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index a0c42492a1b..68de65f9f7b 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -531,8 +531,8 @@ struct npc_unleashed_ballAI : public ScriptedAI float x0 = ToCCommonLoc[1].GetPositionX(), y0 = ToCCommonLoc[1].GetPositionY(), r = 47.0f; float y = y0; float x = frand(x0 - r, x0 + r); - float sq = pow(r, 2) - pow(x - x0, 2); - float rt = sqrtf(fabs(sq)); + float sq = std::pow(r, 2.f) - std::pow(x - x0, 2.f); + float rt = std::sqrt(std::fabs(sq)); if (urand(0, 1)) y = y0 + rt; else @@ -756,7 +756,7 @@ class spell_valkyr_essences : public SpellScriptLoader // Twin Vortex part uint32 lightVortex = sSpellMgr->GetSpellIdForDifficulty(SPELL_LIGHT_VORTEX_DAMAGE, owner); uint32 darkVortex = sSpellMgr->GetSpellIdForDifficulty(SPELL_DARK_VORTEX_DAMAGE, owner); - int32 stacksCount = int32(dmgInfo.GetSpellInfo()->Effects[EFFECT_0].CalcValue()) * 0.001 - 1; + int32 stacksCount = dmgInfo.GetSpellInfo()->Effects[EFFECT_0].CalcValue() / 1000 - 1; if (lightVortex && darkVortex && stacksCount) { diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp index e64067fb995..a048abd6554 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp @@ -292,7 +292,7 @@ class boss_devourer_of_souls : public CreatureScript beamAngle = me->GetOrientation(); - beamAngleDiff = M_PI/30.0f; // PI/2 in 15 sec = PI/30 per tick + beamAngleDiff = float(M_PI)/30.0f; // PI/2 in 15 sec = PI/30 per tick if (RAND(true, false)) beamAngleDiff = -beamAngleDiff; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp index a0f6039d703..535ace3259c 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp @@ -205,8 +205,8 @@ enum EncounterActions ACTION_SHIP_VISITS = 5 }; -Position const SkybreakerAddsSpawnPos = { 15.91131f, 0.0f, 20.4628f, M_PI }; -Position const OrgrimsHammerAddsSpawnPos = { 60.728395f, 0.0f, 38.93467f, M_PI }; +Position const SkybreakerAddsSpawnPos = { 15.91131f, 0.0f, 20.4628f, float(M_PI) }; +Position const OrgrimsHammerAddsSpawnPos = { 60.728395f, 0.0f, 38.93467f, float(M_PI) }; // Horde encounter Position const SkybreakerTeleportPortal = { 6.666975f, 0.013001f, 20.87888f, 0.0f }; @@ -439,7 +439,7 @@ private: Position SelectSpawnPoint() const { Position newPos; - float angle = frand(-M_PI * 0.5f, M_PI * 0.5f); + float angle = frand(float(-M_PI) * 0.5f, float(M_PI) * 0.5f); newPos.m_positionX = _spawnPoint->GetPositionX() + 2.0f * std::cos(angle); newPos.m_positionY = _spawnPoint->GetPositionY() + 2.0f * std::sin(angle); newPos.m_positionZ = _spawnPoint->GetPositionZ(); @@ -1455,7 +1455,7 @@ struct npc_gunship_boarding_addAI : public gunship_npc_AI if (Transport* destTransport = go->ToTransport()) destTransport->CalculatePassengerPosition(x, y, z, &o); - float angle = frand(0, M_PI * 2.0f); + float angle = frand(0, float(M_PI) * 2.0f); x += 2.0f * std::cos(angle); y += 2.0f * std::sin(angle); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index 5022cd4f645..1ff7e1b1352 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -674,7 +674,7 @@ class spell_marrowgar_bone_storm : public SpellScriptLoader void RecalculateDamage() { - SetHitDamage(int32(GetHitDamage() / std::max(sqrtf(GetHitUnit()->GetExactDist2d(GetCaster())), 1.0f))); + SetHitDamage(int32(GetHitDamage() / std::max(std::sqrt(GetHitUnit()->GetExactDist2d(GetCaster())), 1.0f))); } void Register() override diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp index 53efc628aa2..648da29ca66 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp @@ -126,7 +126,7 @@ public: { float x, y, z, o; me->GetHomePosition(x, y, z, o); - me->NearTeleportTo(x, y, z, o - G3D::halfPi()); + me->NearTeleportTo(x, y, z, o - (float(M_PI) / 2)); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); me->SetTarget(0); diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index fefdfa633ea..ac6fd29d8a1 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -1014,7 +1014,7 @@ public: // Used to generate perfect cyclic movements (Enter Circle). void FillCirclePath(Position const& centerPos, float radius, float z, Movement::PointsArray& path, bool clockwise) { - float step = clockwise ? -M_PI / 8.0f : M_PI / 8.0f; + float step = clockwise ? float(-M_PI) / 8.0f : float(M_PI) / 8.0f; float angle = centerPos.GetAngle(me->GetPositionX(), me->GetPositionY()); for (uint8 i = 0; i < 16; angle += step, ++i) @@ -1326,7 +1326,7 @@ public: private: void FillCirclePath(Position const& centerPos, float radius, float z, Movement::PointsArray& path, bool clockwise) { - float step = clockwise ? -M_PI / 9.0f : M_PI / 9.0f; + float step = clockwise ? float(-M_PI) / 9.0f : float(M_PI) / 9.0f; float angle = centerPos.GetAngle(me->GetPositionX(), me->GetPositionY()); for (uint8 i = 0; i < 18; angle += step, ++i) diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index f398dd99b5c..d07d68f28c9 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -315,7 +315,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();) { float angle = varos->GetAngle((*itr)->GetPositionX(), (*itr)->GetPositionY()); - float diff = fabs(orientation - angle); + float diff = std::fabs(orientation - angle); if (diff > 1.0f) itr = targets.erase(itr); @@ -359,7 +359,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();) { float angle = varos->GetAngle((*itr)->GetPositionX(), (*itr)->GetPositionY()); - float diff = fabs(orientation - angle); + float diff = std::fabs(orientation - angle); if (diff > 1.0f) itr = targets.erase(itr); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp index 011d1844adf..196e410f239 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp @@ -526,7 +526,7 @@ class spell_general_vezax_saronite_vapors : public SpellScriptLoader { if (Unit* caster = GetCaster()) { - int32 mana = int32(aurEff->GetAmount() * pow(2.0f, GetStackAmount())); // mana restore - bp * 2^stackamount + int32 mana = int32(aurEff->GetAmount() * std::pow(2.0f, GetStackAmount())); // mana restore - bp * 2^stackamount int32 damage = mana * 2; caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_ENERGIZE, &mana, NULL, NULL, true); caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_DAMAGE, &damage, NULL, NULL, true); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp index 4d904b04618..7f4d585b0a4 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp @@ -985,7 +985,7 @@ public: if (!caster) return; - int32 damage = int32(200 * pow(2.0f, GetStackAmount())); + int32 damage = int32(200 * std::pow(2.0f, GetStackAmount())); caster->CastCustomSpell(caster, SPELL_BITING_COLD_DAMAGE, &damage, NULL, NULL, true); if (caster->isMoving()) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index 58969fd63c8..71a89c0e508 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -498,7 +498,7 @@ class spell_ulduar_squeezed_lifeless : public SpellScriptLoader pos.m_positionX = 1756.25f + irand(-3, 3); pos.m_positionY = -8.3f + irand(-3, 3); pos.m_positionZ = 448.8f; - pos.SetOrientation(M_PI); + pos.SetOrientation(float(M_PI)); GetHitPlayer()->DestroyForNearbyPlayers(); GetHitPlayer()->ExitVehicle(&pos); GetHitPlayer()->UpdateObjectVisibility(false); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp index b769c7e141e..69240866742 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp @@ -336,7 +336,7 @@ class spell_mimiron_bomb_bot : public SpellScriptLoader void HandleScript(SpellEffIndex /*effIndex*/) { - if (GetHitPlayer()) + if (GetHitPlayer()) if (InstanceScript* instance = GetCaster()->GetInstanceScript()) if (Creature* mkii = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_LEVIATHAN_MK_II))) mkii->AI()->SetData(DATA_SETUP_BOMB, 0); @@ -425,15 +425,15 @@ class spell_mimiron_fire_search : public SpellScriptLoader { public: spell_mimiron_fire_search() : SpellScriptLoader("spell_mimiron_fire_search") { } - + class spell_mimiron_fire_search_SpellScript : public SpellScript { PrepareSpellScript(spell_mimiron_fire_search_SpellScript); - + bool Validate(SpellInfo const* /*spell*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_WATER_SPRAY)) - return false; + return false; return true; } @@ -459,7 +459,7 @@ class spell_mimiron_fire_search : public SpellScriptLoader if (_noTarget) GetCaster()->GetMotionMaster()->MoveRandom(15.0f); } - + void HandleScript(SpellEffIndex /*effIndex*/) { Unit* caster = GetCaster(); @@ -490,7 +490,7 @@ class spell_mimiron_fire_search : public SpellScriptLoader private: bool _noTarget; }; - + SpellScript* GetSpellScript() const override { return new spell_mimiron_fire_search_SpellScript(); @@ -530,7 +530,7 @@ class spell_mimiron_magnetic_core : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_MAGNETIC_CORE_VISUAL)) - return false; + return false; return true; } @@ -585,7 +585,7 @@ class spell_mimiron_napalm_shell : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_NAPALM_SHELL)) - return false; + return false; return true; } @@ -663,7 +663,7 @@ class spell_mimiron_plasma_blast : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_PLASMA_BLAST)) - return false; + return false; return true; } @@ -701,7 +701,7 @@ class spell_mimiron_proximity_explosion : public SpellScriptLoader PrepareSpellScript(spell_mimiron_proximity_explosion_SpellScript); void OnHit(SpellEffIndex /*effIndex*/) - { + { if (GetHitPlayer()) if (InstanceScript* instance = GetCaster()->GetInstanceScript()) if (Creature* mkII = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_LEVIATHAN_MK_II))) @@ -709,7 +709,7 @@ class spell_mimiron_proximity_explosion : public SpellScriptLoader } void HandleAura(SpellEffIndex /*effIndex*/) - { + { GetCaster()->RemoveAurasDueToSpell(SPELL_PROXIMITY_MINE_PERIODIC_TRIGGER); } @@ -859,7 +859,7 @@ class spell_mimiron_rocket_strike : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_SCRIPT_EFFECT_ROCKET_STRIKE)) - return false; + return false; return true; } @@ -907,7 +907,7 @@ class spell_mimiron_rocket_strike_damage : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_NOT_SO_FRIENDLY_FIRE)) - return false; + return false; return true; } @@ -919,7 +919,7 @@ class spell_mimiron_rocket_strike_damage : public SpellScriptLoader void HandleScript(SpellEffIndex /*effIndex*/) { - if (GetHitPlayer()) + if (GetHitPlayer()) if (InstanceScript* instance = GetCaster()->GetInstanceScript()) if (Creature* mkii = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_LEVIATHAN_MK_II))) mkii->AI()->SetData(DATA_SETUP_ROCKET, 0); @@ -957,7 +957,7 @@ class spell_mimiron_rocket_strike_target_select : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ROCKET_STRIKE)) - return false; + return false; return true; } @@ -1067,7 +1067,7 @@ class spell_mimiron_summon_assault_bot : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ASSAULT_BOT)) - return false; + return false; return true; } @@ -1104,7 +1104,7 @@ class spell_mimiron_summon_assault_bot_target : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ASSAULT_BOT_DUMMY)) - return false; + return false; return true; } @@ -1176,7 +1176,7 @@ class spell_mimiron_summon_fire_bot_target : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_FIRE_BOT_DUMMY)) - return false; + return false; return true; } @@ -1202,7 +1202,7 @@ class spell_mimiron_summon_flames_spread : public SpellScriptLoader { public: spell_mimiron_summon_flames_spread() : SpellScriptLoader("spell_mimiron_summon_flames_spread") { } - + class spell_mimiron_summon_flames_spread_SpellScript : public SpellScript { PrepareSpellScript(spell_mimiron_summon_flames_spread_SpellScript); @@ -1224,7 +1224,7 @@ class spell_mimiron_summon_flames_spread : public SpellScriptLoader } void OnHit(SpellEffIndex /*effIndex*/) - { + { GetCaster()->SetInFront(GetHitUnit()); } @@ -1247,7 +1247,7 @@ class spell_mimiron_summon_flames_spread : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_FLAMES_SPREAD)) - return false; + return false; return true; } @@ -1284,7 +1284,7 @@ class spell_mimiron_summon_frost_bomb_target : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_FROST_BOMB)) - return false; + return false; return true; } @@ -1335,7 +1335,7 @@ class spell_mimiron_summon_junk_bot : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_JUNK_BOT)) - return false; + return false; return true; } @@ -1372,7 +1372,7 @@ class spell_mimiron_summon_junk_bot_target : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_JUNK_BOT_DUMMY)) - return false; + return false; return true; } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp index 4abf46be448..2471b705b90 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp @@ -839,7 +839,7 @@ class boss_sara : public CreatureScript { Position pos; float radius = frand(25.0f, 50.0f); - float angle = frand(0.0f, 2.0f * M_PI); + float angle = frand(0.0f, 2.0f * float(M_PI)); pos.m_positionX = YoggSaronSpawnPos.GetPositionX() + radius * cosf(angle); pos.m_positionY = YoggSaronSpawnPos.GetPositionY() + radius * sinf(angle); pos.m_positionZ = me->GetMap()->GetHeight(me->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), YoggSaronSpawnPos.GetPositionZ() + 5.0f); @@ -1119,7 +1119,7 @@ class npc_ominous_cloud : public CreatureScript void FillCirclePath(Position const& centerPos, float radius, float z, Movement::PointsArray& path, bool clockwise) { - float step = clockwise ? -M_PI / 8.0f : M_PI / 8.0f; + float step = clockwise ? float(-M_PI) / 8.0f : float(M_PI) / 8.0f; float angle = centerPos.GetAngle(me->GetPositionX(), me->GetPositionY()); for (uint8 i = 0; i < 16; angle += step, ++i) @@ -2502,7 +2502,7 @@ class spell_yogg_saron_empowered : public SpellScriptLoader // 64161 void OnPeriodic(AuraEffect const* /*aurEff*/) { Unit* target = GetTarget(); - float stack = ceil((target->GetHealthPct() / 10) - 1); + float stack = std::ceil((target->GetHealthPct() / 10) - 1); target->RemoveAurasDueToSpell(SPELL_EMPOWERED_BUFF); if (stack) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index 79f9283eb40..1f9bfe4c3f3 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -820,7 +820,7 @@ class instance_ulduar : public InstanceMapScript break; case DATA_UNBROKEN: Unbroken = data != 0; - break; + break; case DATA_MIMIRON_ELEVATOR: if (GameObject* gameObject = instance->GetGameObject(MimironElevatorGUID)) gameObject->SetGoState((GOState)data); diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp index d0fd948ce6a..6d41a2e9b21 100644 --- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp +++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp @@ -718,7 +718,7 @@ public: if (me->GetEntry() == NPC_LAKE_FROG) { me->AddAura(SPELL_FROG_LOVE, me); - me->GetMotionMaster()->MoveFollow(player, 0.3f, frand(M_PI/2, M_PI + (M_PI/2))); + me->GetMotionMaster()->MoveFollow(player, 0.3f, frand(float(M_PI) / 2, float(M_PI) + (float(M_PI) / 2))); _following = true; } else if (me->GetEntry() == NPC_LAKE_FROG_QUEST) diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp index c56739c783f..a4d6ab31846 100644 --- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp +++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp @@ -410,7 +410,7 @@ public: switch (phase) { case 1: - orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ()); + orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + std::cos(me->GetOrientation()) * 5, me->GetPositionY() + std::sin(me->GetOrientation()) * 5, me->GetPositionZ()); orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_6); timer = 5000; break; diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp index cf8c4cd9b36..2e75b10c0e8 100644 --- a/src/server/scripts/Northrend/zone_zuldrak.cpp +++ b/src/server/scripts/Northrend/zone_zuldrak.cpp @@ -247,7 +247,7 @@ public: break; case EVENT_RECRUIT_2: me->SetWalk(true); - me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + (cos(_heading) * 10), me->GetPositionY() + (sin(_heading) * 10), me->GetPositionZ()); + me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + (std::cos(_heading) * 10), me->GetPositionY() + (std::sin(_heading) * 10), me->GetPositionZ()); me->DespawnOrUnsummon(5000); break; default: diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index 6b478bc9dfc..f1e170c0705 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -244,8 +244,8 @@ public: if (me->GetAuraCount(SPELL_SHADE_SOUL_CHANNEL_2) <= 3) { - moveSpeed = (2.0 - (0.6 * me->GetAuraCount(SPELL_SHADE_SOUL_CHANNEL_2))); - me->SetSpeed(MOVE_WALK, moveSpeed / 2.5); + moveSpeed = (2.0f - (0.6f * me->GetAuraCount(SPELL_SHADE_SOUL_CHANNEL_2))); + me->SetSpeed(MOVE_WALK, moveSpeed / 2.5f); me->SetSpeed(MOVE_RUN, (moveSpeed * 2) / 7); me->ClearUnitState(UNIT_STATE_ROOT); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index 8e478aadeca..fb5b4579942 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -278,7 +278,7 @@ public: if (me->IsWithinDistInMap(who, attackRadius)) { // Check first that object is in an angle in front of this one before LoS check - if (me->HasInArc(M_PI/2.0f, who) && me->IsWithinLOSInMap(who)) + if (me->HasInArc(float(M_PI) / 2.0f, who) && me->IsWithinLOSInMap(who)) { AttackStart(who); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp index dc0a6643624..d4fdb262c8e 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp @@ -19,156 +19,169 @@ #include "ScriptedCreature.h" #include "steam_vault.h" -enum HydromancerThespia +enum Yells { SAY_SUMMON = 0, SAY_AGGRO = 1, SAY_SLAY = 2, SAY_DEAD = 3, +}; +enum Spells +{ SPELL_LIGHTNING_CLOUD = 25033, SPELL_LUNG_BURST = 31481, - SPELL_ENVELOPING_WINDS = 31718, + SPELL_ENVELOPING_WINDS = 31718 +}; - SPELL_WATER_BOLT_VOLLEY = 34449, - H_SPELL_WATER_BOLT_VOLLEY = 37924 +enum Events +{ + EVENT_LIGHTNING_CLOUD = 1, + EVENT_LUNG_BURST, + EVENT_ENVELOPING_WINDS }; class boss_hydromancer_thespia : public CreatureScript { -public: - boss_hydromancer_thespia() : CreatureScript("boss_hydromancer_thespia") { } - - CreatureAI* GetAI(Creature* creature) const override - { - return GetInstanceAI<boss_thespiaAI>(creature); - } - - struct boss_thespiaAI : public ScriptedAI - { - boss_thespiaAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - } - - InstanceScript* instance; - - uint32 LightningCloud_Timer; - uint32 LungBurst_Timer; - uint32 EnvelopingWinds_Timer; - - void Reset() override - { - LightningCloud_Timer = 15000; - LungBurst_Timer = 7000; - EnvelopingWinds_Timer = 9000; - - instance->SetBossState(DATA_HYDROMANCER_THESPIA, NOT_STARTED); - } - - void JustDied(Unit* /*killer*/) override - { - Talk(SAY_DEAD); - - instance->SetBossState(DATA_HYDROMANCER_THESPIA, DONE); - } - - void KilledUnit(Unit* /*victim*/) override - { - Talk(SAY_SLAY); - } + public: + boss_hydromancer_thespia() : CreatureScript("boss_hydromancer_thespia") { } - void EnterCombat(Unit* /*who*/) override + struct boss_thespiaAI : public BossAI { - Talk(SAY_AGGRO); + boss_thespiaAI(Creature* creature) : BossAI(creature, DATA_HYDROMANCER_THESPIA) { } - instance->SetBossState(DATA_HYDROMANCER_THESPIA, IN_PROGRESS); - } + void Reset() override + { + _Reset(); + } - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; + void JustDied(Unit* /*killer*/) override + { + Talk(SAY_DEAD); + _JustDied(); + } - //LightningCloud_Timer - if (LightningCloud_Timer <= diff) + void KilledUnit(Unit* who) override { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_LIGHTNING_CLOUD); + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); + } - //cast twice in Heroic mode - if (IsHeroic()) - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_LIGHTNING_CLOUD); + void EnterCombat(Unit* /*who*/) override + { + Talk(SAY_AGGRO); + _EnterCombat(); - LightningCloud_Timer = 15000 + rand32() % 10000; - } else LightningCloud_Timer -=diff; + events.ScheduleEvent(EVENT_LIGHTNING_CLOUD, 15000); + events.ScheduleEvent(EVENT_LUNG_BURST, 7000); + events.ScheduleEvent(EVENT_ENVELOPING_WINDS, 9000); + } - //LungBurst_Timer - if (LungBurst_Timer <= diff) + void ExecuteEvent(uint32 eventId) override { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_LUNG_BURST); - LungBurst_Timer = 7000 + rand32() % 5000; - } else LungBurst_Timer -=diff; - - //EnvelopingWinds_Timer - if (EnvelopingWinds_Timer <= diff) + switch (eventId) + { + case EVENT_LIGHTNING_CLOUD: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) + DoCast(target, SPELL_LIGHTNING_CLOUD); + // cast twice in Heroic mode + if (IsHeroic()) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) + DoCast(target, SPELL_LIGHTNING_CLOUD); + + events.ScheduleEvent(EVENT_LIGHTNING_CLOUD, urand(15000, 25000)); + break; + case EVENT_LUNG_BURST: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) + DoCast(target, SPELL_LUNG_BURST); + events.ScheduleEvent(EVENT_LUNG_BURST, urand(7000, 12000)); + break; + case EVENT_ENVELOPING_WINDS: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true)) + DoCast(target, SPELL_ENVELOPING_WINDS); + // cast twice in Heroic mode + if (IsHeroic()) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true)) + DoCast(target, SPELL_ENVELOPING_WINDS); + + events.ScheduleEvent(EVENT_ENVELOPING_WINDS, urand(10000, 15000)); + break; + default: + break; + } + } + + void UpdateAI(uint32 diff) override { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_ENVELOPING_WINDS); - - //cast twice in Heroic mode - if (IsHeroic()) - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_ENVELOPING_WINDS); - EnvelopingWinds_Timer = 10000 + rand32() % 5000; - } else EnvelopingWinds_Timer -=diff; + BossAI::UpdateAI(diff); + } + }; - DoMeleeAttackIfReady(); + CreatureAI* GetAI(Creature* creature) const override + { + return GetInstanceAI<boss_thespiaAI>(creature); } - }; +}; +enum CoilfangWaterElemental +{ + EVENT_WATER_BOLT_VOLLEY = 1, + SPELL_WATER_BOLT_VOLLEY = 34449 }; class npc_coilfang_waterelemental : public CreatureScript { -public: - npc_coilfang_waterelemental() : CreatureScript("npc_coilfang_waterelemental") { } + public: + npc_coilfang_waterelemental() : CreatureScript("npc_coilfang_waterelemental") { } - CreatureAI* GetAI(Creature* creature) const override - { - return new npc_coilfang_waterelementalAI(creature); - } - - struct npc_coilfang_waterelementalAI : public ScriptedAI - { - npc_coilfang_waterelementalAI(Creature* creature) : ScriptedAI(creature) { } - - uint32 WaterBoltVolley_Timer; - - void Reset() override + struct npc_coilfang_waterelementalAI : public ScriptedAI { - WaterBoltVolley_Timer = 3000 + rand32() % 3000; - } - - void EnterCombat(Unit* /*who*/) override { } + npc_coilfang_waterelementalAI(Creature* creature) : ScriptedAI(creature) { } - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; + void Reset() override + { + _events.Reset(); + } - if (WaterBoltVolley_Timer <= diff) + void EnterCombat(Unit* /*who*/) override { - DoCast(me, SPELL_WATER_BOLT_VOLLEY); - WaterBoltVolley_Timer = 7000 + rand32() % 5000; - } else WaterBoltVolley_Timer -= diff; + _events.ScheduleEvent(EVENT_WATER_BOLT_VOLLEY, urand(3000, 6000)); + } - DoMeleeAttackIfReady(); + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_WATER_BOLT_VOLLEY: + DoCast(me, SPELL_WATER_BOLT_VOLLEY); + _events.ScheduleEvent(EVENT_WATER_BOLT_VOLLEY, urand(7000, 12000)); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new npc_coilfang_waterelementalAI(creature); } - }; - }; void AddSC_boss_hydromancer_thespia() diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index be437a154b3..63c01540af2 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -202,7 +202,7 @@ class boss_high_astromancer_solarian : public CreatureScript { float z = RAND(1.0f, -1.0f); - return (z*sqrt(radius*radius - (x - CENTER_X)*(x - CENTER_X)) + CENTER_Y); + return (z*std::sqrt(radius*radius - (x - CENTER_X)*(x - CENTER_X)) + CENTER_Y); } void UpdateAI(uint32 diff) override diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp index 0981fc527f3..bbb384ed0f8 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp @@ -179,7 +179,7 @@ class boss_warp_splinter : public CreatureScript { for (uint8 i = 0; i < 6; ++i) { - float angle = (M_PI / 3) * i; + float angle = (float(M_PI) / 3) * i; float X = Treant_Spawn_Pos_X + TREANT_SPAWN_DIST * std::cos(angle); float Y = Treant_Spawn_Pos_Y + TREANT_SPAWN_DIST * std::sin(angle); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 1d5443e54d6..86ef8bdc8cc 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1584,7 +1584,7 @@ class spell_gen_gift_of_naaru : public SpellScriptLoader break; } - int32 healTick = floor(heal / aurEff->GetTotalTicks()); + int32 healTick = std::floor(heal / aurEff->GetTotalTicks()); amount += int32(std::max(healTick, 0)); } diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index c43b781936c..41239b12921 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -2456,7 +2456,7 @@ class spell_item_unusual_compass : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { Unit* caster = GetCaster(); - caster->SetFacingTo(frand(0.0f, 2.0f * M_PI)); + caster->SetFacingTo(frand(0.0f, 2.0f * float(M_PI))); } void Register() override diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 87661710f53..173e03fef7c 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -2008,7 +2008,7 @@ class spell_q12308_escape_from_silverbrook_summon_worgen : public SpellScriptLoa void ModDest(SpellDestination& dest) { float dist = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); - float angle = frand(0.75f, 1.25f) * M_PI; + float angle = frand(0.75f, 1.25f) * float(M_PI); Position pos = GetCaster()->GetNearPosition(dist, angle); dest.Relocate(pos); diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index af2c541dbc4..58820b1e215 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -583,7 +583,7 @@ class spell_warr_retaliation : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { // check attack comes not from behind and warrior is not stunned - return GetTarget()->isInFront(eventInfo.GetActor(), M_PI) && !GetTarget()->HasUnitState(UNIT_STATE_STUNNED); + return GetTarget()->isInFront(eventInfo.GetActor(), float(M_PI)) && !GetTarget()->HasUnitState(UNIT_STATE_STUNNED); } void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 3d6d98072e6..e8a4a78e1bb 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -2233,7 +2233,7 @@ public: if (GameObject* launcher = FindNearestLauncher()) { launcher->SendCustomAnim(ANIM_GO_LAUNCH_FIREWORK); - me->SetOrientation(launcher->GetOrientation() + M_PI/2); + me->SetOrientation(launcher->GetOrientation() + float(M_PI) / 2); } else return; |