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(); SaveRespawnTime();
ReleaseFocus(null, false); // remove spellcast focus ReleaseFocus(null, false); // remove spellcast focus
DoNotReacquireTarget(); // cancel delayed re-target
SetTarget(ObjectGuid.Empty); // drop target - dead mobs shouldn't ever target things SetTarget(ObjectGuid.Empty); // drop target - dead mobs shouldn't ever target things
SetUInt64Value(UnitFields.NpcFlags, (ulong)NPCFlags.None); SetUInt64Value(UnitFields.NpcFlags, (ulong)NPCFlags.None);
@@ -1689,6 +1690,8 @@ namespace Game.Entities
} }
GetMotionMaster().InitDefault(); GetMotionMaster().InitDefault();
//Re-initialize reactstate that could be altered by movementgenerators
InitializeReactState();
//Call AI respawn virtual function //Call AI respawn virtual function
if (IsAIEnabled) if (IsAIEnabled)
@@ -1700,9 +1703,6 @@ namespace Game.Entities
uint poolid = GetSpawnId() != 0 ? Global.PoolMgr.IsPartOfAPool<Creature>(GetSpawnId()) : 0; uint poolid = GetSpawnId() != 0 ? Global.PoolMgr.IsPartOfAPool<Creature>(GetSpawnId()) : 0;
if (poolid != 0) if (poolid != 0)
Global.PoolMgr.UpdatePool<Creature>(poolid, GetSpawnId()); Global.PoolMgr.UpdatePool<Creature>(poolid, GetSpawnId());
//Re-initialize reactstate that could be altered by movementgenerators
InitializeReactState();
} }
UpdateObjectVisibility(); 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 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 ulong GetSpawnId() { return m_spawnId; }
public void SetCorpseDelay(uint delay) { m_corpseDelay = delay; } public void SetCorpseDelay(uint delay) { m_corpseDelay = delay; }
@@ -111,6 +111,8 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Anubarak
_petCount = 0; _petCount = 0;
} }
public override bool CanAIAttack(Unit victim) { return true; } // do not check boundary here
public override void EnterCombat(Unit who) public override void EnterCombat(Unit who)
{ {
base.EnterCombat(who); base.EnterCombat(who);
@@ -118,6 +120,9 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Anubarak
GameObject door = instance.GetGameObject(ANDataTypes.AnubarakWall); GameObject door = instance.GetGameObject(ANDataTypes.AnubarakWall);
if (door) if (door)
door.SetGoState(GameObjectState.Active); // open door for now door.SetGoState(GameObjectState.Active); // open door for now
GameObject door2 = instance.GetGameObject(ANDataTypes.AnubarakWall2);
if (door2)
door2.SetGoState(GameObjectState.Active);
Talk(TextIds.SayAggro); Talk(TextIds.SayAggro);
instance.DoStartCriteriaTimer(CriteriaTimedTypes.Event, Misc.AchievGottaGoStartEvent); instance.DoStartCriteriaTimer(CriteriaTimedTypes.Event, Misc.AchievGottaGoStartEvent);
@@ -172,6 +177,9 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Anubarak
GameObject door = instance.GetGameObject(ANDataTypes.AnubarakWall); GameObject door = instance.GetGameObject(ANDataTypes.AnubarakWall);
if (door) if (door)
door.SetGoState(GameObjectState.Ready); door.SetGoState(GameObjectState.Ready);
GameObject door2 = instance.GetGameObject(ANDataTypes.AnubarakWall2);
if (door2)
door2.SetGoState(GameObjectState.Ready);
break; break;
case EventIds.Pound: case EventIds.Pound:
DoCastVictim(SpellIds.Pound); DoCastVictim(SpellIds.Pound);
@@ -706,12 +706,14 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Nadronox
if (hadronox && hadronox.IsAlive()) if (hadronox && hadronox.IsAlive())
{ {
if (_nextMovement != MovementIds.HadronoxReal) if (_nextMovement != MovementIds.HadronoxReal)
{
if (hadronox.GetPositionZ() < zCutoff) if (hadronox.GetPositionZ() < zCutoff)
{ {
me.GetMotionMaster().MovePoint((uint)MovementIds.Hadronox, Misc.hadronoxStep[2]); me.GetMotionMaster().MovePoint((uint)MovementIds.Hadronox, Misc.hadronoxStep[2]);
break; break;
} }
me.GetMotionMaster().MoveChase(hadronox); }
AttackStart(hadronox);
} }
break; break;
} }
@@ -34,6 +34,7 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub
public const uint WatcherGashra = 4; public const uint WatcherGashra = 4;
public const uint WatcherSilthik = 5; public const uint WatcherSilthik = 5;
public const uint AnubarakWall = 6; public const uint AnubarakWall = 6;
public const uint AnubarakWall2 = 7;
} }
struct ANCreatureIds struct ANCreatureIds
@@ -83,7 +84,8 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub
public static ObjectData[] gameobjectData = 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 = public static BossBoundaryEntry[] boundaries =
@@ -121,7 +123,18 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub
if (gatewatcher) if (gatewatcher)
gatewatcher.GetAI().DoAction(-ANInstanceMisc.ActionGatewatcherGreet); 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) public override InstanceScript GetInstanceScript(InstanceMap map)
{ {