diff options
-rw-r--r-- | src/server/game/Entities/Creature/TemporarySummon.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/TemporarySummon.h | 7 | ||||
-rw-r--r-- | src/server/game/Entities/Pet/Pet.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/StatSystem.cpp | 78 |
4 files changed, 53 insertions, 36 deletions
diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index f20ef38b11b..d911e171a45 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -299,7 +299,7 @@ bool Minion::IsGuardianPet() const } Guardian::Guardian(SummonPropertiesEntry const *properties, Unit *owner) : Minion(properties, owner) -, m_bonusdamage(0) +, m_bonusSpellDamage(0) { m_unitTypeMask |= UNIT_MASK_GUARDIAN; if (properties && properties->Type == SUMMON_TYPE_PET) diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h index e3e364cb531..1f3a1cfb1e3 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.h +++ b/src/server/game/Entities/Creature/TemporarySummon.h @@ -79,10 +79,11 @@ class Guardian : public Minion void UpdateAttackPowerAndDamage(bool ranged = false); void UpdateDamagePhysical(WeaponAttackType attType); - int32 GetBonusDamage() { return m_bonusdamage; } - void SetBonusDamage(int32 damage) { m_bonusdamage = damage; } + int32 GetBonusDamage() { return m_bonusSpellDamage; } + void SetBonusDamage(int32 damage); protected: - int32 m_bonusdamage; + int32 m_bonusSpellDamage; + float m_statFromOwner[MAX_STATS]; }; class Puppet : public Minion diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 70e42e6266f..87ac7627f96 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -907,7 +907,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetCreateStat(STAT_SPIRIT, 27); } - m_bonusdamage = 0; + SetBonusDamage(0); switch (petType) { case SUMMON_PET: diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index 992c7061fd9..e6e588e1b59 100644 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -943,6 +943,8 @@ bool Guardian::UpdateStats(Stats stat) // value = ((base_value * base_pct) + total_value) * total_pct float value = GetTotalStatValue(stat); + ApplyStatBuffMod(stat, m_statFromOwner[stat], false); + float ownersBonus = 0.0f; Unit *owner = GetOwner(); // Handle Death Knight Glyphs and Talents @@ -956,7 +958,7 @@ bool Guardian::UpdateStats(Stats stat) default: break; } // Ravenous Dead - AuraEffect const *aurEff; + 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) @@ -968,37 +970,43 @@ bool Guardian::UpdateStats(Stats stat) aurEff = owner->GetAuraEffect(58686, 0); if (aurEff) mod += (aurEff->GetAmount() / 100.0f); // Glyph of the Ghoul adds a flat value to the scale mod - value += float(owner->GetStat(stat)) * mod; + ownersBonus = float(owner->GetStat(stat)) * mod; + value += ownersBonus; } else if (stat == STAT_STAMINA) { if (owner->getClass() == CLASS_WARLOCK && isPet()) - value += float(owner->GetStat(STAT_STAMINA)) * 0.75f; + { + ownersBonus = float(owner->GetStat(STAT_STAMINA)) * 0.75f; + value += ownersBonus; + } else { - mod = 0.3f; - if (this->ToCreature()->isPet()) + mod = 0.45f; + if (isPet()) { - PetSpellMap::const_iterator itr = (((Pet*)this)->m_spells.find(62758)); // Wild Hunt rank 1 - if (itr == ((Pet*)this)->m_spells.end()) - { - itr = ((Pet*)this)->m_spells.find(62762); // Wild Hunt rank 2 - } - if (itr != ((Pet*)this)->m_spells.end()) // If pet has Wild Hunt - { + PetSpellMap::const_iterator itr = (ToPet()->m_spells.find(62758)); // Wild Hunt rank 1 + if (itr == ToPet()->m_spells.end()) + itr = ToPet()->m_spells.find(62762); // Wild Hunt rank 2 - SpellEntry const* sProto = sSpellStore.LookupEntry(itr->first); // Then get the SpellProto and add the dummy effect value + if (itr != ToPet()->m_spells.end()) // If pet has Wild Hunt + { + SpellEntry const* sProto = sSpellStore.LookupEntry(itr->first); // Then get the SpellProto and add the dummy effect value mod += mod * (SpellMgr::CalculateSpellEffectAmount(sProto, 0) / 100.0f); } } - value += float(owner->GetStat(stat)) * mod; + ownersBonus = float(owner->GetStat(stat)) * mod; + value += ownersBonus; } } //warlock's and mage's pets gain 30% of owner's intellect else if (stat == STAT_INTELLECT) { if (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE) - value += float(owner->GetStat(stat)) * 0.3f; + { + ownersBonus = float(owner->GetStat(stat)) * 0.3f; + value += ownersBonus; + } } /* else if (stat == STAT_STRENGTH) @@ -1009,6 +1017,8 @@ bool Guardian::UpdateStats(Stats stat) */ SetStat(stat, int32(value)); + m_statFromOwner[stat] = ownersBonus; + ApplyStatBuffMod(stat, m_statFromOwner[stat], true); switch (stat) { @@ -1142,21 +1152,20 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged) { if (isHunterPet()) //hunter pets benefit from owner's attack power { - float mod = 1.0f; //Hunter contribution modifier - if (this->ToCreature()->isPet()) - { - PetSpellMap::const_iterator itr = ((Pet*)this)->m_spells.find(62758); //Wild Hunt rank 1 - if (itr == ((Pet*)this)->m_spells.end()) - { - itr = ((Pet*)this)->m_spells.find(62762); //Wild Hunt rank 2 - } - if (itr != ((Pet*)this)->m_spells.end()) // If pet has Wild Hunt - { - - SpellEntry const* sProto = sSpellStore.LookupEntry(itr->first); // Then get the SpellProto and add the dummy effect value - mod += (SpellMgr::CalculateSpellEffectAmount(sProto, 1) / 100.0f); - } - } + float mod = 1.0f; //Hunter contribution modifier + if (isPet()) + { + PetSpellMap::const_iterator itr = ToPet()->m_spells.find(62758); //Wild Hunt rank 1 + if (itr == ToPet()->m_spells.end()) + itr = ToPet()->m_spells.find(62762); //Wild Hunt rank 2 + + if (itr != ToPet()->m_spells.end()) // If pet has Wild Hunt + { + SpellEntry const* sProto = sSpellStore.LookupEntry(itr->first); // Then get the SpellProto and add the dummy effect value + mod += (SpellMgr::CalculateSpellEffectAmount(sProto, 1) / 100.0f); + } + } + bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f * mod; SetBonusDamage(int32(owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod)); } @@ -1246,7 +1255,7 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType) // Pet's base damage changes depending on happiness if (isHunterPet() && attType == BASE_ATTACK) { - switch(((Pet*)this)->GetHappinessState()) + switch(ToPet()->GetHappinessState()) { case HAPPY: // 125% of normal damage @@ -1282,3 +1291,10 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType) SetStatFloatValue(UNIT_FIELD_MINDAMAGE, mindamage); SetStatFloatValue(UNIT_FIELD_MAXDAMAGE, maxdamage); } + +void Guardian::SetBonusDamage(int32 damage) +{ + m_bonusSpellDamage = damage; + if (GetOwner()->GetTypeId() == TYPEID_PLAYER) + GetOwner()->SetUInt32Value(PLAYER_PET_SPELL_POWER, damage); +} |