Many bugfixes for multiplayer, QoL, balancing, new difficulties

This commit is contained in:
Anuken
2018-01-11 13:46:32 -05:00
parent d6bc6bf88c
commit 804758b179
33 changed files with 172 additions and 53 deletions
@@ -1,48 +0,0 @@
package io.anuke.mindustry.entities;
import io.anuke.mindustry.entities.enemies.EnemyType;
import io.anuke.ucore.core.Settings;
import io.anuke.ucore.util.Mathf;
public class EnemySpawn{
/**Scaling multiplier for each difficulty. Easy, normal, hard.*/
private static float[] scalings = {4f, 2.5f, 1.5f};
/**The enemy type spawned*/
public final EnemyType type;
/**When this spawns should end*/
protected int before = Integer.MAX_VALUE;
/**When this spawns should start*/
protected int after;
/**The spacing, in waves, of spawns. 2 = spawns every other wave*/
protected int spacing = 1;
/**How many waves need to pass after the start of this spawn for the tier to increase by one*/
protected int tierscale = 14;
/**How many less enemies there are, every time the tier increases*/
protected int tierscaleback = 1;
/**The tier this spawn starts at.*/
protected int tier = 1;
/**Maximum amount of enemies that spawn*/
protected int max = 17;
/**How many waves need to pass before the amount of enemies increases by 1*/
protected float scaling = 9999f;
/**Amount of enemies spawned initially, with no scaling*/
protected int amount = 1;
public EnemySpawn(EnemyType type){
this.type = type;
}
public int evaluate(int wave, int lane){
if(wave < after || wave > before || (wave - after) % spacing != 0){
return 0;
}
float scaling = this.scaling * scalings[(Settings.getInt("difficulty"))];
return Math.min(amount-1 + Math.max((int)((wave / spacing) / scaling), 1) - (tier(wave, lane)-1) * tierscaleback, max);
}
public int tier(int wave, int lane){
return Mathf.clamp(tier + (wave-after)/tierscale, 1, EnemyType.maxtier);
}
}
@@ -125,10 +125,13 @@ public class Player extends DestructibleEntity implements Syncable{
float speed = dashing ? Player.dashSpeed : Player.speed;
if(health < maxhealth && Timers.get(this, "regen", 50))
if(health < maxhealth && Timers.get(this, "regen", 20))
health ++;
health = Mathf.clamp(health, -1, maxhealth);
Tile tile = world.tileWorld(x, y);
if(tile != null && tile.floor().liquid && tile.block() == Blocks.air){
damage(health+1); //drown
}
@@ -1,147 +0,0 @@
package io.anuke.mindustry.entities;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.entities.enemies.EnemyTypes;
public class WaveCreator{
public static Array<EnemySpawn> getSpawns(){
return Array.with(
new EnemySpawn(EnemyTypes.standard){{
scaling = 1;
before = 3;
}},
new EnemySpawn(EnemyTypes.fast){{
scaling = 1;
after = 3;
spacing = 5;
amount = 3;
tierscaleback = 0;
}},
new EnemySpawn(EnemyTypes.blast){{
after = 4;
amount = 2;
spacing = 5;
scaling = 2;
tierscaleback = 0;
}},
new EnemySpawn(EnemyTypes.tank){{
after = 5;
spacing = 5;
scaling = 2;
amount = 2;
}},
new EnemySpawn(EnemyTypes.rapid){{
after = 7;
spacing = 5;
scaling = 2;
amount = 3;
}},
new EnemySpawn(EnemyTypes.healer){{
after = 5;
spacing = 5;
scaling = 1;
amount = 1;
}},
new EnemySpawn(EnemyTypes.standard){{
scaling = 3;
after = 8;
spacing = 4;
tier = 2;
}},
new EnemySpawn(EnemyTypes.titan){{
after = 6;
amount = 2;
spacing = 5;
scaling = 3;
}},
new EnemySpawn(EnemyTypes.flamer){{
after = 12;
amount = 2;
spacing = 5;
scaling = 3;
}},
new EnemySpawn(EnemyTypes.emp){{
after = 15;
amount = 1;
spacing = 5;
scaling = 2;
}},
new EnemySpawn(EnemyTypes.blast){{
after = 4 + 5 + 5;
amount = 3;
spacing = 5;
scaling = 2;
tierscaleback = 0;
}},
//boss wave
new EnemySpawn(EnemyTypes.fortress){{
after = 16;
amount = 1;
spacing = 5;
scaling = 1;
}},
new EnemySpawn(EnemyTypes.titan){{
after = 16;
amount = 1;
spacing = 5;
scaling = 3;
tierscaleback = 0;
}},
new EnemySpawn(EnemyTypes.healer){{
after = 16;
spacing = 5;
scaling = 2;
amount = 2;
}},
//end boss wave
//enchanced boss wave
new EnemySpawn(EnemyTypes.mortar){{
after = 16 + 5;
amount = 1;
spacing = 5;
scaling = 3;
}},
new EnemySpawn(EnemyTypes.emp){{
after = 16 + 5;
amount = 1;
spacing = 5;
scaling = 3;
}}
//end enchanced boss wave
);
}
public static void testWaves(int from, int to){
Array<EnemySpawn> spawns = getSpawns();
for(int i = from; i <= to; i ++){
System.out.print(i+": ");
int total = 0;
for(EnemySpawn spawn : spawns){
int a = spawn.evaluate(i, 0);
int t = spawn.tier(i, 0);
total += a;
if(a > 0){
System.out.print(a+"x" + spawn.type.name + "-" + t + " ");
}
}
System.out.print(" (" + total + ")");
System.out.println();
}
}
}