Core/Refactor: Part 3
This commit is contained in:
@@ -241,7 +241,7 @@ namespace Game.AI
|
||||
}
|
||||
public override bool CanAIAttack(Unit victim)
|
||||
{
|
||||
/// todo use one function to replace it
|
||||
// todo use one function to replace it
|
||||
if (!me.IsWithinCombatRange(me.GetVictim(), me.m_CombatDistance)
|
||||
|| (m_minRange != 0 && me.IsWithinCombatRange(me.GetVictim(), m_minRange)))
|
||||
return false;
|
||||
|
||||
@@ -546,7 +546,7 @@ namespace Game.AI
|
||||
if (me.GetVictim() && me.GetVictim() != victim)
|
||||
{
|
||||
// Check if our owner selected this target and clicked "attack"
|
||||
Unit ownerTarget = null;
|
||||
Unit ownerTarget;
|
||||
Player owner = me.GetCharmerOrOwner().ToPlayer();
|
||||
if (owner)
|
||||
ownerTarget = owner.GetSelectedUnit();
|
||||
|
||||
@@ -57,7 +57,6 @@ namespace Game.AI
|
||||
if (victim == null || !victim.isTargetableForAttack() || !me.IsWithinDistInMap(victim, max_range) ||
|
||||
me.IsFriendlyTo(victim) || !me.CanSeeOrDetect(victim))
|
||||
{
|
||||
victim = null;
|
||||
var u_check = new NearestAttackableUnitInObjectRangeCheck(me, me.GetCharmerOrOwnerOrSelf(), max_range);
|
||||
var checker = new UnitLastSearcher(me, u_check);
|
||||
Cell.VisitAllObjects(me, checker, max_range);
|
||||
|
||||
Reference in New Issue
Block a user