Difficulty settings for sector presets
This commit is contained in:
@@ -248,6 +248,11 @@ public class DefaultWaves{
|
||||
|
||||
//TODO move elsewhere
|
||||
public static Seq<SpawnGroup> generate(float difficulty){
|
||||
return generate(new Rand(), difficulty);
|
||||
}
|
||||
|
||||
//TODO move elsewhere
|
||||
public static Seq<SpawnGroup> generate(Rand rand, float difficulty){
|
||||
UnitType[][] species = {
|
||||
{dagger, mace, fortress, scepter, reign},
|
||||
{nova, pulsar, quasar, vela, corvus},
|
||||
@@ -263,7 +268,7 @@ public class DefaultWaves{
|
||||
Seq<SpawnGroup> out = new Seq<>();
|
||||
|
||||
//max reasonable wave, after which everything gets boring
|
||||
int cap = 200;
|
||||
int cap = 150;
|
||||
|
||||
float shieldStart = 30, shieldsPerWave = 20 + difficulty*30f;
|
||||
|
||||
@@ -274,18 +279,18 @@ public class DefaultWaves{
|
||||
|
||||
for(int i = start; i < cap;){
|
||||
int f = i;
|
||||
int next = Mathf.random(8, 16);
|
||||
int next = rand.random(8, 16);
|
||||
|
||||
float shieldAmount = Math.max((i - shieldStart) * shieldsPerWave, 0);
|
||||
int space = start == 0 ? 1 : Mathf.random(1, 2);
|
||||
int space = start == 0 ? 1 : rand.random(1, 2);
|
||||
|
||||
//main progression
|
||||
out.add(new SpawnGroup(curSpecies[Math.min(curTier, curSpecies.length - 1)]){{
|
||||
unitAmount = f == 0 ? 1 : 10;
|
||||
begin = f;
|
||||
end = f + next >= cap ? never : f + next;
|
||||
max = 20;
|
||||
unitScaling = Mathf.random(1f, 2f);
|
||||
max = 14;
|
||||
unitScaling = rand.random(1f, 2f);
|
||||
shields = shieldAmount;
|
||||
shieldScaling = shieldsPerWave;
|
||||
spacing = space;
|
||||
@@ -295,16 +300,16 @@ public class DefaultWaves{
|
||||
out.add(new SpawnGroup(curSpecies[Math.min(curTier, curSpecies.length - 1)]){{
|
||||
unitAmount = 6;
|
||||
begin = f + next;
|
||||
end = f + next + Mathf.random(8, 12);
|
||||
max = 14;
|
||||
unitScaling = Mathf.random(2f);
|
||||
spacing = Mathf.random(2, 3);
|
||||
end = f + next + rand.random(8, 12);
|
||||
max = 11;
|
||||
unitScaling = rand.random(2f);
|
||||
spacing = rand.random(2, 3);
|
||||
shields = shieldAmount;
|
||||
shieldScaling = shieldsPerWave;
|
||||
}});
|
||||
|
||||
i += next;
|
||||
if(curTier < 3 || Mathf.chance(0.2)){
|
||||
if(curTier < 3 || rand.chance(0.2)){
|
||||
curTier ++;
|
||||
}
|
||||
|
||||
@@ -312,7 +317,7 @@ public class DefaultWaves{
|
||||
curTier = Math.min(curTier, 3);
|
||||
|
||||
//small chance to switch species
|
||||
if(Mathf.chance(0.3)){
|
||||
if(rand.chance(0.3)){
|
||||
curSpecies = Structs.random(species);
|
||||
}
|
||||
}
|
||||
@@ -320,15 +325,15 @@ public class DefaultWaves{
|
||||
|
||||
createProgression.get(0);
|
||||
|
||||
int step = 5 + Mathf.random(3);
|
||||
int step = 5 + rand.random(3);
|
||||
|
||||
while(step <= cap){
|
||||
createProgression.get(step);
|
||||
step += (int)(Mathf.random(12, 25) * Mathf.lerp(1f, 0.4f, difficulty));
|
||||
step += (int)(rand.random(12, 25) * Mathf.lerp(1f, 0.4f, difficulty));
|
||||
}
|
||||
|
||||
int bossWave = (int)(Mathf.random(30, 60) * Mathf.lerp(1f, 0.7f, difficulty));
|
||||
int bossSpacing = (int)(Mathf.random(25, 40) * Mathf.lerp(1f, 0.6f, difficulty));
|
||||
int bossWave = (int)(rand.random(30, 60) * Mathf.lerp(1f, 0.7f, difficulty));
|
||||
int bossSpacing = (int)(rand.random(25, 40) * Mathf.lerp(1f, 0.6f, difficulty));
|
||||
|
||||
//main boss progression
|
||||
out.add(new SpawnGroup(Structs.random(species)[4]){{
|
||||
@@ -339,17 +344,45 @@ public class DefaultWaves{
|
||||
max = 16;
|
||||
unitScaling = bossSpacing;
|
||||
shieldScaling = shieldsPerWave;
|
||||
effect = StatusEffects.boss;
|
||||
}});
|
||||
|
||||
//alt boss progression
|
||||
out.add(new SpawnGroup(Structs.random(species)[4]){{
|
||||
unitAmount = 1;
|
||||
begin = bossWave + Mathf.random(3, 5) * bossSpacing;
|
||||
begin = bossWave + rand.random(3, 5) * bossSpacing;
|
||||
spacing = bossSpacing;
|
||||
end = never;
|
||||
max = 16;
|
||||
unitScaling = bossSpacing;
|
||||
shieldScaling = shieldsPerWave;
|
||||
effect = StatusEffects.boss;
|
||||
}});
|
||||
|
||||
int finalBossStart = 120 + rand.random(30);
|
||||
|
||||
//final boss waves
|
||||
out.add(new SpawnGroup(Structs.random(species)[4]){{
|
||||
unitAmount = 1;
|
||||
begin = finalBossStart;
|
||||
spacing = bossSpacing/2;
|
||||
end = never;
|
||||
unitScaling = bossSpacing;
|
||||
shields = 500;
|
||||
shieldScaling = shieldsPerWave * 4;
|
||||
effect = StatusEffects.boss;
|
||||
}});
|
||||
|
||||
//final boss waves (alt)
|
||||
out.add(new SpawnGroup(Structs.random(species)[4]){{
|
||||
unitAmount = 1;
|
||||
begin = finalBossStart + 15;
|
||||
spacing = bossSpacing/2;
|
||||
end = never;
|
||||
unitScaling = bossSpacing;
|
||||
shields = 500;
|
||||
shieldScaling = shieldsPerWave * 4;
|
||||
effect = StatusEffects.boss;
|
||||
}});
|
||||
|
||||
//shift back waves on higher difficulty for a harder start
|
||||
|
||||
Reference in New Issue
Block a user