Skip to content

Commit

Permalink
Fixes the check
Browse files Browse the repository at this point in the history
  • Loading branch information
kamronbatman committed Jul 13, 2024
1 parent f4e7a9e commit 90f83f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Projects/UOContent/Mobiles/AI/MageAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ public override bool DoActionCombat()
m_Mobile.DebugSay("I used my abilities!");
}
}
else if (m_Mobile.Spell == null && Core.TickCount - m_NextCastTime >= 0 && m_Mobile.InRange(c, m_Mobile.RangePerception))
else if (m_Mobile.Spell == null && Core.TickCount - m_NextCastTime >= 0)
{
// We are ready to cast a spell
Spell spell;
Expand Down Expand Up @@ -816,7 +816,7 @@ public override bool DoActionCombat()
};

// Now we have a spell picked
var range = m_Mobile.RangePerception;
var range = (spell as IRangedSpell)?.TargetRange ?? m_Mobile.RangePerception;

// Move first before casting
if (!SmartAI || toDispel == null)
Expand All @@ -833,7 +833,7 @@ public override bool DoActionCombat()
}

// After running, make sure we are still in range
if (spell == null || m_Mobile.InRange(c, (spell as IRangedSpell)?.TargetRange ?? range))
if (spell == null || m_Mobile.InRange(c, range))
{
spell?.Cast();

Expand Down

0 comments on commit 90f83f7

Please sign in to comment.