Core/Unit: Abide UNIT_FLAG2_DISABLE_TURN on creatures. Add that flag to Kologarn (from sniff). Hi sirikfoll.

This commit is contained in:
Treeston
2018-01-10 00:07:37 +01:00
parent b53cbf467b
commit d9c772303c
3 changed files with 26 additions and 16 deletions

View File

@@ -0,0 +1,2 @@
--
UPDATE `creature_template` SET `unit_flags2` = `unit_flags2`|0x8000 WHERE `entry`=32930;

View File

@@ -723,13 +723,17 @@ void Creature::Update(uint32 diff)
if (m_shouldReacquireTarget && !IsFocusing(nullptr, true))
{
SetTarget(m_suppressedTarget);
if (m_suppressedTarget)
if (!HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN))
{
if (WorldObject const* objTarget = ObjectAccessor::GetWorldObject(*this, m_suppressedTarget))
SetFacingToObject(objTarget, false);
if (m_suppressedTarget)
{
if (WorldObject const* objTarget = ObjectAccessor::GetWorldObject(*this, m_suppressedTarget))
SetFacingToObject(objTarget, false);
}
else
SetFacingTo(m_suppressedOrientation, false);
}
else
SetFacingTo(m_suppressedOrientation, false);
m_shouldReacquireTarget = false;
}
@@ -3122,15 +3126,19 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target)
}
}
bool const canTurnDuringCast = !spellInfo->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST);
// Face the target - we need to do this before the unit state is modified for no-turn spells
if (target)
SetFacingToObject(target, false);
else if (!canTurnDuringCast)
if (Unit* victim = GetVictim())
SetFacingToObject(victim, false); // ensure orientation is correct at beginning of cast
bool const noTurnDuringCast = spellInfo->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST);
if (!HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN))
{
// Face the target - we need to do this before the unit state is modified for no-turn spells
if (target)
SetFacingToObject(target, false);
else if (noTurnDuringCast)
if (Unit* victim = GetVictim())
SetFacingToObject(victim, false); // ensure orientation is correct at beginning of cast
}
if (!canTurnDuringCast)
if (noTurnDuringCast)
AddUnitState(UNIT_STATE_CANNOT_TURN);
}
@@ -3168,7 +3176,7 @@ void Creature::ReleaseFocus(Spell const* focusSpell, bool withDelay)
if (focusSpell && focusSpell != m_focusSpell)
return;
if (IsPet()) // player pets do not use delay system
if (IsPet() && !HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN)) // player pets do not use delay system
{
SetGuidValue(UNIT_FIELD_TARGET, m_suppressedTarget);
if (m_suppressedTarget)

View File

@@ -1957,7 +1957,7 @@ void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType, bool extr
if (attType != BASE_ATTACK && attType != OFF_ATTACK)
return; // ignore ranged case
if (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
if (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && !HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN))
SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
// melee attack spell cast at main hand attack only - no normal melee dmg dealt
@@ -2005,7 +2005,7 @@ void Unit::FakeAttackerStateUpdate(Unit* victim, WeaponAttackType attType /*= BA
if (attType != BASE_ATTACK && attType != OFF_ATTACK)
return; // ignore ranged case
if (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
if (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && !HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN))
SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
CalcDamageInfo damageInfo;