diff options
| author | Vincent_Michael <Vincent_Michael@gmx.de> | 2013-01-05 16:55:17 +0100 |
|---|---|---|
| committer | Vincent_Michael <Vincent_Michael@gmx.de> | 2013-01-05 16:55:17 +0100 |
| commit | 24e0eb1812f94c5092009f78ced3306f142d2789 (patch) | |
| tree | 0118c5abc4e0bb3e8e2a218ca2c9c1934f8eb0d1 /src/server/game/Entities/Unit | |
| parent | 8db66bfefdb9ec7a722dd93aadbbd818c567fba0 (diff) | |
| parent | 7dd0cd4403d7f28343a751e7b85aeb30d3968ff5 (diff) | |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into mmaps
Conflicts:
src/server/game/Movement/Spline/MoveSplineInit.cpp
Diffstat (limited to 'src/server/game/Entities/Unit')
| -rw-r--r-- | src/server/game/Entities/Unit/StatSystem.cpp | 8 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 22 |
2 files changed, 23 insertions, 7 deletions
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index 1bd7c1b217d..5cf0550905c 100644 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -200,10 +200,9 @@ void Player::UpdateResistances(uint32 school) void Player::UpdateArmor() { - float value = 0.0f; UnitMods unitMod = UNIT_MOD_ARMOR; - value = GetModifierValue(unitMod, BASE_VALUE); // base armor (from items) + float value = GetModifierValue(unitMod, BASE_VALUE); // base armor (from items) value *= GetModifierValue(unitMod, BASE_PCT); // armor percent from items value += GetStat(STAT_AGILITY) * 2.0f; // armor bonus from stats value += GetModifierValue(unitMod, TOTAL_VALUE); @@ -1091,10 +1090,9 @@ bool Guardian::UpdateStats(Stats stat) case STAT_STRENGTH: mod = 0.7f; break; // Default Owner's Strength scale default: break; } - // 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); + AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0); if (aurEff) { SpellInfo const* spellInfo = aurEff->GetSpellInfo(); // Then get the SpellProto and add the dummy effect value diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index c4d7a221667..831e3785b94 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -12712,9 +12712,27 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) case MOVE_SWIM: case MOVE_FLIGHT: { - // Set creature speed rate from CreatureInfo + // Set creature speed rate if (GetTypeId() == TYPEID_UNIT) - speed *= ToCreature()->GetCreatureTemplate()->speed_run; // at this point, MOVE_WALK is never reached + { + Unit* pOwner = GetCharmerOrOwner(); + if (isPet() && !isInCombat() && pOwner) // Must check for owner or crash on "Tame Beast" + { + // For every yard over 5, increase speed by 0.01 + // to help prevent pet from lagging behind and despawning + float dist = GetDistance(pOwner); + float base_rate = 1.00f; // base speed is 100% of owner speed + + if (dist < 5) + dist = 5; + + float mult = base_rate + ((dist - 5) * 0.01f); + + speed *= pOwner->GetSpeedRate(mtype) * mult; // pets derive speed from owner when not in combat + } + else + speed *= ToCreature()->GetCreatureTemplate()->speed_run; // at this point, MOVE_WALK is never reached + } // Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need // TODO: possible affect only on MOVE_RUN |
