diff options
| author | Shauren <shauren.trinity@gmail.com> | 2024-03-01 18:38:49 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2024-03-01 18:38:49 +0100 |
| commit | e1e53ee06e4b88d2f3804cfa53812e2e14d709a3 (patch) | |
| tree | 511e9ef56037518130ae9b06cf47db1c28856a90 /src | |
| parent | f487530c3a27625a2aa1241aeb380317d7a8747f (diff) | |
Core/Creatures: Fixed sparring
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 8 | ||||
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 75512b14b3a..68e3fa69839 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -683,7 +683,7 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/, InitializeMovementCapabilities(); LoadCreaturesAddon(); - LoadCreaturesSparringHealth(); + LoadCreaturesSparringHealth(true); LoadTemplateImmunities(cInfo->CreatureImmunitiesId); GetThreatManager().EvaluateSuppressed(); @@ -1145,7 +1145,7 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 entry, Posit } LoadCreaturesAddon(); - LoadCreaturesSparringHealth(); + LoadCreaturesSparringHealth(true); //! Need to be called after LoadCreaturesAddon - MOVEMENTFLAG_HOVER is set there m_positionZ += GetHoverOffset(); @@ -2794,10 +2794,10 @@ bool Creature::LoadCreaturesAddon() return true; } -void Creature::LoadCreaturesSparringHealth() +void Creature::LoadCreaturesSparringHealth(bool force /*= false*/) { if (std::vector<float> const* templateValues = sObjectMgr->GetCreatureTemplateSparringValues(GetCreatureTemplate()->Entry)) - if (std::find(templateValues->begin(), templateValues->end(), _sparringHealthPct) != templateValues->end()) // only re-randomize sparring value if it was loaded from template (not when set to custom value from script) + if (force || std::find(templateValues->begin(), templateValues->end(), _sparringHealthPct) != templateValues->end()) // only re-randomize sparring value if it was loaded from template (not when set to custom value from script) _sparringHealthPct = Trinity::Containers::SelectRandomContainerElement(*templateValues); } diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index ee15cefd924..bb4f7973168 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -88,7 +88,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma static Creature* CreateCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap = true, bool allowDuplicate = false); bool LoadCreaturesAddon(); - void LoadCreaturesSparringHealth(); + void LoadCreaturesSparringHealth(bool force = false); void SelectLevel(); void UpdateLevelDependantStats(); void SelectWildBattlePetLevel(); |
