mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 00:48:56 +01:00
Core/Creatures: Fixed sparring
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user