Core/Refactor: Part 5
This commit is contained in:
@@ -239,6 +239,7 @@ namespace Game.AI
|
||||
me.m_CombatDistance = spellInfo != null ? spellInfo.GetMaxRange(false) : 0;
|
||||
me.m_SightDistance = me.m_CombatDistance;
|
||||
}
|
||||
|
||||
public override bool CanAIAttack(Unit victim)
|
||||
{
|
||||
// todo use one function to replace it
|
||||
@@ -247,11 +248,13 @@ namespace Game.AI
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void AttackStart(Unit victim)
|
||||
{
|
||||
if (victim != null)
|
||||
me.Attack(victim, false);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
@@ -292,6 +295,10 @@ namespace Game.AI
|
||||
}
|
||||
}
|
||||
|
||||
public override void MoveInLineOfSight(Unit who) { }
|
||||
|
||||
public override void AttackStart(Unit victim) { }
|
||||
|
||||
public override void OnCharmed(bool apply)
|
||||
{
|
||||
if (!me.GetVehicleKit().IsVehicleInUse() && !apply && m_HasConditions)//was used and has conditions
|
||||
@@ -350,6 +357,8 @@ namespace Game.AI
|
||||
{
|
||||
public ReactorAI(Creature c) : base(c) { }
|
||||
|
||||
public override void MoveInLineOfSight(Unit who) { }
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
|
||||
@@ -65,5 +65,7 @@ namespace Game.AI
|
||||
public class NullGameObjectAI : GameObjectAI
|
||||
{
|
||||
public NullGameObjectAI(GameObject g) : base(g) { }
|
||||
|
||||
public override void UpdateAI(uint diff) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,9 +343,6 @@ namespace Game.AI
|
||||
// Called when spell hits a target
|
||||
public override void SpellHitTarget(Unit target, SpellInfo spell) { }
|
||||
|
||||
//Called at waypoint reached or PointMovement end
|
||||
public override void MovementInform(MovementGeneratorType type, uint id) { }
|
||||
|
||||
// Called when AI is temporarily replaced or put back when possess is applied or removed
|
||||
public virtual void OnPossess(bool apply) { }
|
||||
|
||||
|
||||
@@ -1449,7 +1449,7 @@ namespace Game.AI
|
||||
break;
|
||||
|
||||
uint delay = e.Action.wpPause.delay;
|
||||
((SmartAI)me.GetAI()).PausePath(delay, e.GetEventType() == SmartEvents.WaypointReached ? false : true);
|
||||
((SmartAI)me.GetAI()).PausePath(delay, e.GetEventType() != SmartEvents.WaypointReached);
|
||||
break;
|
||||
}
|
||||
case SmartActions.WpStop:
|
||||
@@ -2695,7 +2695,7 @@ namespace Game.AI
|
||||
}
|
||||
case SmartTargets.ClosestCreature:
|
||||
{
|
||||
Creature target = baseObject.FindNearestCreature(e.Target.closest.entry, e.Target.closest.dist != 0 ? e.Target.closest.dist : 100, e.Target.closest.dead != 0 ? false : true);
|
||||
Creature target = baseObject.FindNearestCreature(e.Target.closest.entry, e.Target.closest.dist != 0 ? e.Target.closest.dist : 100, e.Target.closest.dead == 0);
|
||||
if (target)
|
||||
l.Add(target);
|
||||
break;
|
||||
@@ -3431,7 +3431,7 @@ namespace Game.AI
|
||||
}
|
||||
// min/max was checked at loading!
|
||||
e.timer = RandomHelper.URand(min, max);
|
||||
e.active = e.timer != 0 ? false : true;
|
||||
e.active = e.timer == 0;
|
||||
}
|
||||
|
||||
void UpdateTimer(SmartScriptHolder e, uint diff)
|
||||
|
||||
Reference in New Issue
Block a user