Yo guys, i’m trying to fix the issue of DK’s gargoyles not benefiting from the owner’s haste. i think i’m on the right way but i need a little help /emoticons/default_tongue.png
First at all, since i’m a newb on trinity i said to myself “kay, first i need an code example of how a pet get a rating benefit from his owner” so i searched for the resilence benefit code /emoticons/default_biggrin.png
having already read, i tried to do something similar, and that’s what i did:
[SPOILER]
/emoticons/default_biggrin.png
-
if (Unit* owner = GetOwner())
-
if (owner->GetTypeId() == TYPEID_PLAYER)
-
return ((Player*)owner)->GetRatingBonusValue(cr);
-
}
-
return 0.0f;
+}
uint32 Unit::GetCombatRatingDamageReduction(CombatRating cr, float rate, float cap, uint32 damage) const
{
float percent = std::min(GetCombatRatingReduction(cr) * rate, cap);
[CODE]diff -r d7a5acaa4c45 src/server/game/Entities/Unit/Unit.cpp
— a/src/server/game/Entities/Unit/Unit.cpp Thu Apr 28 18:49:05 2011 -0300
+++ b/src/server/game/Entities/Unit/Unit.cpp Mon May 02 21:15:58 2011 -0300
@@ -16437,6 +16441,21 @@
return 0.0f;
}
+float Unit::GetCombatRatingBonusFromOwner(CombatRating cr) const
+{
-
if (GetTypeId() == TYPEID_PLAYER)
-
return ((Player const*)this)->GetRatingBonusValue(cr);
-
else if (((Creature const*)this)->isPet())
-
{
-
// Gargoyle Should get 100% benefit from owner haste [/CODE][/SPOILER]
/emoticons/default_biggrin.png
-
float GetHasteBonusMelee() const {return GetCombatRatingBonusFromOwner(CR_HASTE_MELEE); }
-
float GetHasteBonusRanged() const {return GetCombatRatingBonusFromOwner(CR_HASTE_RANGED); }
-
float GetHasteBonusSpell() const {return GetCombatRatingBonusFromOwner(CR_HASTE_SPELL); } // player or player's pet resilience (-1%) float GetMeleeCritChanceReduction() const { return GetCombatRatingReduction(CR_CRIT_TAKEN_MELEE); }
@@ -2084,6 +2088,7 @@
bool HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura);
// player or player's pet
-
float GetCombatRatingBonusFromOwner(CombatRating cr) const; float GetCombatRatingReduction(CombatRating cr) const; uint32 GetCombatRatingDamageReduction(CombatRating cr, float rate, float cap, uint32 damage) const;
[CODE]diff -r d7a5acaa4c45 src/server/game/Entities/Unit/Unit.h
— a/src/server/game/Entities/Unit/Unit.h Thu Apr 28 18:49:05 2011 -0300
+++ b/src/server/game/Entities/Unit/Unit.h Mon May 02 21:15:58 2011 -0300
@@ -1300,6 +1300,10 @@
void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType = BASE_ATTACK, bool crit = false);
void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss);
-
// Hehe, Haste bonus from player [/CODE]
Sounds like i’m in the right way, but there’s still something missing, because the gargoyle isn’t getting any benefit from the owners haste even after that /emoticons/default_tongue.png
Srry for the bad english.