Skip to content

Commit

Permalink
Creature: Implement tbc version of CreatureStaticFlags2::IGNORE_MISDI…
Browse files Browse the repository at this point in the history
…RECTION
  • Loading branch information
killerwife committed Dec 27, 2024
1 parent 63d8f52 commit f5e29b3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/game/Combat/ThreatManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ void ThreatManager::addThreat(Unit* victim, float threat, bool crit, SpellSchool

float calculatedThreat = ThreatCalcHelper::CalcThreat(victim, iOwner, threat, crit, schoolMask, threatSpell, assist);

if (calculatedThreat > 0.0f)
if (calculatedThreat > 0.0f && !iOwner->IsIgnoringMisdirection())
{
if (Unit* redirectedTarget = victim->getHostileRefManager().GetThreatRedirectionTarget())
{
Expand Down
5 changes: 5 additions & 0 deletions src/game/Entities/Creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3017,6 +3017,11 @@ bool Creature::IsPreventingDeath() const
return m_settings.HasFlag(CreatureStaticFlags::UNKILLABLE);
}

bool Creature::IsIgnoringMisdirection() const
{
return m_settings.HasFlag(CreatureStaticFlags2::IGNORE_MISDIRECTION);
}

bool Creature::IsCorpseExpired() const
{
auto now = GetMap()->GetCurrentClockTime();
Expand Down
2 changes: 2 additions & 0 deletions src/game/Entities/Creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,8 @@ class Creature : public Unit

bool IsPreventingDeath() const override;

bool IsIgnoringMisdirection() const override;

virtual void AddCooldown(SpellEntry const& spellEntry, ItemPrototype const* itemProto = nullptr, bool permanent = false, uint32 forcedDuration = 0, bool ignoreCat = false) override;

// spell scripting persistency
Expand Down
1 change: 1 addition & 0 deletions src/game/Entities/Unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -2507,6 +2507,7 @@ class Unit : public WorldObject

virtual bool IsNoWeaponSkillGain() const { return false; }
virtual bool IsPreventingDeath() const { return false; }
virtual bool IsIgnoringMisdirection() const { return false; }

virtual CreatureInfo const* GetMountInfo() const { return nullptr; } // TODO: Meant to be used by players during taxi
virtual void SetMountInfo(CreatureInfo const* info) {} // does nothing for base unit
Expand Down

0 comments on commit f5e29b3

Please sign in to comment.