mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-28 12:52:25 +01:00
Core/Creature: 4a219ed codestyle followup
This commit is contained in:
@@ -752,12 +752,12 @@ void Creature::Update(uint32 diff)
|
||||
break;
|
||||
|
||||
GetThreatManager().Update(diff);
|
||||
if (_spellFocusInfo.delay)
|
||||
if (_spellFocusInfo.Delay)
|
||||
{
|
||||
if (_spellFocusInfo.delay <= diff)
|
||||
if (_spellFocusInfo.Delay <= diff)
|
||||
ReacquireSpellFocusTarget();
|
||||
else
|
||||
_spellFocusInfo.delay -= diff;
|
||||
_spellFocusInfo.Delay -= diff;
|
||||
}
|
||||
|
||||
// periodic check to see if the creature has passed an evade boundary
|
||||
@@ -3029,7 +3029,7 @@ void Creature::SetDisplayId(uint32 modelId)
|
||||
void Creature::SetTarget(ObjectGuid guid)
|
||||
{
|
||||
if (HasSpellFocus())
|
||||
_spellFocusInfo.target = guid;
|
||||
_spellFocusInfo.Target = guid;
|
||||
else
|
||||
SetGuidValue(UNIT_FIELD_TARGET, guid);
|
||||
}
|
||||
@@ -3037,7 +3037,7 @@ void Creature::SetTarget(ObjectGuid guid)
|
||||
void Creature::SetSpellFocus(Spell const* focusSpell, WorldObject const* target)
|
||||
{
|
||||
// already focused
|
||||
if (_spellFocusInfo.spell)
|
||||
if (_spellFocusInfo.Spell)
|
||||
return;
|
||||
|
||||
// Prevent dead/feigning death creatures from setting a focus target, so they won't turn
|
||||
@@ -3062,15 +3062,15 @@ void Creature::SetSpellFocus(Spell const* focusSpell, WorldObject const* target)
|
||||
return;
|
||||
|
||||
// store pre-cast values for target and orientation (used to later restore)
|
||||
if (!_spellFocusInfo.delay)
|
||||
if (!_spellFocusInfo.Delay)
|
||||
{ // only overwrite these fields if we aren't transitioning from one spell focus to another
|
||||
_spellFocusInfo.target = GetGuidValue(UNIT_FIELD_TARGET);
|
||||
_spellFocusInfo.orientation = GetOrientation();
|
||||
_spellFocusInfo.Target = GetGuidValue(UNIT_FIELD_TARGET);
|
||||
_spellFocusInfo.Orientation = GetOrientation();
|
||||
}
|
||||
else // don't automatically reacquire target for the previous spellcast
|
||||
_spellFocusInfo.delay = 0;
|
||||
_spellFocusInfo.Delay = 0;
|
||||
|
||||
_spellFocusInfo.spell = focusSpell;
|
||||
_spellFocusInfo.Spell = focusSpell;
|
||||
|
||||
bool const noTurnDuringCast = spellInfo->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST);
|
||||
// set target, then force send update packet to players if it changed to provide appropriate facing
|
||||
@@ -3118,30 +3118,30 @@ bool Creature::HasSpellFocus(Spell const* focusSpell) const
|
||||
{
|
||||
if (!IsAlive()) // dead creatures cannot focus
|
||||
{
|
||||
if (_spellFocusInfo.spell || _spellFocusInfo.delay)
|
||||
if (_spellFocusInfo.Spell || _spellFocusInfo.Delay)
|
||||
{
|
||||
TC_LOG_WARN("entities.unit", "Creature '%s' (entry %u) has spell focus (spell id %u, delay %ums) despite being dead.",
|
||||
GetName().c_str(), GetEntry(), _spellFocusInfo.spell ? _spellFocusInfo.spell->GetSpellInfo()->Id : 0, _spellFocusInfo.delay);
|
||||
GetName().c_str(), GetEntry(), _spellFocusInfo.Spell ? _spellFocusInfo.Spell->GetSpellInfo()->Id : 0, _spellFocusInfo.Delay);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (focusSpell)
|
||||
return (focusSpell == _spellFocusInfo.spell);
|
||||
return (focusSpell == _spellFocusInfo.Spell);
|
||||
else
|
||||
return (_spellFocusInfo.spell || _spellFocusInfo.delay);
|
||||
return (_spellFocusInfo.Spell || _spellFocusInfo.Delay);
|
||||
}
|
||||
|
||||
void Creature::ReleaseSpellFocus(Spell const* focusSpell, bool withDelay)
|
||||
{
|
||||
if (!_spellFocusInfo.spell)
|
||||
if (!_spellFocusInfo.Spell)
|
||||
return;
|
||||
|
||||
// focused to something else
|
||||
if (focusSpell && focusSpell != _spellFocusInfo.spell)
|
||||
if (focusSpell && focusSpell != _spellFocusInfo.Spell)
|
||||
return;
|
||||
|
||||
if (_spellFocusInfo.spell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST))
|
||||
if (_spellFocusInfo.Spell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST))
|
||||
ClearUnitState(UNIT_STATE_FOCUSING);
|
||||
|
||||
if (IsPet()) // player pets do not use delay system
|
||||
@@ -3150,9 +3150,9 @@ void Creature::ReleaseSpellFocus(Spell const* focusSpell, bool withDelay)
|
||||
ReacquireSpellFocusTarget();
|
||||
}
|
||||
else // don't allow re-target right away to prevent visual bugs
|
||||
_spellFocusInfo.delay = withDelay ? 1000 : 1;
|
||||
_spellFocusInfo.Delay = withDelay ? 1000 : 1;
|
||||
|
||||
_spellFocusInfo.spell = nullptr;
|
||||
_spellFocusInfo.Spell = nullptr;
|
||||
}
|
||||
|
||||
void Creature::ReacquireSpellFocusTarget()
|
||||
@@ -3160,19 +3160,19 @@ void Creature::ReacquireSpellFocusTarget()
|
||||
if (!HasSpellFocus())
|
||||
return;
|
||||
|
||||
SetTarget(_spellFocusInfo.target);
|
||||
SetTarget(_spellFocusInfo.Target);
|
||||
|
||||
if (!HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN))
|
||||
{
|
||||
if (_spellFocusInfo.target)
|
||||
if (_spellFocusInfo.Target)
|
||||
{
|
||||
if (WorldObject const* objTarget = ObjectAccessor::GetWorldObject(*this, _spellFocusInfo.target))
|
||||
if (WorldObject const* objTarget = ObjectAccessor::GetWorldObject(*this, _spellFocusInfo.Target))
|
||||
SetFacingToObject(objTarget, false);
|
||||
}
|
||||
else
|
||||
SetFacingTo(_spellFocusInfo.orientation, false);
|
||||
SetFacingTo(_spellFocusInfo.Orientation, false);
|
||||
}
|
||||
_spellFocusInfo.delay = 0;
|
||||
_spellFocusInfo.Delay = 0;
|
||||
}
|
||||
|
||||
bool Creature::IsMovementPreventedByCasting() const
|
||||
|
||||
@@ -342,7 +342,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
// Handling caster facing during spellcast
|
||||
void SetTarget(ObjectGuid guid) override;
|
||||
void ReacquireSpellFocusTarget();
|
||||
void DoNotReacquireSpellFocusTarget() { _spellFocusInfo.delay = 0; }
|
||||
void DoNotReacquireSpellFocusTarget() { _spellFocusInfo.Delay = 0; }
|
||||
void SetSpellFocus(Spell const* focusSpell, WorldObject const* target);
|
||||
bool HasSpellFocus(Spell const* focusSpell = nullptr) const override;
|
||||
void ReleaseSpellFocus(Spell const* focusSpell = nullptr, bool withDelay = true);
|
||||
@@ -434,10 +434,10 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
/* Spell focus system */
|
||||
struct
|
||||
{
|
||||
Spell const* spell = nullptr;
|
||||
uint32 delay = 0; // ms until the creature's target should snap back (0 = no snapback scheduled)
|
||||
ObjectGuid target; // the creature's "real" target while casting
|
||||
float orientation = 0.0f; // the creature's "real" orientation while casting
|
||||
Spell const* Spell = nullptr;
|
||||
uint32 Delay = 0; // ms until the creature's target should snap back (0 = no snapback scheduled)
|
||||
ObjectGuid Target; // the creature's "real" target while casting
|
||||
float Orientation = 0.0f; // the creature's "real" orientation while casting
|
||||
} _spellFocusInfo;
|
||||
|
||||
time_t _lastDamagedTime; // Part of Evade mechanics
|
||||
|
||||
Reference in New Issue
Block a user