mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-19 22:49:39 -04:00
f3e86d3e68
Happy new year Conflicts: src/server/bnetserver/Authentication/AuthCodes.h src/server/bnetserver/Authentication/BattlenetPacketCrypt.cpp src/server/bnetserver/Authentication/BattlenetPacketCrypt.h src/server/bnetserver/Packets/AchievementPackets.h src/server/bnetserver/Packets/AuthenticationPackets.cpp src/server/bnetserver/Packets/AuthenticationPackets.h src/server/bnetserver/Packets/BitStream.cpp src/server/bnetserver/Packets/BitStream.h src/server/bnetserver/Packets/CachePackets.cpp src/server/bnetserver/Packets/CachePackets.h src/server/bnetserver/Packets/ChatPackets.h src/server/bnetserver/Packets/ConnectionPackets.cpp src/server/bnetserver/Packets/ConnectionPackets.h src/server/bnetserver/Packets/FriendsPackets.cpp src/server/bnetserver/Packets/FriendsPackets.h src/server/bnetserver/Packets/PacketManager.cpp src/server/bnetserver/Packets/PacketManager.h src/server/bnetserver/Packets/Packets.h src/server/bnetserver/Packets/PacketsBase.cpp src/server/bnetserver/Packets/PacketsBase.h src/server/bnetserver/Packets/PresencePackets.cpp src/server/bnetserver/Packets/PresencePackets.h src/server/bnetserver/Packets/ProfilePackets.h src/server/bnetserver/Packets/SupportPackets.h src/server/bnetserver/Packets/WoWRealmPackets.cpp src/server/bnetserver/Packets/WoWRealmPackets.h src/server/bnetserver/Realms/RealmList.cpp src/server/bnetserver/Realms/WorldListener.cpp src/server/bnetserver/Realms/WorldListener.h src/server/bnetserver/Server/ComponentManager.cpp src/server/bnetserver/Server/ComponentManager.h src/server/bnetserver/Server/ModuleManager.cpp src/server/bnetserver/Server/ModuleManager.h src/server/bnetserver/Server/Session.cpp src/server/bnetserver/Server/Session.h src/server/bnetserver/Server/SessionManager.cpp src/server/bnetserver/Server/SessionManager.h src/server/game/Accounts/BattlenetAccountMgr.cpp src/server/game/Accounts/BattlenetAccountMgr.h src/server/game/Battlegrounds/Zones/BattlegroundBFG.cpp src/server/game/Battlegrounds/Zones/BattlegroundBFG.h src/server/game/Battlegrounds/Zones/BattlegroundTP.cpp src/server/game/Battlegrounds/Zones/BattlegroundTP.h src/server/game/Entities/AreaTrigger/AreaTrigger.cpp src/server/game/Entities/AreaTrigger/AreaTrigger.h src/server/game/Entities/Item/ItemTemplate.cpp src/server/game/Guilds/GuildFinderMgr.cpp src/server/game/Guilds/GuildFinderMgr.h src/server/game/Handlers/GuildFinderHandler.cpp src/server/game/Handlers/VoidStorageHandler.cpp src/server/game/Movement/MovementStructures.cpp src/server/game/Movement/MovementStructures.h src/server/game/Movement/PathGenerator.cpp src/server/game/Server/BattlenetServerManager.cpp src/server/game/Server/BattlenetServerManager.h src/server/game/Server/Packet.cpp src/server/game/Server/Packet.h src/server/game/Server/Packets/AchievementPackets.cpp src/server/game/Server/Packets/AchievementPackets.h src/server/game/Server/Packets/AuctionHousePackets.cpp src/server/game/Server/Packets/AuctionHousePackets.h src/server/game/Server/Packets/AuthenticationPackets.cpp src/server/game/Server/Packets/AuthenticationPackets.h src/server/game/Server/Packets/BattlegroundPackets.cpp src/server/game/Server/Packets/BattlegroundPackets.h src/server/game/Server/Packets/ChannelPackets.cpp src/server/game/Server/Packets/ChannelPackets.h src/server/game/Server/Packets/CharacterPackets.cpp src/server/game/Server/Packets/CharacterPackets.h src/server/game/Server/Packets/ChatPackets.cpp src/server/game/Server/Packets/ChatPackets.h src/server/game/Server/Packets/ClientConfigPackets.cpp src/server/game/Server/Packets/ClientConfigPackets.h src/server/game/Server/Packets/CombatLogPackets.cpp src/server/game/Server/Packets/CombatLogPackets.h src/server/game/Server/Packets/CombatPackets.cpp src/server/game/Server/Packets/CombatPackets.h src/server/game/Server/Packets/EquipmentSetPackets.cpp src/server/game/Server/Packets/EquipmentSetPackets.h src/server/game/Server/Packets/GameObjectPackets.cpp src/server/game/Server/Packets/GameObjectPackets.h src/server/game/Server/Packets/GuildPackets.cpp src/server/game/Server/Packets/GuildPackets.h src/server/game/Server/Packets/ItemPackets.cpp src/server/game/Server/Packets/ItemPackets.h src/server/game/Server/Packets/LootPackets.h src/server/game/Server/Packets/MiscPackets.cpp src/server/game/Server/Packets/MiscPackets.h src/server/game/Server/Packets/MovementPackets.cpp src/server/game/Server/Packets/MovementPackets.h src/server/game/Server/Packets/NPCPackets.cpp src/server/game/Server/Packets/NPCPackets.h src/server/game/Server/Packets/QueryPackets.cpp src/server/game/Server/Packets/QueryPackets.h src/server/game/Server/Packets/QuestPackets.cpp src/server/game/Server/Packets/QuestPackets.h src/server/game/Server/Packets/ReputationPackets.cpp src/server/game/Server/Packets/ReputationPackets.h src/server/game/Server/Packets/SpellPackets.cpp src/server/game/Server/Packets/SpellPackets.h src/server/game/Server/Packets/SystemPackets.cpp src/server/game/Server/Packets/SystemPackets.h src/server/game/Server/Packets/TalentPackets.cpp src/server/game/Server/Packets/TalentPackets.h src/server/game/Server/Packets/TradePackets.h src/server/game/Server/Packets/WorldStatePackets.cpp src/server/game/Server/Packets/WorldStatePackets.h src/server/game/Server/WorldSocket.cpp src/server/ipc/CMakeLists.txt src/server/ipc/Commands.cpp src/server/ipc/Commands.h src/server/ipc/ZMQTask.cpp src/server/ipc/ZMQTask.h src/server/ipc/ZmqContext.cpp src/server/ipc/ZmqContext.h src/server/ipc/ZmqListener.cpp src/server/ipc/ZmqListener.h src/server/ipc/ZmqMux.cpp src/server/ipc/ZmqMux.h src/server/ipc/ZmqWorker.cpp src/server/ipc/ZmqWorker.h src/server/scripts/Commands/cs_battlenet_account.cpp src/server/scripts/Commands/cs_mmaps.cpp src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp src/server/scripts/EasternKingdoms/BaradinHold/boss_pit_lord_argaloth.cpp src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.cpp src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.h src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_ascendant_lord_obsidius.cpp src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_beauty.cpp src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_corla.cpp src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_karsh_steelbender.cpp src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_romogg_bonecrusher.cpp src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/instance_blackrock_caverns.cpp src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_daakara.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp src/server/scripts/EasternKingdoms/ZulAman/zulaman.h src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo_the_godbreaker.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_kilnara.cpp src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h src/server/scripts/EasternKingdoms/zone_burning_steppes.cpp src/server/scripts/EasternKingdoms/zone_ironforge.cpp src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp src/server/scripts/Kalimdor/Firelands/firelands.h src/server/scripts/Kalimdor/Firelands/instance_firelands.cpp src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp src/server/scripts/Kalimdor/HallsOfOrigination/boss_earthrager_ptah.cpp src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp src/server/scripts/Kalimdor/HallsOfOrigination/halls_of_origination.h src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp src/server/scripts/Kalimdor/zone_azshara.cpp src/server/scripts/Kalimdor/zone_darkshore.cpp src/server/scripts/Kalimdor/zone_felwood.cpp src/server/scripts/Kalimdor/zone_moonglade.cpp src/server/scripts/Kalimdor/zone_orgrimmar.cpp src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp src/server/scripts/Maelstrom/Stonecore/boss_corborus.cpp src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp src/server/scripts/Maelstrom/Stonecore/boss_ozruk.cpp src/server/scripts/Maelstrom/Stonecore/boss_slabhide.cpp src/server/scripts/Maelstrom/Stonecore/instance_stonecore.cpp src/server/scripts/Maelstrom/Stonecore/stonecore.cpp src/server/scripts/Maelstrom/Stonecore/stonecore.h src/server/shared/Cryptography/Authentication/AuthCrypt.h src/server/shared/Cryptography/Authentication/PacketCrypt.cpp src/server/shared/Cryptography/Authentication/WorldPacketCrypt.cpp src/server/shared/Cryptography/HmacHash.cpp src/server/shared/Cryptography/SHA256.cpp src/server/shared/Cryptography/SHA256.h src/server/shared/Database/Implementation/HotfixDatabase.cpp src/server/shared/Database/Implementation/HotfixDatabase.h src/server/shared/Realm/Realm.cpp src/server/shared/Realm/Realm.h src/tools/connection_patcher/CMakeLists.txt src/tools/connection_patcher/Constants/BinaryTypes.hpp src/tools/connection_patcher/Helper.cpp src/tools/connection_patcher/Helper.hpp src/tools/connection_patcher/Patcher.cpp src/tools/connection_patcher/Patcher.hpp src/tools/connection_patcher/Patches/Common.hpp src/tools/connection_patcher/Patches/Mac.hpp src/tools/connection_patcher/Patches/Windows.hpp src/tools/connection_patcher/Patterns/Common.hpp src/tools/connection_patcher/Patterns/Mac.hpp src/tools/connection_patcher/Patterns/Windows.hpp src/tools/connection_patcher/Program.cpp src/tools/map_extractor/loadlib/DBFilesClientList.h
1769 lines
70 KiB
C++
1769 lines
70 KiB
C++
/*
|
|
* Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
* option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
* more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
/*
|
|
* Scripts for spells with SPELLFAMILY_DEATHKNIGHT and SPELLFAMILY_GENERIC spells used by deathknight players.
|
|
* Ordered alphabetically using scriptname.
|
|
* Scriptnames of files in this file should be prefixed with "spell_dk_".
|
|
*/
|
|
|
|
#include "ScriptMgr.h"
|
|
#include "SpellScript.h"
|
|
#include "SpellAuraEffects.h"
|
|
#include "Unit.h"
|
|
#include "Player.h"
|
|
#include "Pet.h"
|
|
|
|
enum HunterPetCalculate
|
|
{
|
|
SPELL_TAMED_PET_PASSIVE_06 = 19591,
|
|
SPELL_TAMED_PET_PASSIVE_07 = 20784,
|
|
SPELL_TAMED_PET_PASSIVE_08 = 34666,
|
|
SPELL_TAMED_PET_PASSIVE_09 = 34667,
|
|
SPELL_TAMED_PET_PASSIVE_10 = 34675,
|
|
SPELL_HUNTER_PET_SCALING_01 = 34902,
|
|
SPELL_HUNTER_PET_SCALING_02 = 34903,
|
|
SPELL_HUNTER_PET_SCALING_03 = 34904,
|
|
SPELL_HUNTER_PET_SCALING_04 = 61017,
|
|
SPELL_HUNTER_ANIMAL_HANDLER = 34453,
|
|
};
|
|
|
|
enum WarlockPetCalculate
|
|
{
|
|
SPELL_PET_PASSIVE_CRIT = 35695,
|
|
SPELL_PET_PASSIVE_DAMAGE_TAKEN = 35697,
|
|
SPELL_WARLOCK_PET_SCALING_01 = 34947,
|
|
SPELL_WARLOCK_PET_SCALING_02 = 34956,
|
|
SPELL_WARLOCK_PET_SCALING_03 = 34957,
|
|
SPELL_WARLOCK_PET_SCALING_04 = 34958,
|
|
SPELL_WARLOCK_PET_SCALING_05 = 61013,
|
|
ENTRY_FELGUARD = 17252,
|
|
ENTRY_VOIDWALKER = 1860,
|
|
ENTRY_FELHUNTER = 417,
|
|
ENTRY_SUCCUBUS = 1863,
|
|
ENTRY_IMP = 416,
|
|
SPELL_WARLOCK_GLYPH_OF_VOIDWALKER = 56247,
|
|
};
|
|
|
|
enum DKPetCalculate
|
|
{
|
|
SPELL_DEATH_KNIGHT_RUNE_WEAPON_02 = 51906,
|
|
SPELL_DEATH_KNIGHT_PET_SCALING_01 = 54566,
|
|
SPELL_DEATH_KNIGHT_PET_SCALING_02 = 51996,
|
|
SPELL_DEATH_KNIGHT_PET_SCALING_03 = 61697,
|
|
SPELL_NIGHT_OF_THE_DEAD = 55620,
|
|
ENTRY_ARMY_OF_THE_DEAD_GHOUL = 24207,
|
|
SPELL_DEATH_KNIGHT_GLYPH_OF_GHOUL = 58686,
|
|
};
|
|
|
|
enum ShamanPetCalculate
|
|
{
|
|
SPELL_FERAL_SPIRIT_PET_UNK_01 = 35674,
|
|
SPELL_FERAL_SPIRIT_PET_UNK_02 = 35675,
|
|
SPELL_FERAL_SPIRIT_PET_UNK_03 = 35676,
|
|
SPELL_FERAL_SPIRIT_PET_SCALING_04 = 61783,
|
|
};
|
|
|
|
enum MiscPetCalculate
|
|
{
|
|
SPELL_MAGE_PET_PASSIVE_ELEMENTAL = 44559,
|
|
SPELL_PET_HEALTH_SCALING = 61679,
|
|
SPELL_PET_UNK_01 = 67561,
|
|
SPELL_PET_UNK_02 = 67557,
|
|
};
|
|
|
|
class spell_gen_pet_calculate : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_gen_pet_calculate() : SpellScriptLoader("spell_gen_pet_calculate") { }
|
|
|
|
class spell_gen_pet_calculate_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_gen_pet_calculate_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateAmountCritSpell(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float CritSpell = 0.0f;
|
|
// Crit from Intellect
|
|
CritSpell += owner->GetSpellCritFromIntellect();
|
|
// Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
|
|
CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
|
|
// Increase crit from SPELL_AURA_MOD_CRIT_PCT
|
|
CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
|
|
// Increase crit spell from spell crit ratings
|
|
CritSpell += owner->GetRatingBonusValue(CR_CRIT_SPELL);
|
|
|
|
amount += int32(CritSpell);
|
|
}
|
|
}
|
|
|
|
void CalculateAmountCritMelee(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float CritMelee = 0.0f;
|
|
// Crit from Agility
|
|
CritMelee += owner->GetMeleeCritFromAgility();
|
|
// Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
|
|
CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
|
|
// Increase crit from SPELL_AURA_MOD_CRIT_PCT
|
|
CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
|
|
// Increase crit melee from melee crit ratings
|
|
CritMelee += owner->GetRatingBonusValue(CR_CRIT_MELEE);
|
|
|
|
amount += int32(CritMelee);
|
|
}
|
|
}
|
|
|
|
void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float HitMelee = 0.0f;
|
|
// Increase hit from SPELL_AURA_MOD_HIT_CHANCE
|
|
HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
|
|
// Increase hit melee from meele hit ratings
|
|
HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE);
|
|
|
|
amount += int32(HitMelee);
|
|
}
|
|
}
|
|
|
|
void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float HitSpell = 0.0f;
|
|
// Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
|
|
HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
|
|
// Increase hit spell from spell hit ratings
|
|
HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
|
|
|
|
amount += int32(HitSpell);
|
|
}
|
|
}
|
|
|
|
void CalculateAmountExpertise(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float Expertise = 0.0f;
|
|
// Increase hit from SPELL_AURA_MOD_EXPERTISE
|
|
Expertise += owner->GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE);
|
|
// Increase Expertise from Expertise ratings
|
|
Expertise += owner->GetRatingBonusValue(CR_EXPERTISE);
|
|
|
|
amount += int32(Expertise);
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
switch (m_scriptSpellId)
|
|
{
|
|
case SPELL_TAMED_PET_PASSIVE_06:
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountCritMelee, EFFECT_0, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountCritSpell, EFFECT_1, SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
|
|
break;
|
|
case SPELL_PET_PASSIVE_CRIT:
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountCritSpell, EFFECT_0, SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountCritMelee, EFFECT_1, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
|
|
break;
|
|
case SPELL_WARLOCK_PET_SCALING_05:
|
|
case SPELL_HUNTER_PET_SCALING_04:
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountExpertise, EFFECT_2, SPELL_AURA_MOD_EXPERTISE);
|
|
break;
|
|
case SPELL_DEATH_KNIGHT_PET_SCALING_03:
|
|
// case SPELL_SHAMAN_PET_HIT:
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_gen_pet_calculate_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_warl_pet_scaling_01 : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_warl_pet_scaling_01() : SpellScriptLoader("spell_warl_pet_scaling_01") { }
|
|
|
|
class spell_warl_pet_scaling_01_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_warl_pet_scaling_01_AuraScript);
|
|
|
|
public:
|
|
spell_warl_pet_scaling_01_AuraScript()
|
|
{
|
|
_tempBonus = 0;
|
|
}
|
|
|
|
private:
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateStaminaAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (pet->IsPet())
|
|
if (Unit* owner = pet->ToPet()->GetOwner())
|
|
{
|
|
float ownerBonus = CalculatePct(owner->GetStat(STAT_STAMINA), 75);
|
|
|
|
amount += ownerBonus;
|
|
}
|
|
}
|
|
|
|
void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (_tempBonus)
|
|
{
|
|
PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->getLevel());
|
|
uint32 healthMod = 0;
|
|
uint32 baseHealth = pInfo->health;
|
|
switch (pet->GetEntry())
|
|
{
|
|
case ENTRY_IMP:
|
|
healthMod = uint32(_tempBonus * 8.4f);
|
|
break;
|
|
case ENTRY_FELGUARD:
|
|
case ENTRY_VOIDWALKER:
|
|
healthMod = _tempBonus * 11;
|
|
break;
|
|
case ENTRY_SUCCUBUS:
|
|
healthMod = uint32(_tempBonus * 9.1f);
|
|
break;
|
|
case ENTRY_FELHUNTER:
|
|
healthMod = uint32(_tempBonus * 9.5f);
|
|
break;
|
|
default:
|
|
healthMod = 0;
|
|
break;
|
|
}
|
|
if (healthMod)
|
|
pet->ToPet()->SetCreateHealth(baseHealth + healthMod);
|
|
}
|
|
}
|
|
|
|
void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (pet->IsPet())
|
|
{
|
|
PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->getLevel());
|
|
pet->ToPet()->SetCreateHealth(pInfo->health);
|
|
}
|
|
}
|
|
|
|
void CalculateAttackPowerAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (pet->IsPet())
|
|
|
|
if (Unit* owner = pet->ToPet()->GetOwner())
|
|
{
|
|
int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
|
|
int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
|
|
int32 maximum = (fire > shadow) ? fire : shadow;
|
|
if (maximum < 0)
|
|
maximum = 0;
|
|
float bonusAP = maximum * 0.57f;
|
|
|
|
amount += bonusAP;
|
|
|
|
// Glyph of felguard
|
|
if (pet->GetEntry() == ENTRY_FELGUARD)
|
|
{
|
|
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 += CalculatePct(amount+base_attPower, /* aurEff */ect->GetAmount());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void CalculateDamageDoneAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (pet->IsPet())
|
|
if (Unit* owner = pet->ToPet()->GetOwner())
|
|
{
|
|
//the damage bonus used for pets is either fire or shadow damage, whatever is higher
|
|
int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
|
|
int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
|
|
int32 maximum = (fire > shadow) ? fire : shadow;
|
|
float bonusDamage = 0.0f;
|
|
|
|
if (maximum > 0)
|
|
bonusDamage = maximum * 0.15f;
|
|
|
|
amount += bonusDamage;
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
OnEffectRemove += AuraEffectRemoveFn(spell_warl_pet_scaling_01_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
|
|
AfterEffectApply += AuraEffectApplyFn(spell_warl_pet_scaling_01_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_01_AuraScript::CalculateStaminaAmount, EFFECT_0, SPELL_AURA_MOD_STAT);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_01_AuraScript::CalculateAttackPowerAmount, EFFECT_1, SPELL_AURA_MOD_ATTACK_POWER);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_01_AuraScript::CalculateDamageDoneAmount, EFFECT_2, SPELL_AURA_MOD_DAMAGE_DONE);
|
|
}
|
|
|
|
private:
|
|
uint32 _tempBonus;
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_warl_pet_scaling_01_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_warl_pet_scaling_02 : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_warl_pet_scaling_02() : SpellScriptLoader("spell_warl_pet_scaling_02") { }
|
|
|
|
class spell_warl_pet_scaling_02_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_warl_pet_scaling_02_AuraScript);
|
|
|
|
public:
|
|
spell_warl_pet_scaling_02_AuraScript()
|
|
{
|
|
_tempBonus = 0;
|
|
}
|
|
|
|
private:
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateIntellectAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (pet->IsPet())
|
|
if (Unit* owner = pet->ToPet()->GetOwner())
|
|
{
|
|
float ownerBonus = 0.0f;
|
|
|
|
ownerBonus = CalculatePct(owner->GetStat(STAT_INTELLECT), 30);
|
|
|
|
amount += ownerBonus;
|
|
_tempBonus = ownerBonus;
|
|
}
|
|
}
|
|
|
|
void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (_tempBonus)
|
|
{
|
|
PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->getLevel());
|
|
uint32 manaMod = 0;
|
|
uint32 baseMana = pInfo->mana;
|
|
switch (pet->GetEntry())
|
|
{
|
|
case ENTRY_IMP:
|
|
manaMod = uint32(_tempBonus * 4.9f);
|
|
break;
|
|
case ENTRY_VOIDWALKER:
|
|
case ENTRY_SUCCUBUS:
|
|
case ENTRY_FELHUNTER:
|
|
case ENTRY_FELGUARD:
|
|
manaMod = uint32(_tempBonus * 11.5f);
|
|
break;
|
|
default:
|
|
manaMod = 0;
|
|
break;
|
|
}
|
|
if (manaMod)
|
|
pet->ToPet()->SetCreateMana(baseMana + manaMod);
|
|
}
|
|
}
|
|
|
|
void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (pet->IsPet())
|
|
{
|
|
PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->getLevel());
|
|
pet->ToPet()->SetCreateMana(pInfo->mana);
|
|
}
|
|
}
|
|
|
|
void CalculateArmorAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (pet->IsPet())
|
|
if (Unit* owner = pet->ToPet()->GetOwner())
|
|
{
|
|
float ownerBonus = 0.0f;
|
|
ownerBonus = CalculatePct(owner->GetArmor(), 35);
|
|
amount += ownerBonus;
|
|
}
|
|
}
|
|
|
|
void CalculateFireResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (pet->IsPet())
|
|
if (Unit* owner = pet->ToPet()->GetOwner())
|
|
{
|
|
float ownerBonus = 0.0f;
|
|
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
|
|
amount += ownerBonus;
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
OnEffectRemove += AuraEffectRemoveFn(spell_warl_pet_scaling_02_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
|
|
AfterEffectApply += AuraEffectApplyFn(spell_warl_pet_scaling_02_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_02_AuraScript::CalculateIntellectAmount, EFFECT_0, SPELL_AURA_MOD_STAT);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_02_AuraScript::CalculateArmorAmount, EFFECT_1, SPELL_AURA_MOD_RESISTANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_02_AuraScript::CalculateFireResistanceAmount, EFFECT_2, SPELL_AURA_MOD_RESISTANCE);
|
|
}
|
|
|
|
private:
|
|
uint32 _tempBonus;
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_warl_pet_scaling_02_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_warl_pet_scaling_03 : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_warl_pet_scaling_03() : SpellScriptLoader("spell_warl_pet_scaling_03") { }
|
|
|
|
class spell_warl_pet_scaling_03_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_warl_pet_scaling_03_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateFrostResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (pet->IsPet())
|
|
if (Unit* owner = pet->ToPet()->GetOwner())
|
|
{
|
|
float ownerBonus = 0.0f;
|
|
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
|
|
amount += ownerBonus;
|
|
}
|
|
}
|
|
|
|
void CalculateArcaneResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (pet->IsPet())
|
|
if (Unit* owner = pet->ToPet()->GetOwner())
|
|
{
|
|
float ownerBonus = 0.0f;
|
|
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
|
|
amount += ownerBonus;
|
|
}
|
|
}
|
|
|
|
void CalculateNatureResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (pet->IsPet())
|
|
if (Unit* owner = pet->ToPet()->GetOwner())
|
|
{
|
|
float ownerBonus = 0.0f;
|
|
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
|
|
amount += ownerBonus;
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_03_AuraScript::CalculateFrostResistanceAmount, EFFECT_0, SPELL_AURA_MOD_RESISTANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_03_AuraScript::CalculateArcaneResistanceAmount, EFFECT_1, SPELL_AURA_MOD_RESISTANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_03_AuraScript::CalculateNatureResistanceAmount, EFFECT_2, SPELL_AURA_MOD_RESISTANCE);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_warl_pet_scaling_03_AuraScript();
|
|
}
|
|
};
|
|
|
|
|
|
class spell_warl_pet_scaling_04 : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_warl_pet_scaling_04() : SpellScriptLoader("spell_warl_pet_scaling_04") { }
|
|
|
|
class spell_warl_pet_scaling_04_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_warl_pet_scaling_04_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateShadowResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (pet->IsPet())
|
|
if (Unit* owner = pet->ToPet()->GetOwner())
|
|
{
|
|
float ownerBonus = 0.0f;
|
|
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
|
|
amount += ownerBonus;
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_04_AuraScript::CalculateShadowResistanceAmount, EFFECT_0, SPELL_AURA_MOD_RESISTANCE);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_warl_pet_scaling_04_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_warl_pet_scaling_05 : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_warl_pet_scaling_05() : SpellScriptLoader("spell_warl_pet_scaling_05") { }
|
|
|
|
class spell_warl_pet_scaling_05_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_warl_pet_scaling_05_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float HitMelee = 0.0f;
|
|
// Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
|
|
HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
|
|
// Increase hit spell from spell hit ratings
|
|
HitMelee += owner->GetRatingBonusValue(CR_HIT_SPELL);
|
|
|
|
amount += int32(HitMelee);
|
|
}
|
|
}
|
|
|
|
void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float HitSpell = 0.0f;
|
|
// Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
|
|
HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
|
|
// Increase hit spell from spell hit ratings
|
|
HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
|
|
|
|
amount += int32(HitSpell);
|
|
}
|
|
}
|
|
|
|
void CalculateAmountExpertise(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float Expertise = 0.0f;
|
|
// Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
|
|
Expertise += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
|
|
// Increase hit spell from spell hit ratings
|
|
Expertise += owner->GetRatingBonusValue(CR_HIT_SPELL);
|
|
|
|
amount += int32(Expertise);
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_05_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_05_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_05_AuraScript::CalculateAmountExpertise, EFFECT_2, SPELL_AURA_MOD_EXPERTISE);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_warl_pet_scaling_05_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_warl_pet_passive : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_warl_pet_passive() : SpellScriptLoader("spell_warl_pet_passive") { }
|
|
|
|
class spell_warl_pet_passive_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_warl_pet_passive_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateAmountCritSpell(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float CritSpell = 0.0f;
|
|
// Crit from Intellect
|
|
CritSpell += owner->GetSpellCritFromIntellect();
|
|
// Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
|
|
CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
|
|
// Increase crit from SPELL_AURA_MOD_CRIT_PCT
|
|
CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
|
|
// Increase crit spell from spell crit ratings
|
|
CritSpell += owner->GetRatingBonusValue(CR_CRIT_SPELL);
|
|
|
|
if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347))
|
|
if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase())
|
|
if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0))
|
|
amount += CalculatePct(CritSpell, improvedDemonicTacticsEffect->GetAmount());
|
|
}
|
|
}
|
|
|
|
void CalculateAmountCritMelee(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float CritMelee = 0.0f;
|
|
// Crit from Agility
|
|
CritMelee += owner->GetMeleeCritFromAgility();
|
|
// Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
|
|
CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
|
|
// Increase crit from SPELL_AURA_MOD_CRIT_PCT
|
|
CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
|
|
// Increase crit melee from melee crit ratings
|
|
CritMelee += owner->GetRatingBonusValue(CR_CRIT_MELEE);
|
|
|
|
if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347))
|
|
if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase())
|
|
if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0))
|
|
amount += CalculatePct(CritMelee, improvedDemonicTacticsEffect->GetAmount());
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_AuraScript::CalculateAmountCritSpell, EFFECT_0, SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_AuraScript::CalculateAmountCritMelee, EFFECT_1, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_warl_pet_passive_AuraScript();
|
|
}
|
|
};
|
|
// this doesnt actually fit in here
|
|
class spell_warl_pet_passive_damage_done : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_warl_pet_passive_damage_done() : SpellScriptLoader("spell_warl_pet_passive_damage_done") { }
|
|
|
|
class spell_warl_pet_passive_damage_done_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_warl_pet_passive_damage_done_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateAmountDamageDone(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner())
|
|
return;
|
|
if (GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
switch (GetCaster()->GetEntry())
|
|
{
|
|
case ENTRY_VOIDWALKER:
|
|
amount += -16;
|
|
break;
|
|
case ENTRY_FELHUNTER:
|
|
amount += -20;
|
|
break;
|
|
case ENTRY_SUCCUBUS:
|
|
case ENTRY_FELGUARD:
|
|
amount += 5;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_damage_done_AuraScript::CalculateAmountDamageDone, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_damage_done_AuraScript::CalculateAmountDamageDone, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_warl_pet_passive_damage_done_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_warl_pet_passive_voidwalker : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_warl_pet_passive_voidwalker() : SpellScriptLoader("spell_warl_pet_passive_voidwalker") { }
|
|
|
|
class spell_warl_pet_passive_voidwalker_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_warl_pet_passive_voidwalker_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (pet->IsPet())
|
|
if (Unit* owner = pet->ToPet()->GetOwner())
|
|
if (AuraEffect* /* aurEff */ect = owner->GetAuraEffect(SPELL_WARLOCK_GLYPH_OF_VOIDWALKER, EFFECT_0))
|
|
amount += /* aurEff */ect->GetAmount();
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_voidwalker_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_warl_pet_passive_voidwalker_AuraScript();
|
|
}
|
|
};
|
|
|
|
|
|
class spell_sha_pet_scaling_04 : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_sha_pet_scaling_04() : SpellScriptLoader("spell_sha_pet_scaling_04") { }
|
|
|
|
class spell_sha_pet_scaling_04_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_sha_pet_scaling_04_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float HitMelee = 0.0f;
|
|
// Increase hit from SPELL_AURA_MOD_HIT_CHANCE
|
|
HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
|
|
// Increase hit melee from meele hit ratings
|
|
HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE);
|
|
|
|
amount += int32(HitMelee);
|
|
}
|
|
}
|
|
|
|
void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float HitSpell = 0.0f;
|
|
// Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
|
|
HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
|
|
// Increase hit spell from spell hit ratings
|
|
HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
|
|
|
|
amount += int32(HitSpell);
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_pet_scaling_04_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_pet_scaling_04_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_sha_pet_scaling_04_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_hun_pet_scaling_01 : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_hun_pet_scaling_01() : SpellScriptLoader("spell_hun_pet_scaling_01") { }
|
|
|
|
class spell_hun_pet_scaling_01_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_hun_pet_scaling_01_AuraScript);
|
|
|
|
public:
|
|
spell_hun_pet_scaling_01_AuraScript()
|
|
{
|
|
_tempHealth = 0;
|
|
}
|
|
|
|
private:
|
|
void CalculateStaminaAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (pet->IsPet())
|
|
if (Unit* owner = pet->ToPet()->GetOwner())
|
|
{
|
|
float mod = 0.45f;
|
|
float ownerBonus = 0.0f;
|
|
|
|
PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1
|
|
if (itr == pet->ToPet()->m_spells.end())
|
|
itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2
|
|
|
|
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
|
|
{
|
|
SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
|
|
AddPct(mod, spellInfo->Effects[EFFECT_0].CalcValue());
|
|
}
|
|
|
|
ownerBonus = owner->GetStat(STAT_STAMINA)*mod;
|
|
|
|
amount += ownerBonus;
|
|
}
|
|
}
|
|
|
|
void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (_tempHealth)
|
|
pet->SetHealth(_tempHealth);
|
|
}
|
|
|
|
void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
_tempHealth = pet->GetHealth();
|
|
}
|
|
|
|
void CalculateAttackPowerAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
{
|
|
if (!pet->IsPet())
|
|
return;
|
|
|
|
Unit* owner = pet->ToPet()->GetOwner();
|
|
if (!owner)
|
|
return;
|
|
|
|
float mod = 1.0f; //Hunter contribution modifier
|
|
float bonusAP = 0.0f;
|
|
|
|
PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1
|
|
if (itr == pet->ToPet()->m_spells.end())
|
|
itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2
|
|
|
|
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
|
|
{
|
|
SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
|
|
mod += CalculatePct(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
|
|
}
|
|
|
|
bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f * mod;
|
|
|
|
amount += bonusAP;
|
|
}
|
|
}
|
|
|
|
void CalculateDamageDoneAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
{
|
|
if (!pet->IsPet())
|
|
return;
|
|
|
|
Unit* owner = pet->ToPet()->GetOwner();
|
|
if (!owner)
|
|
return;
|
|
|
|
float mod = 1.0f; //Hunter contribution modifier
|
|
float bonusDamage = 0.0f;
|
|
|
|
PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1
|
|
if (itr == pet->ToPet()->m_spells.end())
|
|
itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2
|
|
|
|
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
|
|
{
|
|
SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
|
|
mod += CalculatePct(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
|
|
}
|
|
|
|
bonusDamage = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod;
|
|
|
|
amount += bonusDamage;
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
OnEffectRemove += AuraEffectRemoveFn(spell_hun_pet_scaling_01_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
|
|
AfterEffectApply += AuraEffectApplyFn(spell_hun_pet_scaling_01_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_01_AuraScript::CalculateStaminaAmount, EFFECT_0, SPELL_AURA_MOD_STAT);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_01_AuraScript::CalculateAttackPowerAmount, EFFECT_1, SPELL_AURA_MOD_ATTACK_POWER);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_01_AuraScript::CalculateDamageDoneAmount, EFFECT_2, SPELL_AURA_MOD_DAMAGE_DONE);
|
|
}
|
|
|
|
private:
|
|
uint32 _tempHealth;
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_hun_pet_scaling_01_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_hun_pet_scaling_02 : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_hun_pet_scaling_02() : SpellScriptLoader("spell_hun_pet_scaling_02") { }
|
|
|
|
class spell_hun_pet_scaling_02_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_hun_pet_scaling_02_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateFrostResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
{
|
|
if (!pet->IsPet())
|
|
return;
|
|
|
|
Unit* owner = pet->ToPet()->GetOwner();
|
|
if (!owner)
|
|
return;
|
|
|
|
float ownerBonus = 0.0f;
|
|
|
|
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
|
|
|
|
amount += ownerBonus;
|
|
}
|
|
}
|
|
|
|
void CalculateFireResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
{
|
|
if (!pet->IsPet())
|
|
return;
|
|
|
|
Unit* owner = pet->ToPet()->GetOwner();
|
|
if (!owner)
|
|
return;
|
|
|
|
float ownerBonus = 0.0f;
|
|
|
|
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
|
|
|
|
amount += ownerBonus;
|
|
}
|
|
}
|
|
|
|
void CalculateNatureResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
{
|
|
if (!pet->IsPet())
|
|
return;
|
|
|
|
Unit* owner = pet->ToPet()->GetOwner();
|
|
if (!owner)
|
|
return;
|
|
|
|
float ownerBonus = 0.0f;
|
|
|
|
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
|
|
|
|
amount += ownerBonus;
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_02_AuraScript::CalculateFrostResistanceAmount, EFFECT_1, SPELL_AURA_MOD_RESISTANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_02_AuraScript::CalculateFireResistanceAmount, EFFECT_0, SPELL_AURA_MOD_RESISTANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_02_AuraScript::CalculateNatureResistanceAmount, EFFECT_2, SPELL_AURA_MOD_RESISTANCE);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_hun_pet_scaling_02_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_hun_pet_scaling_03 : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_hun_pet_scaling_03() : SpellScriptLoader("spell_hun_pet_scaling_03") { }
|
|
|
|
class spell_hun_pet_scaling_03_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_hun_pet_scaling_03_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateShadowResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
{
|
|
if (!pet->IsPet())
|
|
return;
|
|
|
|
Unit* owner = pet->ToPet()->GetOwner();
|
|
if (!owner)
|
|
return;
|
|
|
|
float ownerBonus = 0.0f;
|
|
|
|
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
|
|
|
|
amount += ownerBonus;
|
|
}
|
|
}
|
|
|
|
void CalculateArcaneResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
{
|
|
if (!pet->IsPet())
|
|
return;
|
|
|
|
Unit* owner = pet->ToPet()->GetOwner();
|
|
if (!owner)
|
|
return;
|
|
|
|
float ownerBonus = 0.0f;
|
|
|
|
ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
|
|
|
|
amount += ownerBonus;
|
|
}
|
|
}
|
|
|
|
void CalculateArmorAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
{
|
|
if (!pet->IsPet())
|
|
return;
|
|
|
|
Unit* owner = pet->ToPet()->GetOwner();
|
|
if (!owner)
|
|
return;
|
|
|
|
float ownerBonus = 0.0f;
|
|
|
|
ownerBonus = CalculatePct(owner->GetArmor(), 35);
|
|
|
|
amount += ownerBonus;
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_03_AuraScript::CalculateShadowResistanceAmount, EFFECT_0, SPELL_AURA_MOD_RESISTANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_03_AuraScript::CalculateArcaneResistanceAmount, EFFECT_1, SPELL_AURA_MOD_RESISTANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_03_AuraScript::CalculateArmorAmount, EFFECT_2, SPELL_AURA_MOD_RESISTANCE);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_hun_pet_scaling_03_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_hun_pet_scaling_04 : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_hun_pet_scaling_04() : SpellScriptLoader("spell_hun_pet_scaling_04") { }
|
|
|
|
class spell_hun_pet_scaling_04_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_hun_pet_scaling_04_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner())
|
|
return;
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float HitMelee = 0.0f;
|
|
// Increase hit from SPELL_AURA_MOD_HIT_CHANCE
|
|
HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
|
|
// Increase hit melee from meele hit ratings
|
|
HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE);
|
|
|
|
amount += int32(HitMelee);
|
|
}
|
|
}
|
|
|
|
void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner())
|
|
return;
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float HitSpell = 0.0f;
|
|
// Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
|
|
HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
|
|
// Increase hit spell from spell hit ratings
|
|
HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
|
|
|
|
amount += int32(HitSpell);
|
|
}
|
|
}
|
|
|
|
void CalculateAmountExpertise(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner())
|
|
return;
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float Expertise = 0.0f;
|
|
// Increase hit from SPELL_AURA_MOD_EXPERTISE
|
|
Expertise += owner->GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE);
|
|
// Increase Expertise from Expertise ratings
|
|
Expertise += owner->GetRatingBonusValue(CR_EXPERTISE);
|
|
|
|
amount += int32(Expertise);
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_04_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_04_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_04_AuraScript::CalculateAmountExpertise, EFFECT_2, SPELL_AURA_MOD_EXPERTISE);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_hun_pet_scaling_04_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_hun_pet_passive_crit : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_hun_pet_passive_crit() : SpellScriptLoader("spell_hun_pet_passive_crit") { }
|
|
|
|
class spell_hun_pet_passive_crit_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_hun_pet_passive_crit_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateAmountCritSpell(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner())
|
|
return;
|
|
if (GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float CritSpell = 0.0f;
|
|
// Crit from Intellect
|
|
// CritSpell += owner->GetSpellCritFromIntellect();
|
|
// Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
|
|
// CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
|
|
// Increase crit from SPELL_AURA_MOD_CRIT_PCT
|
|
// CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
|
|
// Increase crit spell from spell crit ratings
|
|
// CritSpell += owner->GetRatingBonusValue(CR_CRIT_SPELL);
|
|
|
|
amount += (CritSpell*0.8f);
|
|
}
|
|
}
|
|
|
|
void CalculateAmountCritMelee(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner())
|
|
return;
|
|
if (GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float CritMelee = 0.0f;
|
|
// Crit from Agility
|
|
// CritMelee += owner->GetMeleeCritFromAgility();
|
|
// Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
|
|
// CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
|
|
// Increase crit from SPELL_AURA_MOD_CRIT_PCT
|
|
// CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
|
|
// Increase crit melee from melee crit ratings
|
|
// CritMelee += owner->GetRatingBonusValue(CR_CRIT_MELEE);
|
|
|
|
amount += (CritMelee*0.8f);
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_passive_crit_AuraScript::CalculateAmountCritSpell, EFFECT_1, SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_passive_crit_AuraScript::CalculateAmountCritMelee, EFFECT_0, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_hun_pet_passive_crit_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_hun_pet_passive_damage_done : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_hun_pet_passive_damage_done() : SpellScriptLoader("spell_hun_pet_passive_damage_done") { }
|
|
|
|
class spell_hun_pet_passive_damage_done_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_hun_pet_passive_damage_done_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateAmountDamageDone(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner())
|
|
return;
|
|
if (GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// Pet's base damage changes depending on happiness
|
|
if (GetCaster()->IsPet() && GetCaster()->ToPet()->IsHunterPet())
|
|
{
|
|
switch (GetCaster()->ToPet()->GetHappinessState())
|
|
{
|
|
case HAPPY:
|
|
// 125% of normal damage
|
|
amount += 25.0f;
|
|
break;
|
|
case CONTENT:
|
|
// 100% of normal damage, nothing to modify
|
|
break;
|
|
case UNHAPPY:
|
|
// 75% of normal damage
|
|
amount += -25.0f;
|
|
break;
|
|
}
|
|
}
|
|
// Cobra Reflexes
|
|
if (AuraEffect* cobraReflexes = GetCaster()->GetAuraEffectOfRankedSpell(61682, EFFECT_0))
|
|
amount -= cobraReflexes->GetAmount();
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_passive_damage_done_AuraScript::CalculateAmountDamageDone, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_hun_pet_passive_damage_done_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_hun_animal_handler : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_hun_animal_handler() : SpellScriptLoader("spell_hun_animal_handler") { }
|
|
|
|
class spell_hun_animal_handler_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_hun_animal_handler_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateAmountDamageDone(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner())
|
|
return;
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
if (AuraEffect* /* aurEff */ect = owner->GetAuraEffectOfRankedSpell(SPELL_HUNTER_ANIMAL_HANDLER, EFFECT_1))
|
|
amount = /* aurEff */ect->GetAmount();
|
|
else
|
|
amount = 0;
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_animal_handler_AuraScript::CalculateAmountDamageDone, EFFECT_0, SPELL_AURA_MOD_ATTACK_POWER_PCT);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_hun_animal_handler_AuraScript();
|
|
}
|
|
};
|
|
|
|
|
|
class spell_dk_avoidance_passive : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_dk_avoidance_passive() : SpellScriptLoader("spell_dk_avoidance_passive") { }
|
|
|
|
class spell_dk_avoidance_passive_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_dk_avoidance_passive_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateAvoidanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
{
|
|
if (Unit* owner = pet->GetOwner())
|
|
{
|
|
// Army of the dead ghoul
|
|
if (pet->GetEntry() == ENTRY_ARMY_OF_THE_DEAD_GHOUL)
|
|
amount = -90;
|
|
// Night of the dead
|
|
else if (Aura* aur = owner->GetAuraOfRankedSpell(SPELL_NIGHT_OF_THE_DEAD))
|
|
amount = aur->GetSpellInfo()->Effects[EFFECT_2].CalcValue();
|
|
}
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_avoidance_passive_AuraScript::CalculateAvoidanceAmount, EFFECT_0, SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_dk_avoidance_passive_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_dk_pet_scaling_01 : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_dk_pet_scaling_01() : SpellScriptLoader("spell_dk_pet_scaling_01") { }
|
|
|
|
class spell_dk_pet_scaling_01_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_dk_pet_scaling_01_AuraScript);
|
|
|
|
public:
|
|
spell_dk_pet_scaling_01_AuraScript()
|
|
{
|
|
_tempHealth = 0;
|
|
}
|
|
|
|
private:
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateStaminaAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
{
|
|
if (pet->IsGuardian())
|
|
{
|
|
if (Unit* owner = pet->GetOwner())
|
|
{
|
|
float mod = 0.3f;
|
|
|
|
// Ravenous Dead. Check just if owner has Ravenous Dead since it's effect is not an aura
|
|
if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0))
|
|
mod += aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()/100; // Ravenous Dead edits the original scale
|
|
|
|
// Glyph of the Ghoul
|
|
if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_DEATH_KNIGHT_GLYPH_OF_GHOUL, 0))
|
|
mod += aurEff->GetAmount()/100;
|
|
|
|
float ownerBonus = float(owner->GetStat(STAT_STAMINA)) * mod;
|
|
amount += ownerBonus;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
if (_tempHealth)
|
|
pet->SetHealth(_tempHealth);
|
|
}
|
|
|
|
void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
_tempHealth = pet->GetHealth();
|
|
}
|
|
|
|
void CalculateStrengthAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
{
|
|
if (!pet->IsGuardian())
|
|
return;
|
|
|
|
Unit* owner = pet->GetOwner();
|
|
if (!owner)
|
|
return;
|
|
|
|
float mod = 0.7f;
|
|
|
|
// Ravenous Dead
|
|
AuraEffect const* aurEff = NULL;
|
|
// Check just if owner has Ravenous Dead since it's effect is not an aura
|
|
aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0);
|
|
if (aurEff)
|
|
{
|
|
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 += 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;
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
OnEffectRemove += AuraEffectRemoveFn(spell_dk_pet_scaling_01_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
|
|
AfterEffectApply += AuraEffectApplyFn(spell_dk_pet_scaling_01_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_01_AuraScript::CalculateStaminaAmount, EFFECT_0, SPELL_AURA_MOD_STAT);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_01_AuraScript::CalculateStrengthAmount, EFFECT_1, SPELL_AURA_MOD_STAT);
|
|
}
|
|
|
|
private:
|
|
uint32 _tempHealth;
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_dk_pet_scaling_01_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_dk_pet_scaling_02 : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_dk_pet_scaling_02() : SpellScriptLoader("spell_dk_pet_scaling_02") { }
|
|
|
|
class spell_dk_pet_scaling_02_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_dk_pet_scaling_02_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateAmountMeleeHaste(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner())
|
|
return;
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float HasteMelee = 0.0f;
|
|
// Increase hit from SPELL_AURA_MOD_HIT_CHANCE
|
|
HasteMelee += (1-owner->m_modAttackSpeedPct[BASE_ATTACK])*100;
|
|
|
|
amount += int32(HasteMelee);
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_02_AuraScript::CalculateAmountMeleeHaste, EFFECT_1, SPELL_AURA_MELEE_SLOW);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_dk_pet_scaling_02_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_dk_pet_scaling_03 : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_dk_pet_scaling_03() : SpellScriptLoader("spell_dk_pet_scaling_03") { }
|
|
|
|
class spell_dk_pet_scaling_03_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_dk_pet_scaling_03_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner())
|
|
return;
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float HitMelee = 0.0f;
|
|
// Increase hit from SPELL_AURA_MOD_HIT_CHANCE
|
|
HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
|
|
// Increase hit melee from meele hit ratings
|
|
HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE);
|
|
|
|
amount += int32(HitMelee);
|
|
}
|
|
}
|
|
|
|
void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner())
|
|
return;
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float HitSpell = 0.0f;
|
|
// Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
|
|
HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
|
|
// Increase hit spell from spell hit ratings
|
|
HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
|
|
|
|
amount += int32(HitSpell);
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_03_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_03_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_dk_pet_scaling_03_AuraScript();
|
|
}
|
|
};
|
|
|
|
class spell_dk_rune_weapon_scaling_02 : public SpellScriptLoader
|
|
{
|
|
public:
|
|
spell_dk_rune_weapon_scaling_02() : SpellScriptLoader("spell_dk_rune_weapon_scaling_02") { }
|
|
|
|
class spell_dk_rune_weapon_scaling_02_AuraScript : public AuraScript
|
|
{
|
|
PrepareAuraScript(spell_dk_rune_weapon_scaling_02_AuraScript);
|
|
|
|
bool Load() override
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
void CalculateDamageDoneAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (Unit* pet = GetUnitOwner())
|
|
{
|
|
Unit* owner = pet->GetOwner();
|
|
if (!owner)
|
|
return;
|
|
|
|
if (pet->IsGuardian())
|
|
((Guardian*)pet)->SetBonusDamage(owner->GetTotalAttackPowerValue(BASE_ATTACK));
|
|
|
|
amount += owner->CalculateDamage(BASE_ATTACK, true, true);
|
|
}
|
|
}
|
|
|
|
void CalculateAmountMeleeHaste(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
|
|
{
|
|
if (!GetCaster() || !GetCaster()->GetOwner())
|
|
return;
|
|
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
|
|
{
|
|
// For others recalculate it from:
|
|
float HasteMelee = 0.0f;
|
|
// Increase hit from SPELL_AURA_MOD_HIT_CHANCE
|
|
HasteMelee += (1-owner->m_modAttackSpeedPct[BASE_ATTACK])*100;
|
|
|
|
amount += int32(HasteMelee);
|
|
}
|
|
}
|
|
|
|
void Register() override
|
|
{
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_rune_weapon_scaling_02_AuraScript::CalculateDamageDoneAmount, EFFECT_0, SPELL_AURA_MOD_DAMAGE_DONE);
|
|
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_rune_weapon_scaling_02_AuraScript::CalculateAmountMeleeHaste, EFFECT_1, SPELL_AURA_MELEE_SLOW);
|
|
}
|
|
};
|
|
|
|
AuraScript* GetAuraScript() const override
|
|
{
|
|
return new spell_dk_rune_weapon_scaling_02_AuraScript();
|
|
}
|
|
};
|
|
|
|
void AddSC_pet_spell_scripts()
|
|
{
|
|
new spell_gen_pet_calculate();
|
|
}
|