diff options
| author | Wyrserth <wyrserth@protonmail.com> | 2019-07-18 02:19:19 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-12-16 21:57:19 +0100 |
| commit | 537b425377c065e5a99486387247349bde0a37ea (patch) | |
| tree | ddd58da2da7a997961317eebf380708ebc004393 | |
| parent | 3e120de7df06efa3725de8fad14ac481d918f5cb (diff) | |
Core/Creature: don't set guardian stats in Creature::UpdateEntry(), because stat calculation from guardians is already done in Guardian::InitStatsForLevel.
Closes #281.
Signed-off-by: Wyrserth <wyrserth@protonmail.com>
(cherry picked from commit 5f5d2028df70e82d5cd70837953acd059f2ac7fb)
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 8b62cd89d1d..d966adbdd66 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -631,7 +631,7 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/, if (updateLevel) SelectLevel(); - else + else if (!IsGuardian()) { uint32 previousHealth = GetHealth(); UpdateLevelDependantStats(); // We still re-initialize level dependant stats on entry update @@ -639,16 +639,20 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/, SetHealth(previousHealth); } - SetMeleeDamageSchool(SpellSchools(cInfo->dmgschool)); - SetStatFlatModifier(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_HOLY])); - SetStatFlatModifier(UNIT_MOD_RESISTANCE_FIRE, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_FIRE])); - SetStatFlatModifier(UNIT_MOD_RESISTANCE_NATURE, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_NATURE])); - SetStatFlatModifier(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_FROST])); - SetStatFlatModifier(UNIT_MOD_RESISTANCE_SHADOW, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_SHADOW])); - SetStatFlatModifier(UNIT_MOD_RESISTANCE_ARCANE, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_ARCANE])); + // Do not update guardian stats here - they are handled in Guardian::InitStatsForLevel() + if (!IsGuardian()) + { + SetMeleeDamageSchool(SpellSchools(cInfo->dmgschool)); + SetStatFlatModifier(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_HOLY])); + SetStatFlatModifier(UNIT_MOD_RESISTANCE_FIRE, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_FIRE])); + SetStatFlatModifier(UNIT_MOD_RESISTANCE_NATURE, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_NATURE])); + SetStatFlatModifier(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_FROST])); + SetStatFlatModifier(UNIT_MOD_RESISTANCE_SHADOW, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_SHADOW])); + SetStatFlatModifier(UNIT_MOD_RESISTANCE_ARCANE, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_ARCANE])); - SetCanModifyStats(true); - UpdateAllStats(); + SetCanModifyStats(true); + UpdateAllStats(); + } // checked and error show at loading templates if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction)) |
