Fix an edge case issue where creatures would re-acquire target after respawn if they despawned while spell focusing.

This commit is contained in:
hondacrx
2017-10-04 12:31:43 -04:00
parent df2ff63283
commit 911e039571
4 changed files with 36 additions and 6 deletions
+10 -3
View File
@@ -1581,6 +1581,7 @@ namespace Game.Entities
SaveRespawnTime();
ReleaseFocus(null, false); // remove spellcast focus
DoNotReacquireTarget(); // cancel delayed re-target
SetTarget(ObjectGuid.Empty); // drop target - dead mobs shouldn't ever target things
SetUInt64Value(UnitFields.NpcFlags, (ulong)NPCFlags.None);
@@ -1689,6 +1690,8 @@ namespace Game.Entities
}
GetMotionMaster().InitDefault();
//Re-initialize reactstate that could be altered by movementgenerators
InitializeReactState();
//Call AI respawn virtual function
if (IsAIEnabled)
@@ -1700,9 +1703,6 @@ namespace Game.Entities
uint poolid = GetSpawnId() != 0 ? Global.PoolMgr.IsPartOfAPool<Creature>(GetSpawnId()) : 0;
if (poolid != 0)
Global.PoolMgr.UpdatePool<Creature>(poolid, GetSpawnId());
//Re-initialize reactstate that could be altered by movementgenerators
InitializeReactState();
}
UpdateObjectVisibility();
@@ -2833,6 +2833,13 @@ namespace Game.Entities
public void MustReacquireTarget() { m_shouldReacquireTarget = true; } // flags the Creature for forced (client displayed) target reacquisition in the next Update call
public void DoNotReacquireTarget()
{
m_shouldReacquireTarget = false;
m_suppressedTarget = ObjectGuid.Empty;
m_suppressedOrientation = 0.0f;
}
public ulong GetSpawnId() { return m_spawnId; }
public void SetCorpseDelay(uint delay) { m_corpseDelay = delay; }
@@ -111,6 +111,8 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Anubarak
_petCount = 0;
}
public override bool CanAIAttack(Unit victim) { return true; } // do not check boundary here
public override void EnterCombat(Unit who)
{
base.EnterCombat(who);
@@ -118,6 +120,9 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Anubarak
GameObject door = instance.GetGameObject(ANDataTypes.AnubarakWall);
if (door)
door.SetGoState(GameObjectState.Active); // open door for now
GameObject door2 = instance.GetGameObject(ANDataTypes.AnubarakWall2);
if (door2)
door2.SetGoState(GameObjectState.Active);
Talk(TextIds.SayAggro);
instance.DoStartCriteriaTimer(CriteriaTimedTypes.Event, Misc.AchievGottaGoStartEvent);
@@ -172,6 +177,9 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Anubarak
GameObject door = instance.GetGameObject(ANDataTypes.AnubarakWall);
if (door)
door.SetGoState(GameObjectState.Ready);
GameObject door2 = instance.GetGameObject(ANDataTypes.AnubarakWall2);
if (door2)
door2.SetGoState(GameObjectState.Ready);
break;
case EventIds.Pound:
DoCastVictim(SpellIds.Pound);
@@ -706,12 +706,14 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Nadronox
if (hadronox && hadronox.IsAlive())
{
if (_nextMovement != MovementIds.HadronoxReal)
{
if (hadronox.GetPositionZ() < zCutoff)
{
me.GetMotionMaster().MovePoint((uint)MovementIds.Hadronox, Misc.hadronoxStep[2]);
break;
}
me.GetMotionMaster().MoveChase(hadronox);
}
AttackStart(hadronox);
}
break;
}
@@ -34,6 +34,7 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub
public const uint WatcherGashra = 4;
public const uint WatcherSilthik = 5;
public const uint AnubarakWall = 6;
public const uint AnubarakWall2 = 7;
}
struct ANCreatureIds
@@ -83,7 +84,8 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub
public static ObjectData[] gameobjectData =
{
new ObjectData(ANGameObjectIds.AnubarakDoor3, ANDataTypes.AnubarakWall)
new ObjectData(ANGameObjectIds.AnubarakDoor1, ANDataTypes.AnubarakWall),
new ObjectData(ANGameObjectIds.AnubarakDoor3, ANDataTypes.AnubarakWall2)
};
public static BossBoundaryEntry[] boundaries =
@@ -121,6 +123,17 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub
if (gatewatcher)
gatewatcher.GetAI().DoAction(-ANInstanceMisc.ActionGatewatcherGreet);
}
public override bool CheckRequiredBosses(uint bossId, Player player)
{
if (_SkipCheckRequiredBosses(player))
return true;
if (bossId > ANDataTypes.KrikthirTheGatewatcher && GetBossState(ANDataTypes.KrikthirTheGatewatcher) != EncounterState.Done)
return false;
return true;
}
}
public override InstanceScript GetInstanceScript(InstanceMap map)