group1.model.gameobject.enemy
Class Enemy

java.lang.Object
  extended by group1.model.gameobject.GameObj
      extended by group1.model.gameobject.LivingObj
          extended by group1.model.gameobject.enemy.Enemy

public class Enemy
extends LivingObj

Enemy is a living enemy in the game. Unlike Jeff, who moves based on user input, an Enemy moves based on its own personal desires determined by a random value generator.


Field Summary
static int ATTACK_PROBABILITY_DENOMINATOR
          The probability that this Enemy will attack at a particular time step is ATTACK_PROBABILITY_NUMERATOR out of ATTACK_PROBABILITY_DENOMINATOR.
static int ATTACK_PROBABILITY_NUMERATOR
          The probability that this Enemy will attack at a particular time step is ATTACK_PROBABILITY_NUMERATOR out of ATTACK_PROBABILITY_DENOMINATOR.
static int CHANGE_WEAPON_PROBABILITY_DENOMINATOR
          The probability that this Enemy will change weapons at a particular time step is CHANGE_WEAPON_PROBABILITY_NUMERATOR out of CHANGE_WEAPON_PROBABILITY_DENOMINATOR.
static int CHANGE_WEAPON_PROBABILITY_NUMERATOR
          The probability that this Enemy will change weapons at a particular time step is CHANGE_WEAPON_PROBABILITY_NUMERATOR out of CHANGE_WEAPON_PROBABILITY_DENOMINATOR.
static double DEFAULT_ATTACK_POWER
          The default attack power.
static double DEFAULT_PROJECTILE_SPEED
          The default speed of projectiles created by this Enemy.
static double DEFAULT_WALK_SPEED
          The default walk speed.
static double MAX_WALK_SPEED
          The maximum walking speed.
static int STARTING_HP
          Enemy's starting maximum hit points.
static double WALK_ACCELERATION
          The acceleration while walking.
 
Fields inherited from class group1.model.gameobject.LivingObj
contactDamageMultiplier, curr_hp, fireDamageMultiplier, katanaDamageMultiplier, laserDamageMultiplier, max_hp, tomahawkDamageMultiplier, VALID_WEAPON_CODES
 
Fields inherited from class group1.model.gameobject.GameObj
acceleration, ENEMY_TEAM, GRID_SPACE_SIZE, id, isMovable, JEFF_TEAM, NO_TEAM, regions, shape, velocity
 
Constructor Summary
Enemy()
          Default constructor.
Enemy(double x, double y, PictureList p)
          Constructor.
 
Method Summary
 java.util.Random getRandomGenerator()
          Returns the random value generator that this Enemy is using.
 XYPair move(Environment env)
          Movement function that should be called by the Environment at each time click.
 void setRandomGenerator(java.util.Random newGenerator)
          Set this Enemy object to use another random value generator.
 
Methods inherited from class group1.model.gameobject.LivingObj
changeWeapon, die, getCurrentWeapon, getCurrHP, getMaxHP, hasFireball, hasKatana, hasLaser, hasTomahawk, hasWeapon, hasWeaponIndex, takeDamage
 
Methods inherited from class group1.model.gameobject.GameObj
addRegion, addRegion, equals, getAcceleration, getAccelerationX, getAccelerationY, getFilm, getFilm, getHeight, getID, getNumRegions, getPictureList, getPosition, getPositionX, getPositionY, getRectangle, getRegion, getState, getTeam, getVelocity, getVelocityX, getVelocityY, getWidth, intersectRegions, isMovable, isSameState, makeRegions, makeSolid, makeSolidTop, setAcceleration, setAcceleration, setAccelerationX, setAccelerationY, setID, setPictureList, setPosition, setPosition, setPositionX, setPositionY, setRectangle, setSize, setState, setTeam, setVelocity, setVelocity, setVelocityX, setVelocityY, stopHorizontal, stopVertical
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STARTING_HP

public static final int STARTING_HP
Enemy's starting maximum hit points. The maximum number of hit points may change over the course of the game.

See Also:
Constant Field Values

ATTACK_PROBABILITY_NUMERATOR

public static final int ATTACK_PROBABILITY_NUMERATOR
The probability that this Enemy will attack at a particular time step is ATTACK_PROBABILITY_NUMERATOR out of ATTACK_PROBABILITY_DENOMINATOR.

See Also:
Constant Field Values

ATTACK_PROBABILITY_DENOMINATOR

public static final int ATTACK_PROBABILITY_DENOMINATOR
The probability that this Enemy will attack at a particular time step is ATTACK_PROBABILITY_NUMERATOR out of ATTACK_PROBABILITY_DENOMINATOR.

See Also:
Constant Field Values

CHANGE_WEAPON_PROBABILITY_NUMERATOR

public static final int CHANGE_WEAPON_PROBABILITY_NUMERATOR
The probability that this Enemy will change weapons at a particular time step is CHANGE_WEAPON_PROBABILITY_NUMERATOR out of CHANGE_WEAPON_PROBABILITY_DENOMINATOR.

See Also:
Constant Field Values

CHANGE_WEAPON_PROBABILITY_DENOMINATOR

public static final int CHANGE_WEAPON_PROBABILITY_DENOMINATOR
The probability that this Enemy will change weapons at a particular time step is CHANGE_WEAPON_PROBABILITY_NUMERATOR out of CHANGE_WEAPON_PROBABILITY_DENOMINATOR.

See Also:
Constant Field Values

MAX_WALK_SPEED

public static final double MAX_WALK_SPEED
The maximum walking speed.

See Also:
Constant Field Values

WALK_ACCELERATION

public static final double WALK_ACCELERATION
The acceleration while walking.

See Also:
Constant Field Values

DEFAULT_WALK_SPEED

public static final double DEFAULT_WALK_SPEED
The default walk speed. Can be either changed here or overridden.

See Also:
Constant Field Values

DEFAULT_ATTACK_POWER

public static final double DEFAULT_ATTACK_POWER
The default attack power. Can be either changed here or overridden.

See Also:
Constant Field Values

DEFAULT_PROJECTILE_SPEED

public static final double DEFAULT_PROJECTILE_SPEED
The default speed of projectiles created by this Enemy. Can be either changed here or overridden.

See Also:
Constant Field Values
Constructor Detail

Enemy

public Enemy(double x,
             double y,
             PictureList p)
Constructor.

Parameters:
x - The x-coordinate of the position.
y - The y-coordinate of the position.

Enemy

public Enemy()
Default constructor.

Method Detail

getRandomGenerator

public java.util.Random getRandomGenerator()
Returns the random value generator that this Enemy is using.


setRandomGenerator

public void setRandomGenerator(java.util.Random newGenerator)
Set this Enemy object to use another random value generator. For best results, construct ONE random value generator for the whole program and set ALL Enemy's to use it. But the default behavior of each Enemy using its own personal random generator also works.


move

public XYPair move(Environment env)
Movement function that should be called by the Environment at each time click.

Specified by:
move in class GameObj
Parameters:
env - The environment that this object is moving in.
Returns:
Guess of velocity.