package enemis;
import com.badlogic.gdx.math.Rectangle;
import com.jln.ld.GameAnimation;
import com.jln.ld.GameEntity;
import com.jln.ld.Shared;

import MapItem.Powerup;
import menus.GameMenu;
import shoot.BasicShoot;
import shoot.DestroyerShoot;
import shoot.HunterShoot;

public class MegaDestroyer extends Destroyer{

	@Override
	protected void initShip(){
		this.x = (float)(Math.random()*(1500)+Shared.GAME_WIDTH);
		this.y = (float)(Math.random()*320)+25;

		this.type = TYPE_04;
		initRandomTarget();
		destroy = false;
		this.collision = new Rectangle(x-10,y-35,20,70);
		maxSpeed = (float) ((Math.random()) + 1f);
		this.speed = maxSpeed;
		this.cptPause = 0;
		regions = Shared.SHIP_MEGA_DESTROYER;
		size = 96;
		life = 16;
	} 
	
	protected void giveBonus(GameMenu game){
		game.incPointsWithMessage(Shared.POINTS_MEGA_DESTROYER, x, y);
		game.getPowerups().add(new Powerup(x, y, Powerup.POWERUP_SHIELD,game));
	}
	
	protected void shoot(GameMenu game){
		Double r = Math.random();
		if(r<0.33){
			game.addEnemyShoot(new DestroyerShoot(x-20, y, -3.4f,0f ));
			game.addEnemyShoot(new DestroyerShoot(x-16, y+16, -3.4f, 0f));
			game.addEnemyShoot(new DestroyerShoot(x-16, y-16, -3.4f, -0f));
		}else if(r<0.5){
			game.addEnemyShoot(new DestroyerShoot(x-20, y, -3.4f,0f ));
			game.addEnemyShoot(new DestroyerShoot(x-16, y+16, -3.4f, 0f));
			game.addEnemyShoot(new DestroyerShoot(x-16, y-16, -3.4f, -0f));
			
			game.addEnemyShoot(new DestroyerShoot(x-12, y+24, -2.7f, 0.7f));
			game.addEnemyShoot(new DestroyerShoot(x-12, y-24, -2.7f, -0.7f));
		}else if(r<0.75){
			game.addEnemyShoot(new DestroyerShoot(x-16, y+16, -3.4f, 0f));
			game.addEnemyShoot(new DestroyerShoot(x-16, y-16, -3.4f, -0f));
		}else if(r<0.9){
			game.addEnemyShoot(new DestroyerShoot(x-20, y, -3.8f,0f ));
		}else{
			game.addEnemyShoot(new DestroyerShoot(x-16, y+16, -3.8f, 0.4f));
			game.addEnemyShoot(new DestroyerShoot(x-16, y-16, -3.8f, -0.4f));
		}
		
		playShootSound();
	}
}
