Core/Unit: Abide UNIT_FLAG2_DISABLE_TURN on creatures.

Port From (https://github.com/TrinityCore/TrinityCore/commit/ac8ff492744e65437fc906372058a0b29147af3f)
This commit is contained in:
hondacrx
2021-05-18 13:45:37 -04:00
parent ea9dd9207f
commit 00da79c7a9
3 changed files with 29 additions and 18 deletions
+13 -4
View File
@@ -519,6 +519,9 @@ namespace Game.Entities
if (m_shouldReacquireTarget && !IsFocusing(null, true)) if (m_shouldReacquireTarget && !IsFocusing(null, true))
{ {
SetTarget(m_suppressedTarget); SetTarget(m_suppressedTarget);
if (!HasUnitFlag2(UnitFlags2.DisableTurn))
{
if (!m_suppressedTarget.IsEmpty()) if (!m_suppressedTarget.IsEmpty())
{ {
WorldObject objTarget = Global.ObjAccessor.GetWorldObject(this, m_suppressedTarget); WorldObject objTarget = Global.ObjAccessor.GetWorldObject(this, m_suppressedTarget);
@@ -527,6 +530,8 @@ namespace Game.Entities
} }
else else
SetFacingTo(m_suppressedOrientation); SetFacingTo(m_suppressedOrientation);
}
m_shouldReacquireTarget = false; m_shouldReacquireTarget = false;
} }
@@ -2979,18 +2984,22 @@ namespace Game.Entities
} }
} }
bool canTurnDuringCast = !focusSpell.GetSpellInfo().HasAttribute(SpellAttr5.DontTurnDuringCast); bool noTurnDuringCast = spellInfo.HasAttribute(SpellAttr5.DontTurnDuringCast);
if (!HasUnitFlag2(UnitFlags2.DisableTurn))
{
// Face the target - we need to do this before the unit state is modified for no-turn spells // Face the target - we need to do this before the unit state is modified for no-turn spells
if (target) if (target)
SetFacingToObject(target, false); SetFacingToObject(target, false);
else if (!canTurnDuringCast) else if (!noTurnDuringCast)
{ {
Unit victim = GetVictim(); Unit victim = GetVictim();
if (victim) if (victim)
SetFacingToObject(victim, false); // ensure server-side orientation is correct at beginning of cast SetFacingToObject(victim, false); // ensure server-side orientation is correct at beginning of cast
} }
}
if (!canTurnDuringCast) if (!noTurnDuringCast)
AddUnitState(UnitState.CannotTurn); AddUnitState(UnitState.CannotTurn);
} }
@@ -3028,7 +3037,7 @@ namespace Game.Entities
if (focusSpell && focusSpell != _focusSpell) if (focusSpell && focusSpell != _focusSpell)
return; return;
if (IsPet())// player pets do not use delay system if (IsPet() && !HasUnitFlag2(UnitFlags2.DisableTurn))// player pets do not use delay system
{ {
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Target), m_suppressedTarget); SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Target), m_suppressedTarget);
if (!m_suppressedTarget.IsEmpty()) if (!m_suppressedTarget.IsEmpty())
+2 -2
View File
@@ -517,7 +517,7 @@ namespace Game.Entities
if (attType != WeaponAttackType.BaseAttack && attType != WeaponAttackType.OffAttack) if (attType != WeaponAttackType.BaseAttack && attType != WeaponAttackType.OffAttack)
return; return;
if (IsTypeId(TypeId.Unit) && !HasUnitFlag(UnitFlags.PlayerControlled)) if (IsTypeId(TypeId.Unit) && !HasUnitFlag(UnitFlags.PlayerControlled) && !HasUnitFlag2(UnitFlags2.DisableTurn))
SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells) SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
// melee attack spell casted at main hand attack only - no normal melee dmg dealt // melee attack spell casted at main hand attack only - no normal melee dmg dealt
@@ -600,7 +600,7 @@ namespace Game.Entities
if (attType != WeaponAttackType.BaseAttack && attType != WeaponAttackType.OffAttack) if (attType != WeaponAttackType.BaseAttack && attType != WeaponAttackType.OffAttack)
return; // ignore ranged case return; // ignore ranged case
if (IsTypeId(TypeId.Unit) && !HasUnitFlag(UnitFlags.PlayerControlled)) if (IsTypeId(TypeId.Unit) && !HasUnitFlag(UnitFlags.PlayerControlled) && !HasUnitFlag2(UnitFlags2.DisableTurn))
SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells) SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
CalcDamageInfo damageInfo = new(); CalcDamageInfo damageInfo = new();
@@ -0,0 +1,2 @@
--
UPDATE `creature_template` SET `unit_flags2` = `unit_flags2`|0x8000 WHERE `entry` IN (32930,33909);