Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

WeaponType Class

By: a guest on Dec 6th, 2012  |  syntax: Java  |  size: 1.16 KB  |  views: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data