public virtual bool DoOrderAttack()
{
if (m_Mobile.IsDeadPet)
return true;
if (m_Mobile.ControlTarget == null || m_Mobile.ControlTarget.Deleted || m_Mobile.ControlTarget.Map != m_Mobile.Map || !m_Mobile.ControlTarget.Alive || m_Mobile.ControlTarget.IsDeadBondedPet)
{
m_Mobile.DebugSay("I think he might be dead. He's not anywhere around here at least. That's cool. I'm glad he's dead.");
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.None;
if (m_Mobile.FightMode == FightMode.Closest || m_Mobile.FightMode == FightMode.Aggressor)
{
Mobile newCombatant = null;
double newScore = 0.0;
foreach (Mobile aggr in m_Mobile.GetMobilesInRange(m_Mobile.RangePerception))
{
if (!m_Mobile.CanSee(aggr) || aggr.Combatant != m_Mobile)
continue;
if (aggr.IsDeadBondedPet || !aggr.Alive)
continue;
double aggrScore = m_Mobile.GetFightModeRanking(aggr, FightMode.Closest, false);
if ((newCombatant == null || aggrScore > newScore) && m_Mobile.InLOS(aggr))
{
newCombatant = aggr;
newScore = aggrScore;
}
}
if (newCombatant != null)
{
m_Mobile.ControlTarget = newCombatant;
m_Mobile.ControlOrder = OrderType.Attack;
m_Mobile.Combatant = newCombatant;
m_Mobile.DebugSay("But -that- is not dead. Here we go again...");
Think();
}
}
}
else
{
m_Mobile.DebugSay("Attacking target...");
Think();
}
return true;
}