refactor(Core/Entities): Cleanup Unit header file (#19622)

* move several enum definitions in a new files

* move more things

* remove the include comment

* move the related code to CharmInfo in this own file

*original idea of Ovahlord

Co-Authored-By: Ovahlord <18347559+Ovahlord@users.noreply.github.com>

* fix clang build errors and few blank lines

* missing forward declaration

* new tentative to fix gcc/clang build

* add several include could be necessary for gcc/clang compilation

* .

* revert some include since the last AC update

* fix some loop inconsistencies

* align all enums in UnitDefine.h

---------

Co-authored-by: Ovahlord <18347559+Ovahlord@users.noreply.github.com>
This commit is contained in:
Grimdhex
2024-08-15 10:12:44 +02:00
committed by GitHub
parent 1565758da4
commit 7457aef78d
14 changed files with 1236 additions and 1145 deletions

View File

@@ -290,6 +290,30 @@ private:
//=================================================
struct RedirectThreatInfo
{
RedirectThreatInfo() = default;
ObjectGuid _targetGUID;
uint32 _threatPct{ 0 };
[[nodiscard]] ObjectGuid GetTargetGUID() const { return _targetGUID; }
[[nodiscard]] uint32 GetThreatPct() const { return _threatPct; }
void Set(ObjectGuid guid, uint32 pct)
{
_targetGUID = guid;
_threatPct = pct;
}
void ModifyThreatPct(int32 amount)
{
amount += _threatPct;
_threatPct = uint32(std::max(0, amount));
}
};
//=================================================
namespace Acore
{
// Binary predicate for sorting HostileReferences based on threat value