Core/AI: CreatureAI.EnterCombat is now called CreatureAI.JustEngagedWith. There's also two new methods on UnitAI, though they're never invoked right now.
Port From (https://github.com/TrinityCore/TrinityCore/commit/bce43de7f3fba618c370f2aba327d23dd30d1cdd)
This commit is contained in:
@@ -51,7 +51,7 @@ namespace Game.AI
|
||||
}
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit victim)
|
||||
public override void JustEngagedWith(Unit victim)
|
||||
{
|
||||
foreach (var id in Spells)
|
||||
{
|
||||
@@ -134,7 +134,7 @@ namespace Game.AI
|
||||
AttackStartCaster(victim, _attackDist);
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit victim)
|
||||
public override void JustEngagedWith(Unit victim)
|
||||
{
|
||||
if (Spells.Empty())
|
||||
return;
|
||||
|
||||
@@ -408,11 +408,8 @@ namespace Game.AI
|
||||
me.DoImmediateBoundaryCheck();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called for reaction when initially engaged
|
||||
/// </summary>
|
||||
/// <param name="victim"></param>
|
||||
public virtual void EnterCombat(Unit victim) { }
|
||||
// Called for reaction when initially engaged - this will always happen _after_ JustEnteredCombat
|
||||
public virtual void JustEngagedWith(Unit who) { }
|
||||
|
||||
// Called when the creature is killed
|
||||
public virtual void JustDied(Unit killer) { }
|
||||
|
||||
@@ -478,6 +478,13 @@ namespace Game.AI
|
||||
public virtual void SetGUID(ObjectGuid guid, int id = 0) { }
|
||||
public virtual ObjectGuid GetGUID(int id = 0) { return ObjectGuid.Empty; }
|
||||
|
||||
// Called when the unit enters combat
|
||||
// (NOTE: Creature engage logic should NOT be here, but in JustEngagedWith, which happens once threat is established!)
|
||||
public virtual void JustEnteredCombat(Unit who) { }
|
||||
|
||||
// Called when the unit leaves combat
|
||||
public virtual void JustExitedCombat() { }
|
||||
|
||||
public virtual void DamageDealt(Unit victim, ref uint damage, DamageEffectType damageType) { }
|
||||
public virtual void DamageTaken(Unit attacker, ref uint damage) { }
|
||||
public virtual void HealReceived(Unit by, uint addhealth) { }
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Game.AI
|
||||
DoStartNoMovement(target);
|
||||
}
|
||||
|
||||
// Called before EnterCombat even before the creature is in combat.
|
||||
// Called before JustEngagedWith even before the creature is in combat.
|
||||
public override void AttackStart(Unit target)
|
||||
{
|
||||
if (IsCombatMovementAllowed())
|
||||
@@ -411,7 +411,7 @@ namespace Game.AI
|
||||
public override void Reset() { }
|
||||
|
||||
//Called at creature aggro either by MoveInLOS or Attack Start
|
||||
public override void EnterCombat(Unit victim) { }
|
||||
public override void JustEngagedWith(Unit victim) { }
|
||||
|
||||
public bool HealthBelowPct(int pct) { return me.HealthBelowPct(pct); }
|
||||
public bool HealthAbovePct(int pct) { return me.HealthAbovePct(pct); }
|
||||
@@ -502,7 +502,7 @@ namespace Game.AI
|
||||
instance.SetBossState(_bossId, EncounterState.Done);
|
||||
}
|
||||
|
||||
public void _EnterCombat()
|
||||
public void _JustEngagedWith()
|
||||
{
|
||||
if (instance != null)
|
||||
{
|
||||
@@ -602,7 +602,7 @@ namespace Game.AI
|
||||
public virtual void ScheduleTasks() { }
|
||||
|
||||
public override void Reset() { _Reset(); }
|
||||
public override void EnterCombat(Unit who) { _EnterCombat(); }
|
||||
public override void JustEngagedWith(Unit who) { _JustEngagedWith(); }
|
||||
public override void JustDied(Unit killer) { _JustDied(); }
|
||||
public override void JustReachedHome() { _JustReachedHome(); }
|
||||
|
||||
@@ -635,7 +635,7 @@ namespace Game.AI
|
||||
summons.DespawnAll();
|
||||
}
|
||||
|
||||
void _EnterCombat()
|
||||
void _JustEngagedWith()
|
||||
{
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true);
|
||||
if (target)
|
||||
@@ -684,7 +684,7 @@ namespace Game.AI
|
||||
|
||||
public override void Reset() { _Reset(); }
|
||||
|
||||
public override void EnterCombat(Unit who) { _EnterCombat(); }
|
||||
public override void JustEngagedWith(Unit who) { _JustEngagedWith(); }
|
||||
|
||||
public override void JustDied(Unit killer) { _JustDied(); }
|
||||
}
|
||||
|
||||
@@ -609,7 +609,7 @@ namespace Game.AI
|
||||
me.GetMotionMaster().MoveIdle(); // wait the order of leader
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit victim)
|
||||
public override void JustEngagedWith(Unit victim)
|
||||
{
|
||||
if (IsAIControlled())
|
||||
me.InterruptNonMeleeSpells(false); // must be before ProcessEvents
|
||||
|
||||
@@ -1443,7 +1443,7 @@ namespace Game.Entities
|
||||
if (enemy != null)
|
||||
{
|
||||
if (IsAIEnabled)
|
||||
creature.GetAI().EnterCombat(enemy);
|
||||
creature.GetAI().JustEngagedWith(enemy);
|
||||
|
||||
if (creature.GetFormation() != null)
|
||||
creature.GetFormation().MemberEngagingTarget(creature, enemy);
|
||||
|
||||
Reference in New Issue
Block a user