package ei.game.scene.map;

import ei.engine.math.Vector2f;
import ei.engine.math.Vector2i;
import ei.engine.scene.Entity;
import ei.engine.scene.Sprite;
import ei.game.player.Player;
import ei.game.scene.SelectBox;
import ei.game.scene.buildings.Building;
import ei.game.scene.weapons.Explotion;
import ei.game.scene.weapons.WeaponHandler;

public class Prison extends Building{
	private static final String[] img = {
		"data/buildings/prison/prison.png"
	};
	private SelectBox selectionBox;
	private Sprite prison;

	public Prison(Vector2i pos, Player p) {
		super(2000, pos, p, 6);
	}

	public void initGraphics(){
		prison = new Sprite("Prison",img[(int)(Math.random()*img.length)]);
		prison.setSize(new Vector2f(300,300));
		getNode().add(prison);
		
		selectionBox = new SelectBox(0,300,300,getMaxLife());
	}
	
	@Override
	public Entity getSprite() {
		return prison;
	}

	@Override
	public int getMaintenanceCost() {
		return 0;
	}

	@Override
	public Entity getGroundSprite() {
		return null;
	}

	@Override
	public void attack(Vector2i target, boolean play) {
		
	}

	@Override
	public void destroyed() {
		WeaponHandler.getInstance().addWeapon(new Explotion(new Vector2f(getNode().getLocation().getX(), getNode().getLocation().getY())));	
	}

	@Override
	protected SelectBox getSelection() {
		return selectionBox;
	}
	
	public boolean isTerrain(){
		return true;
	}
	
}
