Balanced all enemies, tweaked waves

This commit is contained in:
Anuken
2017-12-03 12:02:48 -05:00
parent 9cadb08024
commit 19a4dd41e3
34 changed files with 304 additions and 138 deletions

View File

@@ -232,14 +232,14 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
}
public void draw(Bullet b){}
},
small = new BulletType(1.5f, 1){
small = new BulletType(1.5f, 2){
public void draw(Bullet b){
Draw.color(glowy);
Draw.rect("shot", b.x, b.y, b.angle() - 45);
Draw.reset();
}
},
smallSlow = new BulletType(1.2f, 1){
smallSlow = new BulletType(1.2f, 2){
public void draw(Bullet b){
Draw.color("orange");
Draw.rect("shot", b.x, b.y, b.angle() - 45);

View File

@@ -4,14 +4,24 @@ import io.anuke.mindustry.entities.enemies.Enemy;
import io.anuke.ucore.util.Mathf;
public class EnemySpawn{
/**The enemy type spawned*/
public final Class<? extends Enemy> 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 = 15;
/**How many less enemies there are, every time the tier increases*/
protected int tierscaleback = 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(Class<? extends Enemy> type){
this.type = type;
@@ -21,7 +31,7 @@ public class EnemySpawn{
if(wave < after || wave > before || (wave - after) % spacing != 0){
return 0;
}
return Math.min(1 * Math.max((int)((wave / spacing) / scaling), 1) - (tier(wave, lane)-1) * tierscaleback, max);
return Math.min(amount-1 + 1 * Math.max((int)((wave / spacing) / scaling), 1) - (tier(wave, lane)-1) * tierscaleback, max);
}
public int tier(int wave, int lane){

View File

@@ -0,0 +1,201 @@
package io.anuke.mindustry.entities;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.reflect.ClassReflection;
import io.anuke.mindustry.entities.enemies.*;
public class WaveCreator{
public static Array<EnemySpawn> getSpawns(){
//TODO
//Gdx.app.exit();
return Array.with(
new EnemySpawn(Enemy.class){{
scaling = 1;
before = 3;
}},
new EnemySpawn(FastEnemy.class){{
scaling = 1;
after = 3;
spacing = 5;
amount = 4;
tierscaleback = 0;
}},
new EnemySpawn(BlastEnemy.class){{
after = 4;
amount = 3;
spacing = 5;
scaling = 1;
tierscaleback = 0;
}},
new EnemySpawn(TankEnemy.class){{
after = 5;
spacing = 5;
scaling = 1;
amount = 2;
}},
new EnemySpawn(RapidEnemy.class){{
after = 7;
spacing = 5;
scaling = 2;
amount = 3;
}},
new EnemySpawn(HealerEnemy.class){{
after = 5;
spacing = 5;
scaling = 1;
amount = 1;
}},
new EnemySpawn(TitanEnemy.class){{
after = 6;
amount = 2;
spacing = 5;
scaling = 3;
}},
new EnemySpawn(FlamerEnemy.class){{
after = 12;
amount = 3;
spacing = 5;
scaling = 2;
}},
new EnemySpawn(BlastEnemy.class){{
after = 4 + 5 + 5;
amount = 3;
spacing = 5;
scaling = 1;
tierscaleback = 0;
}},
//boss wave
new EnemySpawn(FortressEnemy.class){{
after = 16;
amount = 2;
spacing = 5;
scaling = 1;
}},
new EnemySpawn(TitanEnemy.class){{
after = 16;
amount = 2;
spacing = 5;
scaling = 3;
tierscaleback = 0;
}},
new EnemySpawn(HealerEnemy.class){{
after = 16;
spacing = 5;
scaling = 1;
amount = 2;
}},
//end boss wave
//enchanced boss wave
new EnemySpawn(MortarEnemy.class){{
after = 16 + 5;
amount = 1;
spacing = 5;
scaling = 1;
}},
new EnemySpawn(EmpEnemy.class){{
after = 16 + 5;
amount = 1;
spacing = 5;
scaling = 1;
}}
//end enchanced boss wave
);
}
public static Array<EnemySpawn> getSpawnsOld(){
return Array.with(
new EnemySpawn(Enemy.class){{
scaling = 2;
before = 4;
}},
new EnemySpawn(Enemy.class){{
scaling = 3;
tierscaleback = 3;
spacing = 2;
after = 4;
}},
new EnemySpawn(TitanEnemy.class){{
after = 5;
spacing = 2;
scaling = 5;
}},
new EnemySpawn(FortressEnemy.class){{
after = 12;
spacing = 3;
scaling = 5;
}},
new EnemySpawn(HealerEnemy.class){{
scaling = 3;
spacing = 2;
after = 8;
}},
new EnemySpawn(FastEnemy.class){{
after = 2;
scaling = 3;
}},
new EnemySpawn(FlamerEnemy.class){{
after = 14;
spacing = 5;
scaling = 2;
}},
new EnemySpawn(BlastEnemy.class){{
after = 12;
spacing = 2;
scaling = 3;
}},
new EnemySpawn(RapidEnemy.class){{
after = 7;
spacing = 3;
scaling = 3;
}},
new EnemySpawn(EmpEnemy.class){{
after = 19;
spacing = 3;
scaling = 5;
}},
new EnemySpawn(TankEnemy.class){{
after = 4;
spacing = 2;
scaling = 3;
}},
new EnemySpawn(MortarEnemy.class){{
after = 20;
spacing = 3;
scaling = 5;
}}
);
}
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" + ClassReflection.getSimpleName(spawn.type) + "-" + t + " ");
}
}
System.out.print(" (" + total + ")");
System.out.println();
}
}
}

View File

@@ -7,10 +7,9 @@ import io.anuke.mindustry.entities.TileEntity;
public class BlastEnemy extends Enemy{
public BlastEnemy(int spawn) {
super(spawn);
public BlastEnemy() {
maxhealth = 30;
speed = 0.65f;
speed = 0.7f;
bullet = null;
turretrotatespeed = 0f;
mass = 0.8f;

View File

@@ -4,8 +4,7 @@ import io.anuke.mindustry.entities.BulletType;
public class EmpEnemy extends Enemy{
public EmpEnemy(int spawn) {
super(spawn);
public EmpEnemy() {
speed = 0.27f;
reload = 70;

View File

@@ -22,7 +22,7 @@ public class Enemy extends DestructibleEntity{
public final static Color[] tierColors = { Color.valueOf("ffe451"), Color.valueOf("f48e20"), Color.valueOf("ff6757"), Color.valueOf("ff2d86") };
public final static int maxtier = 4;
protected float speed = 0.3f;
protected float speed = 0.4f;
protected float reload = 32;
protected float range = 60;
protected float length = 4;
@@ -47,9 +47,7 @@ public class Enemy extends DestructibleEntity{
public Entity target;
public int tier = 1;
public Enemy(int spawn) {
this.spawn = spawn;
public Enemy() {
hitbox.setSize(5f);
hitboxTile.setSize(4f);

View File

@@ -2,14 +2,13 @@ package io.anuke.mindustry.entities.enemies;
public class FastEnemy extends Enemy{
public FastEnemy(int spawn) {
super(spawn);
public FastEnemy() {
speed = 0.7f;
reload = 30;
speed = 0.73f;
reload = 25;
mass = 0.2f;
maxhealth = 30;
maxhealth = 40;
heal();
}

View File

@@ -4,8 +4,7 @@ import io.anuke.mindustry.entities.BulletType;
public class FlamerEnemy extends Enemy{
public FlamerEnemy(int spawn) {
super(spawn);
public FlamerEnemy() {
speed = 0.35f;

View File

@@ -13,10 +13,9 @@ public class FortressEnemy extends Enemy{
float spawnTime = 240;
boolean deployed;
public FortressEnemy(int spawn) {
super(spawn);
public FortressEnemy() {
speed = 0.12f;
speed = 0.2f;
reload = 90;
maxhealth = 700;
range = 70f;
@@ -38,7 +37,8 @@ public class FortressEnemy extends Enemy{
if(Timers.get(this, "spawn", spawnTime) && spawned < maxSpawn){
Angles.translation(angle, 20f);
FastEnemy enemy = new FastEnemy(spawn);
FastEnemy enemy = new FastEnemy();
enemy.spawn = spawn;
enemy.tier = this.tier;
enemy.spawner = this;
enemy.set(x + Angles.x(), y + Angles.y());

View File

@@ -13,8 +13,7 @@ import io.anuke.ucore.util.Angles;
public class HealerEnemy extends Enemy{
public HealerEnemy(int spawn) {
super(spawn);
public HealerEnemy() {
speed = 0.2f;
reload = 14;

View File

@@ -4,11 +4,10 @@ import io.anuke.mindustry.entities.BulletType;
public class MortarEnemy extends Enemy{
public MortarEnemy(int spawn) {
super(spawn);
public MortarEnemy() {
maxhealth = 200;
speed = 0.2f;
speed = 0.25f;
reload = 100f;
bullet = BulletType.shell;
turretrotatespeed = 0.15f;

View File

@@ -4,14 +4,13 @@ import io.anuke.mindustry.entities.BulletType;
public class RapidEnemy extends Enemy{
public RapidEnemy(int spawn) {
super(spawn);
public RapidEnemy() {
reload = 8;
bullet = BulletType.purple;
rotatespeed = 0.08f;
maxhealth = 260;
speed = 0.27f;
speed = 0.33f;
heal();
hitbox.setSize(8f);
mass = 3f;

View File

@@ -7,11 +7,10 @@ import io.anuke.ucore.util.Angles;
public class TankEnemy extends Enemy{
public TankEnemy(int spawn) {
super(spawn);
public TankEnemy() {
maxhealth = 350;
speed = 0.2f;
speed = 0.24f;
reload = 90f;
rotatespeed = 0.06f;
bullet = BulletType.small;

View File

@@ -9,8 +9,7 @@ import io.anuke.ucore.core.Timers;
public class TargetEnemy extends Enemy{
public TargetEnemy(int spawn){
super(0);
public TargetEnemy(){
speed = 0f;
maxhealth = 10;
}
@@ -48,7 +47,7 @@ public class TargetEnemy extends Enemy{
public void onDeath(){
super.onDeath();
Timers.run(100f, ()->{
new TargetEnemy(0).set(x, y).add();
new TargetEnemy().set(x, y).add();
});
}
}

View File

@@ -5,8 +5,7 @@ import io.anuke.ucore.core.Timers;
public class TestEnemy extends Enemy{
boolean dir = false;
public TestEnemy(int spawn) {
super(spawn);
public TestEnemy() {
maxhealth = 99999;
heal();
}

View File

@@ -7,12 +7,11 @@ import io.anuke.ucore.util.Mathf;
public class TitanEnemy extends Enemy{
public TitanEnemy(int spawn) {
super(spawn);
public TitanEnemy() {
speed = 0.14f;
speed = 0.22f;
reload = 30;
maxhealth = 400;
maxhealth = 421;
range = 60f;
bullet = BulletType.small;
hitbox.setSize(7f);
@@ -27,7 +26,7 @@ public class TitanEnemy extends Enemy{
@Override
void updateShooting(){
Timers.get(this, "salvo", 250);
Timers.get(this, "salvo", 240);
if(Timers.getTime(this, "salvo") < 60){
if(Timers.get(this, "salvoShoot", 6)){
@@ -35,7 +34,7 @@ public class TitanEnemy extends Enemy{
}
}
if(Timers.get(this, "shotgun", 90)){
if(Timers.get(this, "shotgun", 80)){
Angles.shotgun(5, 10f, 0f, f->{
shoot(BulletType.smallSlow, f);
});

View File

@@ -0,0 +1,11 @@
package io.anuke.mindustry.entities.enemies.flying;
import io.anuke.mindustry.entities.enemies.Enemy;
public class FlyingEnemy extends Enemy{
public FlyingEnemy() {
}
}