diff options
Diffstat (limited to 'src/server/scripts')
27 files changed, 258 insertions, 220 deletions
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 167c56c20a2..6803354d29b 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -201,8 +201,8 @@ public: float z = player->GetPositionZ(); float ang = player->GetOrientation(); - float rot2 = sin(ang/2); - float rot3 = cos(ang/2); + float rot2 = std::sin(ang/2); + float rot3 = std::cos(ang/2); uint32 objectId = atoi(id); diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index 7e489a5781e..c2ec563b3c7 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -39,12 +39,12 @@ public: { "complete", SEC_ADMINISTRATOR, false, &HandleQuestComplete, "", NULL }, { "remove", SEC_ADMINISTRATOR, false, &HandleQuestRemove, "", NULL }, { "reward", SEC_ADMINISTRATOR, false, &HandleQuestReward, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; static ChatCommand commandTable[] = { { "quest", SEC_ADMINISTRATOR, false, NULL, "", questCommandTable }, - { NULL, 0, false, NULL, "", NULL } + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; return commandTable; } diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 7d2a4304054..25f4c176bfc 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -408,9 +408,9 @@ public: if (!*args) return false; - Tokens entries(std::string(args), ' '); + Tokenizer entries(std::string(args), ' '); - for (Tokens::const_iterator itr = entries.begin(); itr != entries.end(); ++itr) + for (Tokenizer::const_iterator itr = entries.begin(); itr != entries.end(); ++itr) { uint32 entry = uint32(atoi(*itr)); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 08aad90f588..ea9cfe5c3c1 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -210,16 +210,16 @@ public: pAttumen->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); float angle = me->GetAngle(pAttumen); float distance = me->GetDistance2d(pAttumen); - float newX = me->GetPositionX() + cos(angle)*(distance/2); - float newY = me->GetPositionY() + sin(angle)*(distance/2); + float newX = me->GetPositionX() + std::cos(angle)*(distance/2); + float newY = me->GetPositionY() + std::sin(angle)*(distance/2); float newZ = 50; //me->Relocate(newX, newY, newZ, angle); //me->SendMonsterMove(newX, newY, newZ, 0, true, 1000); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MovePoint(0, newX, newY, newZ); distance += 10; - newX = me->GetPositionX() + cos(angle)*(distance/2); - newY = me->GetPositionY() + sin(angle)*(distance/2); + newX = me->GetPositionX() + std::cos(angle)*(distance/2); + newY = me->GetPositionY() + std::sin(angle)*(distance/2); pAttumen->GetMotionMaster()->Clear(); pAttumen->GetMotionMaster()->MovePoint(0, newX, newY, newZ); //pAttumen->Relocate(newX, newY, newZ, -angle); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 167f040bbc4..e368124abaf 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -774,8 +774,8 @@ public: for (uint8 i = 1; i < Phase; ++i) { float sx, sy; - sx = ShieldOrbLocations[0][0] + sin(ShieldOrbLocations[i][0]); - sy = ShieldOrbLocations[0][1] + sin(ShieldOrbLocations[i][1]); + sx = ShieldOrbLocations[0][0] + std::sin(ShieldOrbLocations[i][0]); + sy = ShieldOrbLocations[0][1] + std::sin(ShieldOrbLocations[i][1]); me->SummonCreature(CREATURE_SHIELD_ORB, sx, sy, SHIELD_ORB_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); } Timer[TIMER_SUMMON_SHILEDORB] = urand(30000, 60000); // 30-60seconds cooldown @@ -1207,13 +1207,13 @@ public: { if (bClockwise) { - y = my - r * sin(c); - x = mx - r * cos(c); + y = my - r * std::sin(c); + x = mx - r * std::cos(c); } else { - y = my + r * sin(c); - x = mx + r * cos(c); + y = my + r * std::sin(c); + x = mx + r * std::cos(c); } bPointReached = false; uiCheckTimer = 1000; diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp index 89064a5d18c..ebab2cb99a9 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp @@ -15,10 +15,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* - * Comment: Find correct mushrooms spell to make them visible - buffs of the mushrooms not ever applied to the users... - */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ahnkahet.h" @@ -34,12 +30,24 @@ enum Spells SPELL_POISONOUS_MUSHROOM_VISUAL_AREA = 61566, // Self SPELL_POISONOUS_MUSHROOM_VISUAL_AURA = 56741, // Self SPELL_PUTRID_MUSHROOM = 31690, // To make the mushrooms visible + SPELL_POWER_MUSHROOM_VISUAL_AURA = 56740, }; enum Creatures { - NPC_HEALTHY_MUSHROOM = 30391, - NPC_POISONOUS_MUSHROOM = 30435 + NPC_HEALTHY_MUSHROOM = 30391, + NPC_POISONOUS_MUSHROOM = 30435, + NPC_TRIGGER = 19656 +}; + +enum event +{ + EVENT_SPAWN = 1, + EVENT_MINI, + EVENT_ROOT, + EVENT_BASH, + EVENT_BOLT, + EVENT_AURA }; class boss_amanitar : public CreatureScript @@ -47,110 +55,118 @@ class boss_amanitar : public CreatureScript public: boss_amanitar() : CreatureScript("boss_amanitar") { } - struct boss_amanitarAI : public ScriptedAI + struct boss_amanitarAI : public BossAI { - boss_amanitarAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - bFirstTime = true; - } - - InstanceScript* instance; - - uint32 uiRootTimer; - uint32 uiBashTimer; - uint32 uiBoltTimer; - uint32 uiSpawnTimer; - - bool bFirstTime; - + boss_amanitarAI(Creature* creature) : BossAI(creature, DATA_AMANITAR) { } + void Reset() { - uiRootTimer = urand(5*IN_MILLISECONDS, 9*IN_MILLISECONDS); - uiBashTimer = urand(10*IN_MILLISECONDS, 14*IN_MILLISECONDS); - uiBoltTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - uiSpawnTimer = 0; - + _Reset(); + me->SetMeleeDamageSchool(SPELL_SCHOOL_NATURE); - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); + summons.DespawnAll(); if (instance) { instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI); - if (!bFirstTime) - instance->SetData(DATA_AMANITAR_EVENT, FAIL); - else - bFirstTime = false; + instance->SetData(DATA_AMANITAR_EVENT, NOT_STARTED); } } - void JustDied(Unit* /*killer*/) + void JustDied(Unit* /*Killer*/) { if (instance) { + _JustDied(); instance->SetData(DATA_AMANITAR_EVENT, DONE); instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI); + summons.DespawnAll(); } } void EnterCombat(Unit* /*who*/) { + _EnterCombat(); + + events.ScheduleEvent(EVENT_ROOT, urand(5,9)*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_BASH, urand(10,14)*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_BOLT, urand(15,20)*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_MINI, urand(12,18)*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SPAWN, 5 *IN_MILLISECONDS); + + me->SetInCombatWithZone(); if (instance) instance->SetData(DATA_AMANITAR_EVENT, IN_PROGRESS); - - DoCast(me, SPELL_MINI, false); } void SpawnAdds() { + uint8 u = 0; + for (uint8 i = 0; i < 30; ++i) { - Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0); + Position pos; + me->GetPosition(&pos); + me->GetRandomNearPosition(pos, 30.0f); + pos.m_positionZ = me->GetMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), MAX_HEIGHT) + 2.0f; - if (victim) + if (Creature* trigger = me->SummonCreature(NPC_TRIGGER, pos)) { - Position pos; - victim->GetPosition(&pos); - me->GetRandomNearPosition(pos, float(urand(5, 80))); - me->SummonCreature(NPC_POISONOUS_MUSHROOM, pos, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30*IN_MILLISECONDS); - me->GetRandomNearPosition(pos, float(urand(5, 80))); - me->SummonCreature(NPC_HEALTHY_MUSHROOM, pos, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30*IN_MILLISECONDS); + Creature* temp1 = trigger->FindNearestCreature(NPC_HEALTHY_MUSHROOM, 4.0f, true); + Creature* temp2 = trigger->FindNearestCreature(NPC_POISONOUS_MUSHROOM, 4.0f, true); + if (temp1 || temp2) + { + trigger->DisappearAndDie(); + } + else + { + u = 1 - u; + trigger->DisappearAndDie(); + me->SummonCreature(u > 0 ? NPC_POISONOUS_MUSHROOM : NPC_HEALTHY_MUSHROOM, pos, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60*IN_MILLISECONDS); + } } } } void UpdateAI(const uint32 diff) { - //Return since we have no target if (!UpdateVictim()) return; - if (uiSpawnTimer <= diff) - { - SpawnAdds(); - uiSpawnTimer = urand(35*IN_MILLISECONDS, 40*IN_MILLISECONDS); - } else uiSpawnTimer -= diff; - - if (uiRootTimer <= diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(target, SPELL_ENTANGLING_ROOTS); - uiRootTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else uiRootTimer -= diff; + events.Update(diff); - if (uiBashTimer <= diff) - { - DoCastVictim(SPELL_BASH); - uiBashTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else uiBashTimer -= diff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (uiBoltTimer <= diff) + while (uint32 eventId = events.ExecuteEvent()) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(target, SPELL_VENOM_BOLT_VOLLEY); - uiBoltTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else uiBoltTimer -= diff; - + switch (eventId) + { + case EVENT_SPAWN: + SpawnAdds(); + events.ScheduleEvent(EVENT_SPAWN, 20*IN_MILLISECONDS); + break; + case EVENT_MINI: + DoCast(SPELL_MINI); + events.ScheduleEvent(EVENT_MINI, urand(25,30)*IN_MILLISECONDS); + break; + case EVENT_ROOT: + DoCast(SelectTarget(SELECT_TARGET_RANDOM,0, 100, true),SPELL_ENTANGLING_ROOTS,true); + events.ScheduleEvent(EVENT_ROOT, urand(10,15)*IN_MILLISECONDS); + break; + case EVENT_BASH: + DoCastVictim(SPELL_BASH); + events.ScheduleEvent(EVENT_BASH, urand(7,12)*IN_MILLISECONDS); + break; + case EVENT_BOLT: + DoCast(SelectTarget(SELECT_TARGET_RANDOM,0, 100, true),SPELL_VENOM_BOLT_VOLLEY,true); + events.ScheduleEvent(EVENT_BOLT, urand(18,22)*IN_MILLISECONDS); + break; + default: + break; + } + } DoMeleeAttackIfReady(); } }; @@ -170,30 +186,26 @@ public: { mob_amanitar_mushroomsAI(Creature* creature) : Scripted_NoMovementAI(creature) {} - uint32 uiAuraTimer; - uint32 uiDeathTimer; + EventMap events; void Reset() { - DoCast(me, SPELL_PUTRID_MUSHROOM, true); // Hack, to make the mushrooms visible, can't find orig. spell... + events.Reset(); + events.ScheduleEvent(EVENT_AURA, 1*IN_MILLISECONDS); + + me->SetDisplayId(me->GetCreatureTemplate()->Modelid2); + DoCast(SPELL_PUTRID_MUSHROOM); if (me->GetEntry() == NPC_POISONOUS_MUSHROOM) - DoCast(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AURA, true); - - uiAuraTimer = 0; - uiDeathTimer = 30*IN_MILLISECONDS; + DoCast(SPELL_POISONOUS_MUSHROOM_VISUAL_AURA); + else + DoCast(SPELL_POWER_MUSHROOM_VISUAL_AURA); } - void JustDied(Unit* killer) + void DamageTaken(Unit* /*attacker*/, uint32 &damage) { - if (!killer) - return; - - if (me->GetEntry() == NPC_HEALTHY_MUSHROOM && killer->GetTypeId() == TYPEID_PLAYER) - { - me->InterruptNonMeleeSpells(false); - DoCast(killer, SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS, false); - } + if (damage >= me->GetHealth() && me->GetEntry() == NPC_HEALTHY_MUSHROOM) + DoCast(me, SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS, true); } void EnterCombat(Unit* /*who*/) {} @@ -201,18 +213,30 @@ public: void UpdateAI(const uint32 diff) { - if (me->GetEntry() == NPC_POISONOUS_MUSHROOM) + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - if (uiAuraTimer <= diff) + switch (eventId) { - DoCast(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AREA, true); - DoCast(me, SPELL_POISONOUS_MUSHROOM_POISON_CLOUD, false); - uiAuraTimer = 7*IN_MILLISECONDS; - } else uiAuraTimer -= diff; + case EVENT_AURA: + if (me->GetEntry() == NPC_POISONOUS_MUSHROOM) + { + DoCast(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AREA, true); + DoCast(me, SPELL_POISONOUS_MUSHROOM_POISON_CLOUD); + } + events.ScheduleEvent(EVENT_AURA, 7*IN_MILLISECONDS); + break; + default: + break; + } } - if (uiDeathTimer <= diff) - me->DisappearAndDie(); - else uiDeathTimer -= diff; } }; @@ -224,6 +248,6 @@ public: void AddSC_boss_amanitar() { - new boss_amanitar; - new mob_amanitar_mushrooms; -} + new boss_amanitar(); + new mob_amanitar_mushrooms(); +}
\ No newline at end of file diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp index 7c167fb9c27..02dcc04abd6 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp @@ -23,22 +23,15 @@ #include "ScriptedCreature.h" #include "ahnkahet.h" + enum Yells { - TEXT_AGGRO = -1619000, - TEXT_SACRIFICE_1_1 = -1619001, - TEXT_SACRIFICE_1_2 = -1619002, - TEXT_SACRIFICE_2_1 = -1619003, - TEXT_SACRIFICE_2_2 = -1619004, - TEXT_SLAY_1 = -1619005, - TEXT_SLAY_2 = -1619006, - TEXT_SLAY_3 = -1619007, - TEXT_DEATH = -1619008, - TEXT_PREACHING_1 = -1619009, - TEXT_PREACHING_2 = -1619010, - TEXT_PREACHING_3 = -1619011, - TEXT_PREACHING_4 = -1619012, - TEXT_PREACHING_5 = -1619013 + TEXT_AGGRO = 0, + TEXT_SACRIFICE_1 = 1, + TEXT_SACRIFICE_2 = 2, + TEXT_SLAY = 3, + TEXT_DEATH = 4, + TEXT_PREACHING = 5 }; enum Spells @@ -129,7 +122,7 @@ public: if (!instance || (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_JEDOGA_CONTROLLER)) return; - DoScriptText(TEXT_AGGRO, me); + Talk(TEXT_AGGRO); me->SetInCombatWithZone(); instance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, IN_PROGRESS); } @@ -147,12 +140,12 @@ public: if (!Victim || Victim->GetTypeId() != TYPEID_PLAYER) return; - DoScriptText(RAND(TEXT_SLAY_1, TEXT_SLAY_2, TEXT_SLAY_3), me); + Talk(TEXT_SLAY); } void JustDied(Unit* /*killer*/) { - DoScriptText(TEXT_DEATH, me); + Talk(TEXT_DEATH); if (instance) instance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, DONE); } @@ -178,7 +171,7 @@ public: if (!bPreDone && who->GetTypeId() == TYPEID_PLAYER && me->GetDistance(who) < 100.0f) { - DoScriptText(RAND(TEXT_PREACHING_1, TEXT_PREACHING_2, TEXT_PREACHING_3, TEXT_PREACHING_4, TEXT_PREACHING_5), me); + Talk(TEXT_PREACHING); bPreDone = true; } @@ -270,7 +263,7 @@ public: if (opfer) { - DoScriptText(RAND(TEXT_SACRIFICE_1_1, TEXT_SACRIFICE_1_2), me); + Talk(TEXT_SACRIFICE_1); instance->SetData64(DATA_ADD_JEDOGA_OPFER, opfer); } else bCanDown = true; @@ -278,7 +271,7 @@ public: void Opfern() { - DoScriptText(RAND(TEXT_SACRIFICE_2_1, TEXT_SACRIFICE_2_2), me); + Talk(TEXT_SACRIFICE_2); me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_GIFT_OF_THE_HERALD, false); @@ -534,11 +527,11 @@ public: { npc_jedogas_aufseher_triggerAI(Creature* creature) : Scripted_NoMovementAI(creature) { - instance = creature->GetInstanceScript(); - bRemoved = false; - bRemoved2 = false; - bCasted = false; - bCasted2 = false; + instance = creature->GetInstanceScript(); + bRemoved = false; + bRemoved2 = false; + bCasted = false; + bCasted2 = false; } InstanceScript* instance; 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 f8e2fc0f99f..4729f68680e 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -140,8 +140,8 @@ public: { float angle, x, y; angle = pSpheres[0]->GetAngle(pSphereTarget); - x = pSpheres[0]->GetPositionX() + DATA_SPHERE_DISTANCE * cos(angle); - y = pSpheres[0]->GetPositionY() + DATA_SPHERE_DISTANCE * sin(angle); + x = pSpheres[0]->GetPositionX() + DATA_SPHERE_DISTANCE * std::cos(angle); + y = pSpheres[0]->GetPositionY() + DATA_SPHERE_DISTANCE * std::sin(angle); pSpheres[0]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[0]->GetPositionZ()); } if (IsHeroic()) @@ -154,12 +154,12 @@ public: { float angle, x, y; angle = pSpheres[1]->GetAngle(pSphereTarget) + DATA_SPHERE_ANGLE_OFFSET; - x = pSpheres[1]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * cos(angle); - y = pSpheres[1]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * sin(angle); + x = pSpheres[1]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle); + y = pSpheres[1]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle); pSpheres[1]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[1]->GetPositionZ()); angle = pSpheres[2]->GetAngle(pSphereTarget) - DATA_SPHERE_ANGLE_OFFSET; - x = pSpheres[2]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * cos(angle); - y = pSpheres[2]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * sin(angle); + x = pSpheres[2]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle); + y = pSpheres[2]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle); pSpheres[2]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[2]->GetPositionZ()); } } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp index c4008564029..61d693104fa 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp @@ -42,6 +42,8 @@ enum Events EVENT_FLIGHT = 2, EVENT_FLAME_BREATH = 3, EVENT_CONFLAGRATION = 4, + EVENT_LAND_GROUND = 5, + EVENT_AIR_MOVEMENT = 6, // Event group EVENT_GROUP_LAND_PHASE = 1, @@ -51,6 +53,8 @@ enum MovementPoints { POINT_FLIGHT = 1, POINT_LAND = 2, + POINT_TAKEOFF = 3, + POINT_LAND_GROUND = 4 }; enum Misc @@ -58,8 +62,9 @@ enum Misc SOUND_ID_DEATH = 17531, }; -Position const SavianaRagefireFlyPos = {3155.51f, 683.844f, 95.20f, 4.69f}; -Position const SavianaRagefireLandPos = {3151.07f, 636.443f, 79.54f, 4.69f}; +Position const SavianaRagefireFlyOutPos = {3155.51f, 683.844f, 95.0f, 4.69f}; +Position const SavianaRagefireFlyInPos = {3151.07f, 636.443f, 79.540f, 4.69f}; +Position const SavianaRagefireLandPos = {3151.07f, 636.443f, 78.649f, 4.69f}; class boss_saviana_ragefire : public CreatureScript { @@ -96,7 +101,7 @@ class boss_saviana_ragefire : public CreatureScript void MovementInform(uint32 type, uint32 point) { - if (type != POINT_MOTION_TYPE) + if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE) return; switch (point) @@ -106,13 +111,18 @@ class boss_saviana_ragefire : public CreatureScript Talk(SAY_CONFLAGRATION); break; case POINT_LAND: + events.ScheduleEvent(EVENT_LAND_GROUND, 1); + break; + case POINT_LAND_GROUND: me->SetCanFly(false); me->SetDisableGravity(false); + me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->SetReactState(REACT_AGGRESSIVE); - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) - me->GetMotionMaster()->MovementExpired(); DoStartMovement(me->getVictim()); break; + case POINT_TAKEOFF: + events.ScheduleEvent(EVENT_AIR_MOVEMENT, 1); + break; default: break; } @@ -149,8 +159,13 @@ class boss_saviana_ragefire : public CreatureScript { me->SetCanFly(true); me->SetDisableGravity(true); + me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MovePoint(POINT_FLIGHT, SavianaRagefireFlyPos); + me->AttackStop(); + Position pos; + pos.Relocate(me); + pos.m_positionZ += 10.0f; + me->GetMotionMaster()->MoveTakeoff(POINT_TAKEOFF, pos); events.ScheduleEvent(EVENT_FLIGHT, 50000); events.DelayEvents(12500, EVENT_GROUP_LAND_PHASE); break; @@ -167,6 +182,12 @@ class boss_saviana_ragefire : public CreatureScript DoCastVictim(SPELL_FLAME_BREATH); events.ScheduleEvent(EVENT_FLAME_BREATH, urand(20000, 30000), EVENT_GROUP_LAND_PHASE); break; + case EVENT_AIR_MOVEMENT: + me->GetMotionMaster()->MovePoint(POINT_FLIGHT, SavianaRagefireFlyOutPos); + break; + case EVENT_LAND_GROUND: + me->GetMotionMaster()->MoveLand(POINT_LAND_GROUND, SavianaRagefireLandPos); + break; default: break; } @@ -243,7 +264,7 @@ class spell_saviana_conflagration_throwback : public SpellScriptLoader { PreventHitDefaultEffect(effIndex); GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true); - GetHitUnit()->GetMotionMaster()->MovePoint(POINT_LAND, SavianaRagefireLandPos); + GetHitUnit()->GetMotionMaster()->MovePoint(POINT_LAND, SavianaRagefireFlyInPos); } void Register() diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 6e7e3c49ef8..1b12f17ce64 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -1585,7 +1585,7 @@ class spell_valanar_kinetic_bomb_absorb : public SpellScriptLoader void OnAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount) { - absorbAmount = CalculatePctN(dmgInfo.GetDamage(), aurEff->GetAmount()); + absorbAmount = CalculatePct(dmgInfo.GetDamage(), aurEff->GetAmount()); RoundToInterval<uint32>(absorbAmount, 0, dmgInfo.GetDamage()); dmgInfo.AbsorbDamage(absorbAmount); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp index 9f9223f0161..eb0b3692f01 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp @@ -129,14 +129,14 @@ public: { if (uiCrystalSpikesTimer2 <= diff) { - fSpikeXY[0][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO)); - fSpikeXY[0][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO)); - fSpikeXY[1][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO)); - fSpikeXY[1][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO)); - fSpikeXY[2][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2))); - fSpikeXY[2][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2))); - fSpikeXY[3][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2))); - fSpikeXY[3][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2))); + fSpikeXY[0][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO)); + fSpikeXY[0][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO)); + fSpikeXY[1][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO)); + fSpikeXY[1][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO)); + fSpikeXY[2][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO-(M_PI/2))); + fSpikeXY[2][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO-(M_PI/2))); + fSpikeXY[3][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO-(M_PI/2))); + fSpikeXY[3][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO-(M_PI/2))); for (uint8 i = 0; i < 4; ++i) me->SummonCreature(MOB_CRYSTAL_SPIKE, fSpikeXY[i][0], fSpikeXY[i][1], fBaseZ, 0, TEMPSUMMON_TIMED_DESPAWN, 7*IN_MILLISECONDS); if (++uiCrystalSpikesCount >= 13) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp index dcd3a3a91f5..67122b2e859 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -521,7 +521,7 @@ class boss_algalon_the_observer : public CreatureScript if (Creature* wormHole = DoSummon(NPC_WORM_HOLE, CollapsingStarPos[i], TEMPSUMMON_MANUAL_DESPAWN)) wormHole->m_Events.AddEvent(new SummonUnleashedDarkMatter(wormHole), wormHole->m_Events.CalculateTime(i >= 2 ? 8000 : 6000)); } - else if ((int32(me->GetHealth()) - int32(damage)) < CalculatePctF<int32>(int32(me->GetMaxHealth()), 2.5f) && !_fightWon) + else if ((int32(me->GetHealth()) - int32(damage)) < CalculatePct<int32>(int32(me->GetMaxHealth()), 2.5f) && !_fightWon) { _fightWon = true; damage = 0; 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 e3b1a7e94e1..2937a5b9987 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp @@ -181,8 +181,8 @@ class boss_warp_splinter : public CreatureScript { float angle = (M_PI / 3) * i; - float X = Treant_Spawn_Pos_X + TREANT_SPAWN_DIST * cos(angle); - float Y = Treant_Spawn_Pos_Y + TREANT_SPAWN_DIST * sin(angle); + float X = Treant_Spawn_Pos_X + TREANT_SPAWN_DIST * std::cos(angle); + float Y = Treant_Spawn_Pos_Y + TREANT_SPAWN_DIST * std::sin(angle); float O = - me->GetAngle(X, Y); if (Creature* pTreant = me->SummonCreature(CREATURE_TREANT, treant_pos[i][0], treant_pos[i][1], treant_pos[i][2], O, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000)) diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp index 96897ae3033..8398e48e09f 100644 --- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp +++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp @@ -194,7 +194,7 @@ class spell_mark_of_kazzak : public SpellScriptLoader void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* owner = GetUnitOwner()) - amount = CalculatePctU(owner->GetPower(POWER_MANA), 5); + amount = CalculatePct(owner->GetPower(POWER_MANA), 5); } void OnPeriodic(AuraEffect const* aurEff) diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index a1c48878507..b46d2083ecd 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -70,7 +70,7 @@ class spell_dk_anti_magic_shell_raid : public SpellScriptLoader void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { - absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct); + absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); } void Register() @@ -118,7 +118,7 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { - absorbAmount = std::min(CalculatePctN(dmgInfo.GetDamage(), absorbPct), GetTarget()->CountPctFromMaxHealth(hpPct)); + absorbAmount = std::min(CalculatePct(dmgInfo.GetDamage(), absorbPct), GetTarget()->CountPctFromMaxHealth(hpPct)); } void Trigger(AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount) @@ -179,7 +179,7 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { - absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct); + absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); } void Register() @@ -413,7 +413,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader multiplier = (GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()) / 100.f); // Death Knight T8 Melee 4P Bonus if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MELEE_4P_BONUS, EFFECT_0)) - AddPctF(multiplier, aurEff->GetAmount()); + AddPct(multiplier, aurEff->GetAmount()); } } @@ -425,7 +425,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader int32 bp = GetHitDamage() * multiplier; if (AuraEffect* aurEff = caster->GetAuraEffectOfRankedSpell(DK_SPELL_BLACK_ICE_R1, EFFECT_0)) - AddPctN(bp, aurEff->GetAmount()); + AddPct(bp, aurEff->GetAmount()); caster->CastCustomSpell(unitTarget, DK_SPELL_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true); } @@ -472,7 +472,7 @@ class spell_dk_spell_deflection : public SpellScriptLoader { // You have a chance equal to your Parry chance if ((dmgInfo.GetDamageType() == SPELL_DIRECT_DAMAGE) && roll_chance_f(GetTarget()->GetUnitParryChance())) - absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct); + absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); } void Register() @@ -582,7 +582,7 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader // Damage that would take you below [effect0] health or taken while you are at [effect0] if (remainingHp < minHp) - absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct); + absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); } void Register() @@ -722,7 +722,7 @@ class spell_dk_death_strike : public SpellScriptLoader int32 bp = int32(count * caster->CountPctFromMaxHealth(int32(GetSpellInfo()->Effects[EFFECT_0].DamageMultiplier))); // Improved Death Strike if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, ICON_ID_IMPROVED_DEATH_STRIKE, 0)) - AddPctN(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2)); + AddPct(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2)); caster->CastCustomSpell(caster, SPELL_DEATH_STRIKE_HEAL, &bp, NULL, NULL, false); } } diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 32a92da5e3a..2c873c84f74 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -181,7 +181,7 @@ class spell_dru_lifebloom : public SpellScriptLoader GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); // restore mana - int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2; + int32 returnMana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2; caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); return; } @@ -204,7 +204,7 @@ class spell_dru_lifebloom : public SpellScriptLoader target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID()); // restore mana - int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2; + int32 returnMana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2; caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID()); return; } @@ -255,7 +255,7 @@ class spell_dru_moonkin_form_passive : public SpellScriptLoader { // reduces all damage taken while Stunned in Moonkin Form if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)) - absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct); + absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); } void Register() @@ -327,7 +327,7 @@ class spell_dru_primal_tenacity : public SpellScriptLoader { // reduces all damage taken while Stunned in Cat Form if (GetTarget()->GetShapeshiftForm() == FORM_CAT && GetTarget()->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)) - absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct); + absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); } void Register() @@ -369,7 +369,7 @@ class spell_dru_savage_defense : public SpellScriptLoader void Absorb(AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount) { - absorbAmount = uint32(CalculatePctN(GetTarget()->GetTotalAttackPowerValue(BASE_ATTACK), absorbPct)); + absorbAmount = uint32(CalculatePct(GetTarget()->GetTotalAttackPowerValue(BASE_ATTACK), absorbPct)); aurEff->SetAmount(0); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 3085472749c..5cc31ad54e8 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1236,7 +1236,7 @@ class spell_gen_lifeblood : public SpellScriptLoader void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { if (Unit* owner = GetUnitOwner()) - amount += int32(CalculatePctF(owner->GetMaxHealth(), 1.5f / aurEff->GetTotalTicks())); + amount += int32(CalculatePct(owner->GetMaxHealth(), 1.5f / aurEff->GetTotalTicks())); } void Register() diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index e445f68cfba..31aafe8dd38 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -138,7 +138,7 @@ class spell_hun_chimera_shot : public SpellScriptLoader int32 TickCount = aurEff->GetTotalTicks(); spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT; basePoint = caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount()); - ApplyPctN(basePoint, TickCount * 40); + ApplyPct(basePoint, TickCount * 40); basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount()); } // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting. @@ -148,11 +148,11 @@ class spell_hun_chimera_shot : public SpellScriptLoader spellId = HUNTER_SPELL_CHIMERA_SHOT_VIPER; // Amount of one aura tick - basePoint = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount())); + basePoint = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount())); int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50; // TODO: WTF? caster uses unitTarget? if (basePoint > casterBasePoint) basePoint = casterBasePoint; - ApplyPctN(basePoint, TickCount * 60); + ApplyPct(basePoint, TickCount * 60); } // Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute. else if (familyFlag[0] & 0x00008000) diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 0edfbaee437..f4bbccc8587 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -292,7 +292,7 @@ class spell_mage_incanters_absorbtion_base_AuraScript : public AuraScript if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0)) { - int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount()); + int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount()); target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); } } diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 7be80088101..41bda3c163d 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -112,7 +112,7 @@ class spell_pal_ardent_defender : public SpellScriptLoader uint32 damageToReduce = (victim->GetHealth() < allowedHealth) ? dmgInfo.GetDamage() : allowedHealth - remainingHealth; - absorbAmount = CalculatePctN(damageToReduce, absorbPct); + absorbAmount = CalculatePct(damageToReduce, absorbPct); } } diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp index 7830d46260c..df6c311ca67 100644 --- a/src/server/scripts/Spells/spell_pet.cpp +++ b/src/server/scripts/Spells/spell_pet.cpp @@ -243,7 +243,7 @@ public: if (pet->isPet()) if (Unit* owner = pet->ToPet()->GetOwner()) { - float ownerBonus = CalculatePctN(owner->GetStat(STAT_STAMINA), 75); + float ownerBonus = CalculatePct(owner->GetStat(STAT_STAMINA), 75); amount += ownerBonus; } @@ -313,7 +313,7 @@ public: if (AuraEffect* /* aurEff */ect = owner->GetAuraEffect(56246, EFFECT_0)) { float base_attPower = pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT); - amount += CalculatePctN(amount+base_attPower, /* aurEff */ect->GetAmount()); + amount += CalculatePct(amount+base_attPower, /* aurEff */ect->GetAmount()); } } } @@ -382,7 +382,7 @@ public: { float ownerBonus = 0.0f; - ownerBonus = CalculatePctN(owner->GetStat(STAT_INTELLECT), 30); + ownerBonus = CalculatePct(owner->GetStat(STAT_INTELLECT), 30); amount += ownerBonus; _tempBonus = ownerBonus; @@ -434,7 +434,7 @@ public: if (Unit* owner = pet->ToPet()->GetOwner()) { float ownerBonus = 0.0f; - ownerBonus = CalculatePctN(owner->GetArmor(), 35); + ownerBonus = CalculatePct(owner->GetArmor(), 35); amount += ownerBonus; } } @@ -446,7 +446,7 @@ public: if (Unit* owner = pet->ToPet()->GetOwner()) { float ownerBonus = 0.0f; - ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40); + ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FIRE), 40); amount += ownerBonus; } } @@ -493,7 +493,7 @@ public: if (Unit* owner = pet->ToPet()->GetOwner()) { float ownerBonus = 0.0f; - ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40); + ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FROST), 40); amount += ownerBonus; } } @@ -505,7 +505,7 @@ public: if (Unit* owner = pet->ToPet()->GetOwner()) { float ownerBonus = 0.0f; - ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40); + ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40); amount += ownerBonus; } } @@ -517,7 +517,7 @@ public: if (Unit* owner = pet->ToPet()->GetOwner()) { float ownerBonus = 0.0f; - ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40); + ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_NATURE), 40); amount += ownerBonus; } } @@ -560,7 +560,7 @@ public: if (Unit* owner = pet->ToPet()->GetOwner()) { float ownerBonus = 0.0f; - ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40); + ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40); amount += ownerBonus; } } @@ -686,7 +686,7 @@ public: if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347)) if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase()) if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0)) - amount += CalculatePctN(CritSpell, improvedDemonicTacticsEffect->GetAmount()); + amount += CalculatePct(CritSpell, improvedDemonicTacticsEffect->GetAmount()); } } @@ -708,7 +708,7 @@ public: if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347)) if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase()) if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0)) - amount += CalculatePctN(CritMelee, improvedDemonicTacticsEffect->GetAmount()); + amount += CalculatePct(CritMelee, improvedDemonicTacticsEffect->GetAmount()); } } @@ -898,7 +898,7 @@ public: if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value - AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue()); + AddPct(mod, spellInfo->Effects[EFFECT_0].CalcValue()); } ownerBonus = owner->GetStat(STAT_STAMINA)*mod; @@ -941,7 +941,7 @@ public: if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value - mod += CalculatePctN(1.0f, spellInfo->Effects[EFFECT_1].CalcValue()); + mod += CalculatePct(1.0f, spellInfo->Effects[EFFECT_1].CalcValue()); } bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f * mod; @@ -971,7 +971,7 @@ public: if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value - mod += CalculatePctN(1.0f, spellInfo->Effects[EFFECT_1].CalcValue()); + mod += CalculatePct(1.0f, spellInfo->Effects[EFFECT_1].CalcValue()); } bonusDamage = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod; @@ -1028,7 +1028,7 @@ public: float ownerBonus = 0.0f; - ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40); + ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FROST), 40); amount += ownerBonus; } @@ -1047,7 +1047,7 @@ public: float ownerBonus = 0.0f; - ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40); + ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FIRE), 40); amount += ownerBonus; } @@ -1066,7 +1066,7 @@ public: float ownerBonus = 0.0f; - ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40); + ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_NATURE), 40); amount += ownerBonus; } @@ -1115,7 +1115,7 @@ public: float ownerBonus = 0.0f; - ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40); + ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40); amount += ownerBonus; } @@ -1134,7 +1134,7 @@ public: float ownerBonus = 0.0f; - ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40); + ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40); amount += ownerBonus; } @@ -1153,7 +1153,7 @@ public: float ownerBonus = 0.0f; - ownerBonus = CalculatePctN(owner->GetArmor(), 35); + ownerBonus = CalculatePct(owner->GetArmor(), 35); amount += ownerBonus; } @@ -1544,12 +1544,12 @@ public: aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0); if (aurEff) { - mod += CalculatePctN(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale + mod += CalculatePct(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale } // Glyph of the Ghoul aurEff = owner->GetAuraEffect(58686, 0); if (aurEff) - mod += CalculatePctN(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod + mod += CalculatePct(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod float ownerBonus = float(owner->GetStat(STAT_STRENGTH)) * mod; amount += ownerBonus; } diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 3d8ca3e729b..aee3889e93b 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -278,7 +278,7 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader if (GetCaster()) if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0)) { - int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount()); + int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount()); target->CastCustomSpell(dmgInfo.GetAttacker(), PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); } } @@ -316,7 +316,7 @@ public: if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_T9_HEALING_2_PIECE, EFFECT_0)) { int32 heal = GetHitHeal(); - AddPctN(heal, aurEff->GetAmount()); + AddPct(heal, aurEff->GetAmount()); SetHitHeal(heal); } } @@ -432,7 +432,7 @@ class spell_pri_shadow_word_death : public SpellScriptLoader // Pain and Suffering reduces damage if (AuraEffect* aurEff = GetCaster()->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_PAIN_AND_SUFFERING, EFFECT_1)) - AddPctN(damage, aurEff->GetAmount()); + AddPct(damage, aurEff->GetAmount()); GetCaster()->CastCustomSpell(GetCaster(), PRIEST_SHADOW_WORD_DEATH, &damage, 0, 0, true); } diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index ad437c5e431..ab6d0e95c1d 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -124,7 +124,7 @@ class spell_rog_nerves_of_steel : public SpellScriptLoader { // reduces all damage taken while stun or fear if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))) - absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct); + absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); } void Register() diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index c863c2363af..e107ea954e4 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -78,7 +78,7 @@ class spell_sha_astral_shift : public SpellScriptLoader { // reduces all damage taken while stun, fear or silence if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING | UNIT_FLAG_SILENCED) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))) - absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct); + absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); } void Register() @@ -184,7 +184,7 @@ class spell_sha_mana_tide_totem : public SpellScriptLoader if (AuraEffect* dummy = owner->GetAuraEffect(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE, 0)) effValue += dummy->GetAmount(); // Regenerate 6% of Total Mana Every 3 secs - int32 effBasePoints0 = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), effValue)); + int32 effBasePoints0 = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), effValue)); caster->CastCustomSpell(unitTarget, SHAMAN_SPELL_MANA_TIDE_TOTEM, &effBasePoints0, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID()); } } @@ -501,11 +501,11 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader // Restorative Totems if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, ICON_ID_RESTORATIVE_TOTEMS, 1)) - AddPctN(damage, dummy->GetAmount()); + AddPct(damage, dummy->GetAmount()); // Glyph of Healing Stream Totem if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_GLYPH_OF_HEALING_STREAM_TOTEM, EFFECT_0)) - AddPctN(damage, aurEff->GetAmount()); + AddPct(damage, aurEff->GetAmount()); damage = int32(target->SpellHealingBonusTaken(owner, triggeringSpell, damage, HEAL)); } @@ -592,7 +592,7 @@ class spell_sha_lava_lash : public SpellScriptLoader { // Damage is increased by 25% if your off-hand weapon is enchanted with Flametongue. if (caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0x200000, 0, 0)) - AddPctN(hitDamage, damage); + AddPct(hitDamage, damage); SetHitDamage(hitDamage); } } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 0def62b7d3a..aa56f8300bc 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -410,7 +410,7 @@ class spell_warl_life_tap : public SpellScriptLoader // Improved Life Tap mod if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, ICON_ID_IMPROVED_LIFE_TAP, 0)) - AddPctN(mana, aurEff->GetAmount()); + AddPct(mana, aurEff->GetAmount()); caster->CastCustomSpell(target, SPELL_LIFE_TAP_ENERGIZE, &mana, NULL, NULL, false); @@ -421,7 +421,7 @@ class spell_warl_life_tap : public SpellScriptLoader if (manaFeedVal > 0) { - ApplyPctN(manaFeedVal, mana); + ApplyPct(manaFeedVal, mana); caster->CastCustomSpell(caster, SPELL_LIFE_TAP_ENERGIZE_2, &manaFeedVal, NULL, NULL, true, NULL); } } @@ -544,7 +544,7 @@ class spell_warl_haunt : public SpellScriptLoader { if (Aura* aura = GetHitAura()) if (AuraEffect* aurEff = aura->GetEffect(EFFECT_1)) - aurEff->SetAmount(CalculatePctN(aurEff->GetAmount(), GetHitDamage())); + aurEff->SetAmount(CalculatePct(aurEff->GetAmount(), GetHitDamage())); } void Register() diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index c64101e11ea..cc8dbe35703 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -183,7 +183,7 @@ class spell_warr_deep_wounds : public SpellScriptLoader // apply percent damage mods damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); - ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id)); + ApplyPct(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id)); damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); @@ -368,7 +368,7 @@ class spell_warr_concussion_blow : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { - SetHitDamage(CalculatePctN(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetEffectValue())); + SetHitDamage(CalculatePct(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetEffectValue())); } void Register() @@ -400,7 +400,7 @@ class spell_warr_bloodthirst : public SpellScriptLoader void HandleDamage(SpellEffIndex /*effIndex*/) { int32 damage = GetEffectValue(); - ApplyPctF(damage, GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK)); + ApplyPct(damage, GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK)); if (Unit* target = GetHitUnit()) { diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 5640a84317c..9ade37a1096 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -1954,8 +1954,8 @@ public: me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_ASCENDING|MOVEMENTFLAG_FLYING); me->SetSpeed(MOVE_FLIGHT, 0.75f, true); me->SetSpeed(MOVE_RUN, 0.75f, true); - float x = me->GetPositionX() + 20 * cos(me->GetOrientation()); - float y = me->GetPositionY() + 20 * sin(me->GetOrientation()); + float x = me->GetPositionX() + 20 * std::cos(me->GetOrientation()); + float y = me->GetPositionY() + 20 * std::sin(me->GetOrientation()); float z = me->GetPositionZ() + 40; me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MovePoint(0, x, y, z); |
