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
+25 -16
View File
@@ -519,14 +519,19 @@ namespace Game.Entities
if (m_shouldReacquireTarget && !IsFocusing(null, true)) if (m_shouldReacquireTarget && !IsFocusing(null, true))
{ {
SetTarget(m_suppressedTarget); SetTarget(m_suppressedTarget);
if (!m_suppressedTarget.IsEmpty())
if (!HasUnitFlag2(UnitFlags2.DisableTurn))
{ {
WorldObject objTarget = Global.ObjAccessor.GetWorldObject(this, m_suppressedTarget); if (!m_suppressedTarget.IsEmpty())
if (objTarget) {
SetFacingToObject(objTarget); WorldObject objTarget = Global.ObjAccessor.GetWorldObject(this, m_suppressedTarget);
if (objTarget)
SetFacingToObject(objTarget);
}
else
SetFacingTo(m_suppressedOrientation);
} }
else
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);
// Face the target - we need to do this before the unit state is modified for no-turn spells
if (target) if (!HasUnitFlag2(UnitFlags2.DisableTurn))
SetFacingToObject(target, false);
else if (!canTurnDuringCast)
{ {
Unit victim = GetVictim(); // Face the target - we need to do this before the unit state is modified for no-turn spells
if (victim) if (target)
SetFacingToObject(victim, false); // ensure server-side orientation is correct at beginning of cast SetFacingToObject(target, false);
else if (!noTurnDuringCast)
{
Unit victim = GetVictim();
if (victim)
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);