package anonymousweaponprototype.classes; import anonymousweaponprototype.interfaces.WeaponInterface; import java.awt.geom.Point2D; import java.util.Random; /** * * @author Darin Beaudreau */ public class Weapon implements WeaponInterface { // Constant variables. // Member variables. private String name; public String getName() { return name; } private int damage; public int getDamage() { return damage; } private double speed; public double getSpeed() { return speed; } private int ammo; public int getAmmo() { return ammo; } public void useAmmo() { ammo -= ammoPerShot; } private int ammoPerShot; public int getAmmoPerShot() { return ammoPerShot; } private Random r; public int getRandomDamage() { return r.nextInt(damage)+1; } public Weapon(String name_, int damage_, double speed_, int ammo_, int ammoPerShot_) { name = name_; damage = damage_; speed = speed_; ammo = ammo_; ammoPerShot = ammoPerShot_; r = new Random(); } @Override public void fire(Point2D target_) { // Do nothing. Defined by anonymous inner classes. } }