import java.awt.Color;

public class Panzer extends ComputerTank {
	private boolean inTurn;

	public Panzer() {
		inTurn = false;
		this.hp = 4;
		this.speed = 150;
		this.orient = Direction.NORTH;
		this.gun = new BlitzGun(2, 100);
		this.iq = 15;
		this.pts = 40;
		this.xps = 25;
	}
	
	public void shoot(){
		//Modifies: Blitzer object
		//Effects: create a Blitzer object and shoots it in the current orient Direction.
			synchronized(getGrid()){
				int newx = getX()+orient.easterlyDirection();
				int newy = getY()-orient.northerlyDirection();
				SimObject so = getGrid().getObjectAt(newx,newy);
				if(so instanceof Tank){
					((Tank)so).decreaseHP(gun.getDamage());
				} else {
					Shell bullet = gun.getBullet(orient);
					try{
						getGrid().setObjectAt(newx,newy,bullet);
						bullet.init(newx,newy,getGrid());
						bullet.resumeObject();
					}catch(BadLocationException e){
						System.err.println("BadLocation for shell");
					}
				}
			}
	}

	public Color getColor() {
		if (inTurn) {
			return Color.white;
		} else {
			return Color.green;
		}

	}
}