AvatarsConquest/Scripts/Quests/QuestFunctions.cs

30 lines
No EOL
671 B
C#

using System;
using Server;
using Server.Items;
using Server.Mobiles;
namespace Server.Misc
{
class QuestFunctions
{
public static bool MonstersNearby( Mobile m )
{
bool inCombat = ( m.Combatant != null && m.InRange( m.Combatant.Location, 20 ) && m.Combatant.InLOS( m ) );
int monsters = 0;
foreach ( Mobile monster in m.GetMobilesInRange( 8 ) )
{
if ( monster is BaseCreature && !(((BaseCreature)monster).GetMaster() is PlayerMobile) )
monsters++;
}
if ( monsters > 0 || inCombat )
{
m.SendMessage( "You cannot do that with enemies nearby!" );
return true;
}
return false;
}
}
}