aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Creature
diff options
context:
space:
mode:
authorWyrserth <wyrserth@protonmail.com>2019-07-18 02:19:19 +0200
committerWyrserth <wyrserth@protonmail.com>2019-07-18 02:20:36 +0200
commit5f5d2028df70e82d5cd70837953acd059f2ac7fb (patch)
treebe627448bb3079f2330faf962626202123ecc70f /src/server/game/Entities/Creature
parent50b2c3b34d5ffc9539e3f3954ec6b4e5f8a87efc (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>
Diffstat (limited to 'src/server/game/Entities/Creature')
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 4c68ccd77e3..60a428c8dd4 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -569,21 +569,25 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/,
if (updateLevel)
SelectLevel();
- uint32 previousHealth = GetHealth();
- UpdateLevelDependantStats();
- if (previousHealth > 0)
- 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]));
-
- SetCanModifyStats(true);
- UpdateAllStats();
+ // Do not update guardian stats here - they are handled in Guardian::InitStatsForLevel()
+ if (!IsGuardian())
+ {
+ uint32 previousHealth = GetHealth();
+ UpdateLevelDependantStats();
+ if (previousHealth > 0)
+ 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]));
+
+ SetCanModifyStats(true);
+ UpdateAllStats();
+ }
// checked and error show at loading templates
if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction))