New waves for sectors, quite possibly broken

This commit is contained in:
Anuken
2020-10-08 19:33:54 -04:00
parent 68f11df55d
commit e2b58528d0
2 changed files with 57 additions and 41 deletions

View File

@@ -1,5 +1,6 @@
package mindustry.game; package mindustry.game;
import arc.func.*;
import arc.math.*; import arc.math.*;
import arc.struct.*; import arc.struct.*;
import arc.util.*; import arc.util.*;
@@ -58,6 +59,7 @@ public class DefaultWaves{
unitScaling = 1; unitScaling = 1;
unitAmount = 4; unitAmount = 4;
spacing = 2; spacing = 2;
shieldScaling = 10f;
}}, }},
new SpawnGroup(mace){{ new SpawnGroup(mace){{
@@ -65,6 +67,7 @@ public class DefaultWaves{
spacing = 3; spacing = 3;
unitScaling = 1; unitScaling = 1;
end = 40; end = 40;
shieldScaling = 20f;
}}, }},
new SpawnGroup(mace){{ new SpawnGroup(mace){{
@@ -86,6 +89,7 @@ public class DefaultWaves{
begin = 16; begin = 16;
unitScaling = 1; unitScaling = 1;
spacing = 2; spacing = 2;
shieldScaling = 20f;
}}, }},
new SpawnGroup(dagger){{ new SpawnGroup(dagger){{
@@ -200,7 +204,7 @@ public class DefaultWaves{
} }
//TODO move elsewhere //TODO move elsewhere
public static Seq<SpawnGroup> generate(){ public static Seq<SpawnGroup> generate(float difficulty){
UnitType[][] species = { UnitType[][] species = {
{dagger, mace, fortress, scepter, reign}, {dagger, mace, fortress, scepter, reign},
{nova, pulsar, quasar, vela, corvus}, {nova, pulsar, quasar, vela, corvus},
@@ -216,54 +220,66 @@ public class DefaultWaves{
Seq<SpawnGroup> out = new Seq<>(); Seq<SpawnGroup> out = new Seq<>();
//max reasonable wave, after which everything gets boring //max reasonable wave, after which everything gets boring
int cap = 400; int cap = 200;
//main sequence
float shieldStart = 30, shieldsPerWave = 12; float shieldStart = 30, shieldsPerWave = 12;
UnitType[] curSpecies = Structs.random(species);
int curTier = 0;
for(int i = 0; i < cap;){ Intc createProgression = start -> {
int f = i; //main sequence
int next = Mathf.random(15, 25); UnitType[] curSpecies = Structs.random(species);
int curTier = 0;
float shieldAmount = Math.max((i - shieldStart) * shieldsPerWave, 0); for(int i = start; i < cap;){
int f = i;
int next = Mathf.random(8, 16);
//main progression float shieldAmount = Math.max((i - shieldStart) * shieldsPerWave, 0);
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 = 16;
unitScaling = Mathf.random(1f, 2f);
shields = shieldAmount;
shieldScaling = shieldsPerWave;
}});
//extra progression that tails out, blends in //main progression
out.add(new SpawnGroup(curSpecies[Math.min(curTier, curSpecies.length - 1)]){{ out.add(new SpawnGroup(curSpecies[Math.min(curTier, curSpecies.length - 1)]){{
unitAmount = 6; unitAmount = f == 0 ? 1 : 10;
begin = f + next; begin = f;
end = f + next + Mathf.random(8, 12); end = f + next >= cap ? never : f + next;
max = 10; max = 16;
unitScaling = Mathf.random(2f); unitScaling = Mathf.random(1f, 2f);
spacing = Mathf.random(2, 3); shields = shieldAmount;
shields = shieldAmount; shieldScaling = shieldsPerWave;
shieldScaling = shieldsPerWave; }});
}});
i += next; //extra progression that tails out, blends in
if(curTier < 3 || Mathf.chance(0.2)){ out.add(new SpawnGroup(curSpecies[Math.min(curTier, curSpecies.length - 1)]){{
curTier ++; unitAmount = 6;
begin = f + next;
end = f + next + Mathf.random(8, 12);
max = 10;
unitScaling = Mathf.random(2f);
spacing = Mathf.random(2, 3);
shields = shieldAmount;
shieldScaling = shieldsPerWave;
}});
i += next;
if(curTier < 3 || Mathf.chance(0.2)){
curTier ++;
}
//do not spawn bosses
curTier = Math.min(curTier, 3);
//small chance to switch species
if(Mathf.chance(0.3)){
curSpecies = Structs.random(species);
}
} }
};
//do not spawn bosses createProgression.get(0);
curTier = Math.min(curTier, 3);
//small chance to switch species int step = 5 + Mathf.random(3);
if(Mathf.chance(0.3)){
curSpecies = Structs.random(species); while(step <= cap){
} createProgression.get(step);
step += (int)(Mathf.random(15, 30) * Mathf.lerp(1f, 0.4f, difficulty));
} }
int bossWave = Mathf.random(30, 60); int bossWave = Mathf.random(30, 60);

View File

@@ -394,13 +394,13 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
state.rules.attackMode = true; state.rules.attackMode = true;
}else{ }else{
state.rules.winWave = 15 * (int)Math.max(difficulty * 5, 1); state.rules.winWave = 15 * (int)Math.max(difficulty * 10, 1);
} }
state.rules.waves = true; state.rules.waves = true;
//TODO better waves //TODO better waves
state.rules.spawns = defaultWaves.get(); state.rules.spawns = DefaultWaves.generate(difficulty);
} }
@Override @Override