Advertisement
Guest User

WeaponType Class

a guest
Dec 6th, 2012
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1. package anonymousweaponprototype.classes;
  2.  
  3. import java.awt.geom.Point2D;
  4.  
  5. /**
  6.  *
  7.  * @author Darin Beaudreau
  8.  */
  9. public class WeaponType {
  10.     // WEAPON TYPES
  11.     public Weapon PISTOL = new Weapon("Pistol", 4, 1, 20, 1) {
  12.         @Override
  13.         public void fire(Point2D target_) {
  14.             if(this.getAmmo() > 0) {
  15.                 System.out.println("Your " + this.getName() + " fires at (" + target_.getX() + "," + target_.getY() + ") doing " + this.getRandomDamage() + " damage!");
  16.                 this.useAmmo();
  17.                 System.out.println("Ammo Left: " + this.getAmmo());
  18.             }
  19.         }
  20.     };
  21.     public Weapon FLAMETHROWER = new Weapon("Flamethrower", 8, 1, 200, 5) {
  22.         @Override
  23.         public void fire(Point2D target_) {
  24.             if(this.getAmmo() > 0) {
  25.                 System.out.println("Your " + this.getName() + " sprays toward (" + target_.getX() + "," + target_.getY() + ") doing " + this.getRandomDamage() + " damage!");
  26.                 this.useAmmo();
  27.                 System.out.println("Fuel Remaining: " + this.getAmmo());
  28.             }
  29.         }
  30.     };
  31.    
  32.     public WeaponType() {
  33.        
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement