Difficulty settings for sector presets
This commit is contained in:
@@ -18,47 +18,54 @@ public class SectorPresets implements ContentList{
|
||||
groundZero = new SectorPreset("groundZero", serpulo, 15){{
|
||||
alwaysUnlocked = true;
|
||||
captureWave = 10;
|
||||
difficulty = 0;
|
||||
}};
|
||||
|
||||
saltFlats = new SectorPreset("saltFlats", serpulo, 101){{
|
||||
|
||||
difficulty = 5;
|
||||
}};
|
||||
|
||||
frozenForest = new SectorPreset("frozenForest", serpulo, 86){{
|
||||
captureWave = 40;
|
||||
difficulty = 1;
|
||||
}};
|
||||
|
||||
craters = new SectorPreset("craters", serpulo, 18){{
|
||||
captureWave = 40;
|
||||
difficulty = 2;
|
||||
}};
|
||||
|
||||
ruinousShores = new SectorPreset("ruinousShores", serpulo, 19){{
|
||||
captureWave = 40;
|
||||
difficulty = 3;
|
||||
}};
|
||||
|
||||
stainedMountains = new SectorPreset("stainedMountains", serpulo, 20){{
|
||||
captureWave = 30;
|
||||
difficulty = 2;
|
||||
}};
|
||||
|
||||
fungalPass = new SectorPreset("fungalPass", serpulo, 21){{
|
||||
|
||||
difficulty = 4;
|
||||
}};
|
||||
|
||||
overgrowth = new SectorPreset("overgrowth", serpulo, 22){{
|
||||
|
||||
difficulty = 5;
|
||||
}};
|
||||
|
||||
tarFields = new SectorPreset("tarFields", serpulo, 23){{
|
||||
captureWave = 40;
|
||||
difficulty = 5;
|
||||
}};
|
||||
|
||||
desolateRift = new SectorPreset("desolateRift", serpulo, 123){{
|
||||
captureWave = 40;
|
||||
difficulty = 8;
|
||||
}};
|
||||
|
||||
|
||||
nuclearComplex = new SectorPreset("nuclearComplex", serpulo, 130){{
|
||||
captureWave = 60;
|
||||
difficulty = 7;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -185,7 +185,7 @@ public class Planet extends UnlockableContent{
|
||||
sum += 2f;
|
||||
}
|
||||
|
||||
sector.baseCoverage = Mathf.clamp(sum / 5f);
|
||||
sector.baseCoverage = sector.preset == null ? Mathf.clamp(sum / 5f) : Mathf.clamp(sector.preset.difficulty / 10f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ public class SectorPreset extends UnlockableContent{
|
||||
|
||||
public int captureWave = 0;
|
||||
public Cons<Rules> rules = rules -> rules.winWave = captureWave;
|
||||
/** Difficulty, 0-10. */
|
||||
public float difficulty;
|
||||
|
||||
public SectorPreset(String name, Planet planet, int sector){
|
||||
super(name);
|
||||
|
||||
Reference in New Issue
Block a user