* Need to use a real creature, because the
* creature needs to be offensive to see the
* targets.
*/
final Creature creature = SingletonRepository.getEntityManager().getCreature("rat");
final Creature scrollCreature = new AttackableCreature(SingletonRepository.getEntityManager().getCreature("rat"));
Player veteran = PlayerTestHelper.createPlayer("veteran");
StendhalRPZone arena = new StendhalRPZone("arena");
arena.add(creature);
assertFalse("is not attacking", strat.hasValidTarget(creature));
arena.add(veteran);
arena.add(scrollCreature);
veteran.addXP(10000);
assertTrue("sanity check for enemy levels", veteran.getLevel() > scrollCreature.getLevel());
creature.setPosition(3, 3);
scrollCreature.setPosition(2, 4);
// Should pick the nearest: scrollCreature
strat.findNewTarget(creature);
assertTrue("has a valid target", strat.hasValidTarget(creature));
assertEquals("attack nearest", scrollCreature, creature.getAttackTarget());