package edu.stuy.starlorn.util;

import edu.stuy.starlorn.world.Path;
import edu.stuy.starlorn.world.Wave;
import edu.stuy.starlorn.world.Level;
import edu.stuy.starlorn.entities.EnemyShip;

public class Generator {
    public static Path generatePath(int numPoints) {
        Path p = new Path();
        int screenWidth = 100;
        int screenHeight = 100;
        for (int i = 0; i < numPoints; i++) {
            int x = (int) (Math.random() * screenWidth);
            int y = (int) (Math.random() * screenHeight);
            p.addCoords(x, y);
        }
        return p;
    }

    public static Path generatePath() {
        return generatePath(10);
    }

    public static EnemyShip generateEnemy() {
        EnemyShip enemy = new EnemyShip();
        Path path = generatePath();
        int damage = (int) (Math.random() * 4); 
        int shotSpeed = (int) (Math.random() * 4);
        int health = (int) (Math.random() * 20);
        int cooldown = (int) (Math.random() * 20);
        int cooldownRate = (int) (Math.random() * 5);
        int movementSpeed = (int) (Math.random() * 4);
        enemy.setPath(path);
        enemy.setBaseDamage(damage);
        enemy.setBaseShotSpeed(shotSpeed);
        enemy.setMaxHealth(health);
        enemy.setCooldown(cooldown);
        enemy.setCooldownRate(cooldownRate);
        enemy.setMovementSpeed(movementSpeed);
        return enemy;
    }
}

@@ -683,32 +683,832 @@
 tic 
-EnemyShip generateEnemy(
+Wave generateWave(int dificulty) %7B%0A        Wave wave = new Wave();%0A        int numEnemies = (int) (Math.random() * dificulty * dificulty);%0A        EnemyShip enemyType = generateEnemy(dificulty);%0A        Path path = generatePath();%0A        wave.setPath(path);%0A        wave.setEnemyType(enemyType);%0A        wave.setNumEnemies(numEnemies);%0A        return wave;%0A    %7D%0A%0A    public static Wave generateWave() %7B%0A        return generateWave(1);%0A    %7D%0A%0A    public static Level generateLevel(int numWaves, int dificulty) %7B%0A        Level level = new Level();%0A        for (int i = 0; i %3C numWaves; i++) %7B%0A            level.addWave(generateWave(dificulty));%0A        %7D%0A        return level;%0A    %7D%0A%0A    public static Level generateLevel() %7B%0A        return generateLevel(1, 1);%0A    %7D%0A%0A    public static EnemyShip generateEnemy(int dificulty
 ) %7B%0A
@@ -1575,32 +1575,45 @@
  = generatePath(
+dificulty + 5
 );%0A        int d
@@ -1643,17 +1643,25 @@
 dom() * 
-4
+dificulty
 ); %0A    
@@ -1695,33 +1695,41 @@
 Math.random() * 
-4
+dificulty
 );%0A        int h
@@ -1751,33 +1751,45 @@
 Math.random() * 
-2
+dificulty * 1
 0);%0A        int 
@@ -1826,10 +1826,29 @@
 ) * 
-20
+(100 / dificulty) + 5
 );%0A 
@@ -1896,19 +1896,83 @@
 dom() * 
-5);
+Math.log(dificulty)); // increase the cooldown rate logarithmically
 %0A       
@@ -2019,9 +2019,17 @@
 ) * 
-4
+dificulty
 );%0A 
@@ -2328,11 +2328,97 @@
 y;%0A    %7D
+%0A%0A    public static EnemyShip generateEnemy() %7B%0A        return generateEnemy(1);%0A    %7D
 %0A%7D%0A

Allow for dificulty input in generators