Core/Spells: Defined and implemented SPELL_ATTR5_DONT_TURN_DURING_CAST.
This attribute controls whether unit can turn during casting spells (fixes Ingvar's Dark Smash)
This commit is contained in:
@@ -267,7 +267,6 @@ Unit::Unit(bool isWorldObject): WorldObject(isWorldObject)
|
||||
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE);
|
||||
|
||||
_focusSpell = NULL;
|
||||
_targetLocked = false;
|
||||
_lastLiquid = NULL;
|
||||
_isWalkingBeforeCharm = false;
|
||||
}
|
||||
@@ -423,6 +422,9 @@ void Unit::UpdateSplineMovement(uint32 t_diff)
|
||||
transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, loc.orientation);
|
||||
}
|
||||
|
||||
if (HasUnitState(UNIT_STATE_CANNOT_TURN))
|
||||
loc.orientation = GetOrientation();
|
||||
|
||||
UpdatePosition(loc.x, loc.y, loc.z, loc.orientation);
|
||||
}
|
||||
}
|
||||
@@ -17731,3 +17733,31 @@ void Unit::SendMovementCanFlyChange()
|
||||
BuildMovementPacket(&data);
|
||||
SendMessageToSet(&data, false);
|
||||
}
|
||||
|
||||
void Unit::FocusTarget(Spell const* focusSpell, uint64 target)
|
||||
{
|
||||
// already focused
|
||||
if (_focusSpell)
|
||||
return;
|
||||
|
||||
_focusSpell = focusSpell;
|
||||
SetUInt64Value(UNIT_FIELD_TARGET, target);
|
||||
if (focusSpell->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_DONT_TURN_DURING_CAST)
|
||||
AddUnitState(UNIT_STATE_ROTATING);
|
||||
}
|
||||
|
||||
void Unit::ReleaseFocus(Spell const* focusSpell)
|
||||
{
|
||||
// focused to something else
|
||||
if (focusSpell != _focusSpell)
|
||||
return;
|
||||
|
||||
_focusSpell = NULL;
|
||||
if (Unit* victim = getVictim())
|
||||
SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID());
|
||||
else
|
||||
SetUInt64Value(UNIT_FIELD_TARGET, 0);
|
||||
|
||||
if (focusSpell->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_DONT_TURN_DURING_CAST)
|
||||
ClearUnitState(UNIT_STATE_ROTATING);
|
||||
}
|
||||
|
||||
@@ -2207,34 +2207,13 @@ class Unit : public WorldObject
|
||||
|
||||
void SetTarget(uint64 guid)
|
||||
{
|
||||
if (!_targetLocked)
|
||||
if (!_focusSpell)
|
||||
SetUInt64Value(UNIT_FIELD_TARGET, guid);
|
||||
}
|
||||
|
||||
void FocusTarget(Spell const* focusSpell, uint64 target)
|
||||
{
|
||||
// already focused
|
||||
if (_focusSpell)
|
||||
return;
|
||||
|
||||
_focusSpell = focusSpell;
|
||||
_targetLocked = true;
|
||||
SetUInt64Value(UNIT_FIELD_TARGET, target);
|
||||
}
|
||||
|
||||
void ReleaseFocus(Spell const* focusSpell)
|
||||
{
|
||||
// focused to something else
|
||||
if (focusSpell != _focusSpell)
|
||||
return;
|
||||
|
||||
_focusSpell = NULL;
|
||||
_targetLocked = false;
|
||||
if (Unit* victim = getVictim())
|
||||
SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID());
|
||||
else
|
||||
SetUInt64Value(UNIT_FIELD_TARGET, 0);
|
||||
}
|
||||
// Handling caster facing during spellcast
|
||||
void FocusTarget(Spell const* focusSpell, uint64 target);
|
||||
void ReleaseFocus(Spell const* focusSpell);
|
||||
|
||||
// Movement info
|
||||
Movement::MoveSpline * movespline;
|
||||
@@ -2358,8 +2337,7 @@ class Unit : public WorldObject
|
||||
bool m_cleanupDone; // lock made to not add stuff after cleanup before delete
|
||||
bool m_duringRemoveFromWorld; // lock made to not add stuff after begining removing from world
|
||||
|
||||
Spell const* _focusSpell;
|
||||
bool _targetLocked; // locks the target during spell cast for proper facing
|
||||
Spell const* _focusSpell; ///> Locks the target during spell cast for proper facing
|
||||
bool _isWalkingBeforeCharm; // Are we walking before we were charmed?
|
||||
};
|
||||
|
||||
|
||||
@@ -465,7 +465,7 @@ enum SpellAttr5
|
||||
SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK = 0x00010000, // 16 this allows spells with EquippedItemClass to affect spells from other items if the required item is equipped
|
||||
SPELL_ATTR5_USABLE_WHILE_FEARED = 0x00020000, // 17 usable while feared
|
||||
SPELL_ATTR5_USABLE_WHILE_CONFUSED = 0x00040000, // 18 usable while confused
|
||||
SPELL_ATTR5_UNK19 = 0x00080000, // 19
|
||||
SPELL_ATTR5_DONT_TURN_DURING_CAST = 0x00080000, // 19 Blocks caster's turning when casting (client does not automatically turn caster's model to face UNIT_FIELD_TARGET)
|
||||
SPELL_ATTR5_UNK20 = 0x00100000, // 20
|
||||
SPELL_ATTR5_UNK21 = 0x00200000, // 21
|
||||
SPELL_ATTR5_UNK22 = 0x00400000, // 22
|
||||
|
||||
@@ -89,6 +89,7 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T &owner)
|
||||
|
||||
Movement::MoveSplineInit init(owner);
|
||||
init.MoveTo(x,y,z);
|
||||
init.SetFacing(i_target.getTarget());
|
||||
init.SetWalk(((D*)this)->EnableWalking());
|
||||
init.Launch();
|
||||
}
|
||||
|
||||
@@ -3069,10 +3069,9 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
|
||||
SendSpellStart();
|
||||
|
||||
// set target for proper facing
|
||||
if (m_casttime && !(_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING))
|
||||
if (uint64 target = m_targets.GetUnitTargetGUID())
|
||||
if (m_caster->GetGUID() != target && m_caster->GetTypeId() == TYPEID_UNIT)
|
||||
m_caster->FocusTarget(this, target);
|
||||
if ((m_casttime || m_spellInfo->IsChanneled()) && !(_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING))
|
||||
if (m_caster->GetGUID() != m_targets.GetObjectTargetGUID() && m_caster->GetTypeId() == TYPEID_UNIT)
|
||||
m_caster->FocusTarget(this, m_targets.GetObjectTargetGUID());
|
||||
|
||||
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_GCD))
|
||||
TriggerGlobalCooldown();
|
||||
|
||||
Reference in New Issue
Block a user