int attract = (victim->strength() + victim->skillValue(TACTICS) / 10) / dist;
int attract = (victim->strength() + victim->skillValue(TACTICS) / 10) / (dist + 1);
static P_CHAR findBestTarget( P_NPC npc ){	int targetAttract = -1;	P_CHAR target = 0;	// Search for targets in our list of current targets first	QPtrList<cFightInfo> fights = npc->fights();	for ( cFightInfo*info = fights.first(); info; info = fights.next() )	{		P_CHAR victim = info->victim();		if ( victim == npc )		{			victim = info->attacker();		}		// We don't already attack the target, right?		if ( victim != target )		{			// See if it's a target we want			unsigned int dist = npc->dist(victim);			int attract = (victim->strength() + victim->skillValue(TACTICS) / 10) / dist;			if ( attract > targetAttract && validTarget( npc, victim, dist ) ) {				target = victim;				targetAttract = attract;			}		}	}	/*		Attack the target with the highest ((Strength + Tactics) / Distance) value.	*/		// If we're not tamed, we attack other players as well.	if ( !npc->isTamed() )	{		MapCharsIterator ri = MapObjects::instance()->listCharsInCircle( npc->pos(), VISRANGE );		for ( P_CHAR pChar = ri.first(); pChar; pChar = ri.next() )		{			// We limit ourself to players and pets owned by players.			P_PLAYER victim = dynamic_cast<P_PLAYER>( pChar );			P_NPC npcVictim = dynamic_cast<P_NPC>( pChar );			// We don't already attack the target, right?			if ( victim && victim != target )			{				// See if it's a target we want				unsigned int dist = npc->dist(victim);				int attract = (victim->strength() + victim->skillValue(TACTICS) / 10) / dist;				if ( attract > targetAttract && validTarget( npc, victim, dist ) ) {					target = victim;					targetAttract = attract;				}			}			else if ( npcVictim && npcVictim->owner() && npcVictim != target )			{				// See if it's a target we want				unsigned int dist = npc->dist(victim);				int attract = (npcVictim->strength() + npcVictim->skillValue(TACTICS) / 10) / dist;				if ( attract > targetAttract && validTarget( npc, npcVictim, dist ) ) {					target = npcVictim;					targetAttract = attract;				}			}		}	}	return target;}