Core/Pets: more updates for pet calculations. feedback would be nice! (nothing is applied to anything yet so this will not reflect ingame atm)
This commit is contained in:
@@ -24,6 +24,9 @@
|
|||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
#include "SpellScript.h"
|
#include "SpellScript.h"
|
||||||
#include "SpellAuraEffects.h"
|
#include "SpellAuraEffects.h"
|
||||||
|
#include "Unit.h"
|
||||||
|
#include "Player.h"
|
||||||
|
#include "Pet.h"
|
||||||
|
|
||||||
enum HunterPetCalculate
|
enum HunterPetCalculate
|
||||||
{
|
{
|
||||||
@@ -52,6 +55,7 @@ enum WarlockPetCalculate
|
|||||||
ENTRY_VOIDWALKER = 1860,
|
ENTRY_VOIDWALKER = 1860,
|
||||||
ENTRY_FELHUNTER = 417,
|
ENTRY_FELHUNTER = 417,
|
||||||
ENTRY_SUCCUBUS = 1863,
|
ENTRY_SUCCUBUS = 1863,
|
||||||
|
ENTRY_IMP = 416,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DKPetCalculate
|
enum DKPetCalculate
|
||||||
@@ -60,6 +64,9 @@ enum DKPetCalculate
|
|||||||
SPELL_DEATH_KNIGHT_PET_SCALING_01 = 54566,
|
SPELL_DEATH_KNIGHT_PET_SCALING_01 = 54566,
|
||||||
SPELL_DEATH_KNIGHT_PET_SCALING_02 = 51996,
|
SPELL_DEATH_KNIGHT_PET_SCALING_02 = 51996,
|
||||||
SPELL_DEATH_KNIGHT_PET_SCALING_03 = 61697,
|
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
|
enum ShamanPetCalculate
|
||||||
@@ -225,95 +232,111 @@ public:
|
|||||||
{
|
{
|
||||||
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
||||||
return false;
|
return false;
|
||||||
_tempHealth = 0;
|
_tempBonus = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculateStaminaAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
|
void CalculateStaminaAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
|
||||||
{
|
{
|
||||||
if (Unit* pet = GetUnitOwner())
|
if (Unit* pet = GetUnitOwner())
|
||||||
{
|
if (pet->isPet())
|
||||||
if (!pet->isPet())
|
if (Unit* owner = pet->ToPet()->GetOwner())
|
||||||
return;
|
{
|
||||||
|
float ownerBonus = CalculatePctN(owner->GetStat(STAT_STAMINA), 75);
|
||||||
|
|
||||||
Unit* owner = pet->ToPet()->GetOwner();
|
amount += ownerBonus;
|
||||||
if (!owner)
|
}
|
||||||
return;
|
|
||||||
|
|
||||||
float ownerBonus = 0.0f;
|
|
||||||
|
|
||||||
ownerBonus = CalculatePctN(owner->GetStat(STAT_STAMINA), 75);
|
|
||||||
|
|
||||||
amount += ownerBonus;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||||
{
|
{
|
||||||
if (Unit* pet = GetUnitOwner())
|
if (Unit* pet = GetUnitOwner())
|
||||||
if (_tempHealth)
|
if (_tempBonus)
|
||||||
pet->SetHealth(_tempHealth);
|
{
|
||||||
|
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_VOIDWALKER:
|
||||||
|
healthMod = _tempBonus * 11;
|
||||||
|
break;
|
||||||
|
case ENTRY_SUCCUBUS:
|
||||||
|
healthMod = uint32(_tempBonus * 9.1f);
|
||||||
|
break;
|
||||||
|
case ENTRY_FELHUNTER:
|
||||||
|
healthMod = uint32(_tempBonus * 9.5f);
|
||||||
|
break;
|
||||||
|
case ENTRY_FELGUARD:
|
||||||
|
healthMod = _tempBonus * 11;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
healthMod = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (healthMod)
|
||||||
|
pet->ToPet()->SetCreateHealth(baseHealth + healthMod);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||||
{
|
{
|
||||||
if (Unit* pet = GetUnitOwner())
|
if (Unit* pet = GetUnitOwner())
|
||||||
_tempHealth = pet->GetHealth();
|
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*/)
|
void CalculateAttackPowerAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
|
||||||
{
|
{
|
||||||
if (Unit* pet = GetUnitOwner())
|
if (Unit* pet = GetUnitOwner())
|
||||||
{
|
if (pet->isPet())
|
||||||
if (!pet->isPet())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Unit* owner = pet->ToPet()->GetOwner();
|
if (Unit* owner = pet->ToPet()->GetOwner())
|
||||||
if (!owner)
|
|
||||||
return;
|
|
||||||
|
|
||||||
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* aurEffect = owner->GetAuraEffect(56246, EFFECT_0))
|
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)
|
||||||
{
|
{
|
||||||
float base_attPower = pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT);
|
if (AuraEffect* aurEffect = owner->GetAuraEffect(56246, EFFECT_0))
|
||||||
amount += CalculatePctN(amount+base_attPower, aurEffect->GetAmount());
|
{
|
||||||
|
float base_attPower = pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT);
|
||||||
|
amount += CalculatePctN(amount+base_attPower, aurEffect->GetAmount());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculateDamageDoneAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
|
void CalculateDamageDoneAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
|
||||||
{
|
{
|
||||||
if (Unit* pet = GetUnitOwner())
|
if (Unit* pet = GetUnitOwner())
|
||||||
{
|
if (pet->isPet())
|
||||||
if (!pet->isPet())
|
if (Unit* owner = pet->ToPet()->GetOwner())
|
||||||
return;
|
{
|
||||||
|
//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;
|
||||||
|
|
||||||
Unit* owner = pet->ToPet()->GetOwner();
|
if (maximum > 0)
|
||||||
if (!owner)
|
bonusDamage = maximum * 0.15f;
|
||||||
return;
|
|
||||||
|
|
||||||
//the damage bonus used for pets is either fire or shadow damage, whatever is higher
|
amount += bonusDamage;
|
||||||
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 bonusDamage = maximum * 0.15f;
|
|
||||||
|
|
||||||
amount += bonusDamage;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Register()
|
void Register()
|
||||||
@@ -326,7 +349,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32 _tempHealth;
|
uint32 _tempBonus;
|
||||||
};
|
};
|
||||||
|
|
||||||
AuraScript* GetAuraScript() const
|
AuraScript* GetAuraScript() const
|
||||||
@@ -355,20 +378,15 @@ public:
|
|||||||
void CalculateIntellectAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
|
void CalculateIntellectAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
|
||||||
{
|
{
|
||||||
if (Unit* pet = GetUnitOwner())
|
if (Unit* pet = GetUnitOwner())
|
||||||
{
|
if (pet->isPet())
|
||||||
if (!pet->isPet())
|
if (Unit* owner = pet->ToPet()->GetOwner())
|
||||||
return;
|
{
|
||||||
|
float ownerBonus = 0.0f;
|
||||||
|
|
||||||
Unit* owner = pet->ToPet()->GetOwner();
|
ownerBonus = CalculatePctN(owner->GetStat(STAT_INTELLECT), 30);
|
||||||
if (!owner)
|
|
||||||
return;
|
|
||||||
|
|
||||||
float ownerBonus = 0.0f;
|
amount += ownerBonus;
|
||||||
|
}
|
||||||
ownerBonus = CalculatePctN(owner->GetStat(STAT_INTELLECT), 30);
|
|
||||||
|
|
||||||
amount += ownerBonus;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||||
@@ -1470,18 +1488,14 @@ public:
|
|||||||
{
|
{
|
||||||
if (Unit* pet = GetUnitOwner())
|
if (Unit* pet = GetUnitOwner())
|
||||||
{
|
{
|
||||||
Unit* owner = pet->GetOwner();
|
if (Unit* owner = pet->GetOwner())
|
||||||
if (!owner)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Army of the dead ghoul
|
// Army of the dead ghoul
|
||||||
if (pet->GetEntry() == 24207)
|
if (pet->GetEntry() == ENTRY_ARMY_OF_THE_DEAD_GHOUL)
|
||||||
amount = -90;
|
amount = -90;
|
||||||
// Night of the dead
|
// Night of the dead
|
||||||
else if (owner->HasAura(55623))
|
else if ( Aura * aur = owner->GetAuraOfRankedSpell(SPELL_NIGHT_OF_THE_DEAD))
|
||||||
amount = -90;
|
amount = aur->GetSpellInfo()->Effects[EFFECT_2].CalcValue();
|
||||||
else if (owner->HasAura(55620))
|
|
||||||
amount = -45;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1518,29 +1532,25 @@ public:
|
|||||||
{
|
{
|
||||||
if (Unit* pet = GetUnitOwner())
|
if (Unit* pet = GetUnitOwner())
|
||||||
{
|
{
|
||||||
if (!pet->isGuardian())
|
if (pet->isGuardian())
|
||||||
return;
|
|
||||||
|
|
||||||
Unit* owner = pet->GetOwner();
|
|
||||||
if (!owner)
|
|
||||||
return;
|
|
||||||
|
|
||||||
float mod = 0.3f;
|
|
||||||
|
|
||||||
// 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 += CalculatePctN(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 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
|
|
||||||
float ownerBonus = float(owner->GetStat(STAT_STAMINA)) * mod;
|
|
||||||
amount += ownerBonus;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user