javoids
Class Weapon

java.lang.Object
  extended by javoids.Item
      extended by javoids.Weapon
All Implemented Interfaces:
java.io.Serializable

public class Weapon
extends Item

A class to represent a game weapon.

Author:
mallette
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javoids.Item
Item.Direction, Item.Type
 
Field Summary
private  ImageMap.Name bulletImage
          the weapon's regular image
private  int damage
          the weapon damage per bullet
private  int directions
          the number of directions the weapon fires
private  int fired
          the number of bullets fired
private  ImageMap.Name homingImage
          the homing image (for display in the panel)
private  int homings
          the number of hoing bullets the weapon has
private  int maximumFired
          the maximum number of times the weapon can be fired
private  int range
          the range of the weapon
private static long serialVersionUID
          This is the version used for serializing/deserializing (storing/retrieving) this object
private  ImageMap.Name shieldedHomingImage
          the shielded homing image (for display in the panel)
private  ImageMap.Name shieldedImage
          the shielded image (for display in the panel)
private  int shields
          the number of sheidled bullets the weapon has
private  int velocity
          the velocity of the bullets fired from this weapon
 
Constructor Summary
Weapon()
          Constructor (default)
Weapon(Weapon weapon)
          Constructor (copy)
 
Method Summary
 ImageMap.Name getBulletImage()
           
 int getDamage()
           
 int getDirections()
           
 int getFired()
           
 ImageMap.Name getHomingImage()
           
 int getHomings()
           
 ImageMap.Name getImage()
           
 int getMaximumFired()
           
 int getRange()
           
 ImageMap.Name getShieldedHomingImage()
           
 ImageMap.Name getShieldedImage()
           
 int getShields()
           
 int getVelocity()
           
 void modifyFired(int _count)
           
 void modifyHomings(int _count)
           
 void modifyShields(int _count)
           
 void reset()
          Reset the item properties to the default values.
 void setBulletImage(ImageMap.Name _bulletImage)
           
 void setDamage(int _damage)
           
 void setDirections(int _directions)
           
 void setFired(int _fired)
           
 void setHomingImage(ImageMap.Name _homingImage)
           
 void setHomings(int _homings)
           
 void setMaximumFired(int _maximumFired)
           
 void setRange(int _range)
           
 void setShieldedHomingImage(ImageMap.Name _shieldedHomingImage)
           
 void setShieldedImage(ImageMap.Name _shieldedImage)
           
 void setShields(int _shields)
           
 void setType(Item.Type _type)
           
 void setVelocity(int _velocity)
           
 java.lang.String toString()
          Provide a String representation of this object.
 
Methods inherited from class javoids.Item
cycleWeapon, getCount, getDefaultCount, getDefaultImage, getMaximumCount, getName, getSize, getSound, getType, isLimitless, isWeapon, isWeapon, modifyCount, setCount, setDefaultCount, setDefaultImage, setImage, setItem, setLimitless, setMaximumCount, setName, setSize, setSound, setWeapon
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
This is the version used for serializing/deserializing (storing/retrieving) this object

See Also:
Constant Field Values

bulletImage

private ImageMap.Name bulletImage
the weapon's regular image


shieldedImage

private ImageMap.Name shieldedImage
the shielded image (for display in the panel)


homingImage

private ImageMap.Name homingImage
the homing image (for display in the panel)


shieldedHomingImage

private ImageMap.Name shieldedHomingImage
the shielded homing image (for display in the panel)


damage

private int damage
the weapon damage per bullet


maximumFired

private int maximumFired
the maximum number of times the weapon can be fired


range

private int range
the range of the weapon


velocity

private int velocity
the velocity of the bullets fired from this weapon


directions

private int directions
the number of directions the weapon fires


shields

private int shields
the number of sheidled bullets the weapon has


homings

private int homings
the number of hoing bullets the weapon has


fired

private int fired
the number of bullets fired

Constructor Detail

Weapon

public Weapon()
Constructor (default)


Weapon

public Weapon(Weapon weapon)
Constructor (copy)

Parameters:
weapon - the wepon to be copied
Method Detail

getBulletImage

public ImageMap.Name getBulletImage()
Returns:
the bullet's image

getShieldedImage

public ImageMap.Name getShieldedImage()
Returns:
the bullet's shielded image

getHomingImage

public ImageMap.Name getHomingImage()
Returns:
the homing image

getShieldedHomingImage

public ImageMap.Name getShieldedHomingImage()
Returns:
the shielded homing image

getDamage

public int getDamage()
Returns:
the base damage this weapon causes per hit

getMaximumFired

public int getMaximumFired()
Returns:
the maximum number of times it can be fired before needing to pause

getRange

public int getRange()
Returns:
the weapon's range

getVelocity

public int getVelocity()
Returns:
the bullet's velocity

getDirections

public int getDirections()
Returns:
the number of directions the weapon fires in

getShields

public int getShields()
Returns:
the number of bullets that will fire with a shield on them

getHomings

public int getHomings()
Returns:
the number of bullets that will fire with the homing property

getFired

public int getFired()
Returns:
the number of times this weapon has been fired already (resets after bullets die)

getImage

public ImageMap.Name getImage()
Overrides:
getImage in class Item
Returns:
the name of the item (weapon name in this case)

setType

public void setType(Item.Type _type)
Overrides:
setType in class Item
Parameters:
_type - the item name

setBulletImage

public void setBulletImage(ImageMap.Name _bulletImage)
Parameters:
_bulletImage - the image to give this weapon's bullets

setShieldedImage

public void setShieldedImage(ImageMap.Name _shieldedImage)
Parameters:
_shieldedImage - the image to give this weapon's shielded bullets (or to use in the toolbar)

setHomingImage

public void setHomingImage(ImageMap.Name _homingImage)
Parameters:
_homingImage - the image to give this weapon's homing bullets (or to use in the toolbar)

setShieldedHomingImage

public void setShieldedHomingImage(ImageMap.Name _shieldedHomingImage)
Parameters:
_shieldedHomingImage - the image to give this weapon's shielded homing bullets (or to use in the toolbar)

setDamage

public void setDamage(int _damage)
Parameters:
_damage - the base damage to inflict per hit

setMaximumFired

public void setMaximumFired(int _maximumFired)
Parameters:
_maximumFired - the maximum number of times the weapon can be fired before needing to paused

setRange

public void setRange(int _range)
Parameters:
_range - the range the fired bullets can travel

setVelocity

public void setVelocity(int _velocity)
Parameters:
_velocity - the bullet velocity

setDirections

public void setDirections(int _directions)
Parameters:
_directions - the number of directions to shoot in

setShields

public void setShields(int _shields)
Parameters:
_shields - the number of shots that will be shielded

setHomings

public void setHomings(int _homings)
Parameters:
_homings - the number of shots that will be homing

setFired

public void setFired(int _fired)
Parameters:
_fired - the number of shots that can be fired at once

reset

public void reset()
Reset the item properties to the default values.

Overrides:
reset in class Item

modifyShields

public void modifyShields(int _count)
Parameters:
_count - the additional number of shots that will be shielded

modifyHomings

public void modifyHomings(int _count)
Parameters:
_count - the additional number of shots that will be homing

modifyFired

public void modifyFired(int _count)
Parameters:
_count - the additional number of shots that were fired

toString

public java.lang.String toString()
Provide a String representation of this object.

Overrides:
toString in class Item
Returns:
String A representation of the object for debugging.