us.asciiroth.client.agents
Class Targeting

java.lang.Object
  extended by us.asciiroth.client.agents.Targeting

public class Targeting
extends java.lang.Object

A parameter object that describes how an agent wants to find a target. The only reason this class is public is that Java has lame packaging mechanics.


Constructor Summary
Targeting()
          Constructor.
 
Method Summary
 Targeting attackPlayer(int range)
          Attack the player.
 Targeting dodgeBullets(int percentage)
          Avoid any cell that has a direct line-of-fire between the player and the agent.
 Targeting fleePlayer(int range)
          Run away from the player.
 Targeting keepDistance(int distance)
          Set the distance (in cells) that an agent should keep from the player.
 Targeting moveRandomly()
          Set the agent to move randomly if a target cannot be acquired.
 boolean targetsPlayerDirectly(Agent agent)
          Does this targeting specification only includes moving toward the player? If so, we can use a faster algorithm for targeting.
 Targeting trackPlayer()
          Track the player.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Targeting

public Targeting()
Constructor.

Method Detail

attackPlayer

public Targeting attackPlayer(int range)
Attack the player. This determines whether the agent will try and move toward and into the player.

Parameters:
range - the number of squares within which attack behavior applies
Returns:
Targeting

dodgeBullets

public Targeting dodgeBullets(int percentage)
Avoid any cell that has a direct line-of-fire between the player and the agent. Generally agents that shoot things need to get directly in the LOF to hit the agent, at the cost of being easier to hit by the player, while agents that approach the player to do direct damage usually don't want to walk into the LOF of the player.

Parameters:
percentage -
Returns:
Targeting

fleePlayer

public Targeting fleePlayer(int range)
Run away from the player.

Parameters:
range -
Returns:
Targeting

keepDistance

public Targeting keepDistance(int distance)
Set the distance (in cells) that an agent should keep from the player.

Parameters:
distance - the distance in cells to stay away from player
Returns:
Targeting

moveRandomly

public Targeting moveRandomly()
Set the agent to move randomly if a target cannot be acquired.

Returns:
Targeting.

targetsPlayerDirectly

public boolean targetsPlayerDirectly(Agent agent)
Does this targeting specification only includes moving toward the player? If so, we can use a faster algorithm for targeting.

Parameters:
agent -
Returns:
true if this targeting specification only includes directly moving toward the player and no other targeting strategy

trackPlayer

public Targeting trackPlayer()
Track the player. If the agent moves to within one square of a cell that the player has visited during the current load of the board, and no better target presents itself, the agent will start following the player's breadcrumb.

Returns:
Targeting

0.7

© 2009 Alx Dark