package project;

public class RocketLauncher extends Weapon {
  
  private boolean print;  //prevents printing message in a loop
  
  public RocketLauncher (Player1 p, int x, int y) {
    super(p, x, y, RocketAttackPower, RocketShots);
    player = p;
	print = false;
  } //constructor Shotgun
  
  public void Fire() throws NoShotException {
    if (Shots>0) 
	  Shots--;
	else
	  throw new NoShotException();
  } //method Fire
  
  public void update() {
    if (SameLocation(player) && Active) {
      Encounter();
      player.get(this);    	
	} //if
	else if (player.weapon instanceof RocketLauncher) player.weapon = null;
	else print = false;
  } //method update
  
  public void getPickedUp(ItemEncounter i) {
    text.println ("You've picked up a RocketLauncher!");
	Disable();
  } //method getPickedUp
  
  public void Encounter() { 
    if (!print) {
      text.println ("You've kicked on something....");
	  text.println ("It seems like a healvy item...");
      print = true;
	} //if
  } //method Encounter
  
} //class RocketLauncher
	  
  
  
    