diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index ad34385288..3403d4d2cc 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -43,7 +43,7 @@ public class Vars{ //whether to draw chunk borders public static boolean debugChunks = false; //whether turrets have infinite ammo (only with debug) - public static boolean infiniteAmmo = false; + public static boolean infiniteAmmo = true; //whether to show paths of enemies public static boolean showPaths = true; //number of save slots-- increasing may lead to layout issues diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index 2b96963d48..63dc8719f6 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -9,14 +9,15 @@ import com.badlogic.gdx.input.GestureDetector; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectMap; import com.badlogic.gdx.utils.reflect.ClassReflection; -import com.badlogic.gdx.utils.reflect.Constructor; import io.anuke.mindustry.Mindustry; import io.anuke.mindustry.Vars; import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.entities.*; import io.anuke.mindustry.entities.effect.Fx; -import io.anuke.mindustry.entities.enemies.*; +import io.anuke.mindustry.entities.enemies.BlastEnemy; +import io.anuke.mindustry.entities.enemies.Enemy; +import io.anuke.mindustry.entities.enemies.HealerEnemy; import io.anuke.mindustry.input.AndroidInput; import io.anuke.mindustry.input.GestureHandler; import io.anuke.mindustry.input.Input; @@ -113,61 +114,8 @@ public class Control extends Module{ player = new Player(); - spawns = Array.with( - 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(Enemy.class){{ - scaling = 3; - tierscaleback = 3; - }}, - 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; - }} - ); + spawns = WaveCreator.getSpawns(); + WaveCreator.testWaves(1, 30); } public void reset(){ @@ -290,9 +238,9 @@ public class Control extends Module{ Timers.run(index*50f, ()->{ try{ - Constructor c = ClassReflection.getConstructor(spawn.type, int.class); - Enemy enemy = (Enemy)c.newInstance(fl); + Enemy enemy = ClassReflection.newInstance(spawn.type); enemy.set(tile.worldx() + Mathf.range(range), tile.worldy() + Mathf.range(range)); + enemy.spawn = fl; enemy.tier = spawn.tier(wave, fl); Effects.effect(Fx.spawn, enemy); enemy.add(enemyGroup); @@ -466,15 +414,15 @@ public class Control extends Module{ if(Inputs.keyUp(Keys.Y)){ if(Inputs.keyDown(Keys.SHIFT_LEFT)){ - new HealerEnemy(0).set(player.x, player.y).add(); + new HealerEnemy().set(player.x, player.y).add(); }else{ float px = player.x, py = player.y; - Timers.run(30f, ()->new BlastEnemy(0).set(px, py).add()); + Timers.run(30f, ()->new BlastEnemy().set(px, py).add()); } } } - if(shouldUpdateItems && Timers.get("updateItems", 8)){ + if(shouldUpdateItems && (Timers.get("updateItems", 8) || GameState.is(State.paused))){ ui.updateItems(); shouldUpdateItems = false; } diff --git a/core/src/io/anuke/mindustry/entities/BulletType.java b/core/src/io/anuke/mindustry/entities/BulletType.java index 12de2f69d5..23818dfb76 100644 --- a/core/src/io/anuke/mindustry/entities/BulletType.java +++ b/core/src/io/anuke/mindustry/entities/BulletType.java @@ -232,14 +232,14 @@ public abstract class BulletType extends BaseBulletType{ } 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); diff --git a/core/src/io/anuke/mindustry/entities/EnemySpawn.java b/core/src/io/anuke/mindustry/entities/EnemySpawn.java index 1e47e49094..27805bc200 100644 --- a/core/src/io/anuke/mindustry/entities/EnemySpawn.java +++ b/core/src/io/anuke/mindustry/entities/EnemySpawn.java @@ -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 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 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){ diff --git a/core/src/io/anuke/mindustry/entities/WaveCreator.java b/core/src/io/anuke/mindustry/entities/WaveCreator.java new file mode 100644 index 0000000000..bdc7a1fc6b --- /dev/null +++ b/core/src/io/anuke/mindustry/entities/WaveCreator.java @@ -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 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 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 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(); + } + } +} diff --git a/core/src/io/anuke/mindustry/entities/enemies/BlastEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/BlastEnemy.java index 9a40debd03..8b174a5b68 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/BlastEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/BlastEnemy.java @@ -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; diff --git a/core/src/io/anuke/mindustry/entities/enemies/EmpEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/EmpEnemy.java index cd9424a791..5215719e37 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/EmpEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/EmpEnemy.java @@ -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; diff --git a/core/src/io/anuke/mindustry/entities/enemies/Enemy.java b/core/src/io/anuke/mindustry/entities/enemies/Enemy.java index e87552cb22..88d4660797 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/Enemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/Enemy.java @@ -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); diff --git a/core/src/io/anuke/mindustry/entities/enemies/FastEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/FastEnemy.java index cd71689a20..01d80d0524 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/FastEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/FastEnemy.java @@ -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(); } diff --git a/core/src/io/anuke/mindustry/entities/enemies/FlamerEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/FlamerEnemy.java index d2832f1f3a..3c85c450a3 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/FlamerEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/FlamerEnemy.java @@ -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; diff --git a/core/src/io/anuke/mindustry/entities/enemies/FortressEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/FortressEnemy.java index 94f82ce501..a925814e1c 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/FortressEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/FortressEnemy.java @@ -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()); diff --git a/core/src/io/anuke/mindustry/entities/enemies/HealerEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/HealerEnemy.java index 45fe62720a..886662d797 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/HealerEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/HealerEnemy.java @@ -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; diff --git a/core/src/io/anuke/mindustry/entities/enemies/MortarEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/MortarEnemy.java index adfac7e879..9df78bf784 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/MortarEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/MortarEnemy.java @@ -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; diff --git a/core/src/io/anuke/mindustry/entities/enemies/RapidEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/RapidEnemy.java index 3f06326a86..44948908eb 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/RapidEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/RapidEnemy.java @@ -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; diff --git a/core/src/io/anuke/mindustry/entities/enemies/TankEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/TankEnemy.java index 265d526c28..4ca5a514ed 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/TankEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/TankEnemy.java @@ -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; diff --git a/core/src/io/anuke/mindustry/entities/enemies/TargetEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/TargetEnemy.java index a2e319e27a..5ec216e001 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/TargetEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/TargetEnemy.java @@ -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(); }); } } diff --git a/core/src/io/anuke/mindustry/entities/enemies/TestEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/TestEnemy.java index cd1a714bbf..56da2fdcfa 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/TestEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/TestEnemy.java @@ -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(); } diff --git a/core/src/io/anuke/mindustry/entities/enemies/TitanEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/TitanEnemy.java index d2e3d14318..d7c78920d5 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/TitanEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/TitanEnemy.java @@ -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); }); diff --git a/core/src/io/anuke/mindustry/entities/enemies/flying/FlyingEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/flying/FlyingEnemy.java new file mode 100644 index 0000000000..2fbb27ff14 --- /dev/null +++ b/core/src/io/anuke/mindustry/entities/enemies/flying/FlyingEnemy.java @@ -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() { + + } + +} diff --git a/core/src/io/anuke/mindustry/input/Input.java b/core/src/io/anuke/mindustry/input/Input.java index f2092fc956..7dc2c67d96 100644 --- a/core/src/io/anuke/mindustry/input/Input.java +++ b/core/src/io/anuke/mindustry/input/Input.java @@ -7,6 +7,8 @@ import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.math.Vector2; import io.anuke.mindustry.Vars; +import io.anuke.mindustry.core.GameState; +import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.resource.ItemStack; import io.anuke.mindustry.resource.Weapon; import io.anuke.mindustry.world.Tile; @@ -23,7 +25,7 @@ public class Input{ //player is dead if(player.health <= 0) return; - if(Inputs.scrolled()){ + if(Inputs.scrolled() && GameState.is(State.playing)){ Vars.renderer.scaleCamera(Inputs.scroll()); } diff --git a/core/src/io/anuke/mindustry/io/SaveIO.java b/core/src/io/anuke/mindustry/io/SaveIO.java index d812253195..b1e5b2d6c6 100644 --- a/core/src/io/anuke/mindustry/io/SaveIO.java +++ b/core/src/io/anuke/mindustry/io/SaveIO.java @@ -357,7 +357,8 @@ public class SaveIO{ int health = stream.readInt(); try{ - Enemy enemy = (Enemy)ClassReflection.getConstructor(enemyIDs.get(type), int.class).newInstance(lane); + Enemy enemy = ClassReflection.newInstance(enemyIDs.get(type)); + enemy.spawn = lane; enemy.health = health; enemy.x = x; enemy.y = y; diff --git a/core/src/io/anuke/mindustry/resource/ItemStack.java b/core/src/io/anuke/mindustry/resource/ItemStack.java index c402284766..9d6bceb017 100644 --- a/core/src/io/anuke/mindustry/resource/ItemStack.java +++ b/core/src/io/anuke/mindustry/resource/ItemStack.java @@ -9,4 +9,8 @@ public class ItemStack{ this.item = item; this.amount = amount; } + + public boolean equals(ItemStack other){ + return other != null && other.item == item && other.amount == amount; + } } diff --git a/core/src/io/anuke/mindustry/resource/Recipe.java b/core/src/io/anuke/mindustry/resource/Recipe.java index 636931ee74..06c6295380 100644 --- a/core/src/io/anuke/mindustry/resource/Recipe.java +++ b/core/src/io/anuke/mindustry/resource/Recipe.java @@ -19,7 +19,7 @@ public enum Recipe{ duriumwalllarge(defense, DefenseBlocks.diriumwalllarge, stack(Item.dirium, 8)), door(defense, DefenseBlocks.door, stack(Item.steel, 3), stack(Item.iron, 3)), largedoor(defense, DefenseBlocks.largedoor, stack(Item.steel, 3*4), stack(Item.iron, 3*4)), - titaniumshieldwall(defense, DefenseBlocks.titaniumshieldwall, stack(Item.titanium, 2)), + titaniumshieldwall(defense, DefenseBlocks.titaniumshieldwall, stack(Item.titanium, 3)), conveyor(distribution, DistributionBlocks.conveyor, stack(Item.stone, 1)), steelconveyor(distribution, DistributionBlocks.steelconveyor, stack(Item.steel, 1)), @@ -43,36 +43,36 @@ public enum Recipe{ mortarturret(weapon, WeaponBlocks.mortarturret, stack(Item.steel, 20), stack(Item.titanium, 15)), teslaturret(weapon, WeaponBlocks.teslaturret, stack(Item.steel, 10), stack(Item.titanium, 15), stack(Item.dirium, 15)), plasmaturret(weapon, WeaponBlocks.plasmaturret, stack(Item.steel, 10), stack(Item.titanium, 10), stack(Item.dirium, 15)), - chainturret(weapon, WeaponBlocks.chainturret, stack(Item.steel, 10), stack(Item.titanium, 10), stack(Item.dirium, 15)), - titanturret(weapon, WeaponBlocks.titanturret, stack(Item.steel, 10), stack(Item.titanium, 10), stack(Item.dirium, 15)), + chainturret(weapon, WeaponBlocks.chainturret, stack(Item.steel, 35), stack(Item.titanium, 25), stack(Item.dirium, 35)), + titanturret(weapon, WeaponBlocks.titanturret, stack(Item.steel, 50), stack(Item.titanium, 45), stack(Item.dirium, 55)), smelter(crafting, ProductionBlocks.smelter, stack(Item.stone, 40), stack(Item.iron, 40)), crucible(crafting, ProductionBlocks.crucible, stack(Item.titanium, 40), stack(Item.steel, 40)), coalpurifier(crafting, ProductionBlocks.coalpurifier, stack(Item.steel, 10), stack(Item.iron, 10)), titaniumpurifier(crafting, ProductionBlocks.titaniumpurifier, stack(Item.steel, 30), stack(Item.iron, 30)), - oilrefinery(crafting, ProductionBlocks.oilrefinery, stack(Item.steel, 30), stack(Item.iron, 30)), - stoneformer(crafting, ProductionBlocks.stoneformer, stack(Item.steel, 30), stack(Item.iron, 30)), - lavasmelter(crafting, ProductionBlocks.lavasmelter, stack(Item.steel, 30), stack(Item.iron, 30)), + oilrefinery(crafting, ProductionBlocks.oilrefinery, stack(Item.steel, 15), stack(Item.iron, 15)), + stoneformer(crafting, ProductionBlocks.stoneformer, stack(Item.steel, 10), stack(Item.iron, 10)), + lavasmelter(crafting, ProductionBlocks.lavasmelter, stack(Item.steel, 20), stack(Item.iron, 20), stack(Item.titanium, 10)), stonedrill(production, ProductionBlocks.stonedrill, stack(Item.stone, 12)), irondrill(production, ProductionBlocks.irondrill, stack(Item.stone, 25)), coaldrill(production, ProductionBlocks.coaldrill, stack(Item.stone, 25), stack(Item.iron, 40)), titaniumdrill(production, ProductionBlocks.titaniumdrill, stack(Item.iron, 40), stack(Item.steel, 40)), - uraniumdrill(production, ProductionBlocks.uraniumdrill, stack(Item.titanium, 20), stack(Item.steel, 40)), - omnidrill(production, ProductionBlocks.omnidrill, stack(Item.titanium, 20), stack(Item.dirium, 20)), + uraniumdrill(production, ProductionBlocks.uraniumdrill, stack(Item.iron, 40), stack(Item.steel, 40)), + omnidrill(production, ProductionBlocks.omnidrill, stack(Item.titanium, 30), stack(Item.dirium, 20)), - coalgenerator(power, ProductionBlocks.coalgenerator, stack(Item.titanium, 10), stack(Item.dirium, 10)), - thermalgenerator(power, ProductionBlocks.thermalgenerator, stack(Item.titanium, 10), stack(Item.dirium, 10)), - combustiongenerator(power, ProductionBlocks.combustiongenerator, stack(Item.titanium, 10), stack(Item.dirium, 10)), - rtgenerator(power, ProductionBlocks.rtgenerator, stack(Item.titanium, 10), stack(Item.dirium, 10)), - nuclearreactor(power, ProductionBlocks.nuclearReactor, stack(Item.titanium, 10), stack(Item.dirium, 10)), - powerbooster(power, DistributionBlocks.powerbooster, stack(Item.titanium, 10), stack(Item.dirium, 10)), - powerlaser(power, DistributionBlocks.powerlaser, stack(Item.titanium, 10), stack(Item.dirium, 10)), - powerlaserrouter(power, DistributionBlocks.powerlaserrouter, stack(Item.titanium, 10), stack(Item.dirium, 10)), + coalgenerator(power, ProductionBlocks.coalgenerator, stack(Item.iron, 30), stack(Item.stone, 20)), + thermalgenerator(power, ProductionBlocks.thermalgenerator, stack(Item.steel, 30), stack(Item.iron, 30)), + combustiongenerator(power, ProductionBlocks.combustiongenerator, stack(Item.iron, 30), stack(Item.stone, 20)), + rtgenerator(power, ProductionBlocks.rtgenerator, stack(Item.titanium, 20), stack(Item.steel, 20)), + nuclearreactor(power, ProductionBlocks.nuclearReactor, stack(Item.titanium, 40), stack(Item.dirium, 40), stack(Item.steel, 50)), + powerbooster(power, DistributionBlocks.powerbooster, stack(Item.steel, 8), stack(Item.iron, 8)), + powerlaser(power, DistributionBlocks.powerlaser, stack(Item.steel, 3), stack(Item.iron, 3)), + powerlaserrouter(power, DistributionBlocks.powerlaserrouter, stack(Item.steel, 5), stack(Item.iron, 5)), - shieldgenerator(power, DefenseBlocks.shieldgenerator, stack(Item.titanium, 10), stack(Item.dirium, 10)), + shieldgenerator(power, DefenseBlocks.shieldgenerator, stack(Item.titanium, 30), stack(Item.dirium, 40)), - teleporter(distribution, DistributionBlocks.teleporter, stack(Item.titanium, 10), stack(Item.dirium, 10)), + teleporter(distribution, DistributionBlocks.teleporter, stack(Item.steel, 20), stack(Item.dirium, 15)), healturret(power, DefenseBlocks.repairturret, stack(Item.iron, 30)), megahealturret(power, DefenseBlocks.megarepairturret, stack(Item.iron, 20), stack(Item.steel, 30)), diff --git a/core/src/io/anuke/mindustry/ui/LoadDialog.java b/core/src/io/anuke/mindustry/ui/LoadDialog.java index f1d8d69bfb..5baf7f27d9 100644 --- a/core/src/io/anuke/mindustry/ui/LoadDialog.java +++ b/core/src/io/anuke/mindustry/ui/LoadDialog.java @@ -52,7 +52,7 @@ public class LoadDialog extends FloatingDialog{ for(int i = 0; i < Vars.saveSlots; i++){ final int slot = i; - TextButton button = new TextButton("[orange]Slot " + (i + 1)); + TextButton button = new TextButton("[accent]Slot " + (i + 1)); button.pad(Unit.dp.inPixels(12)); button.getLabelCell().top().left().growX(); diff --git a/core/src/io/anuke/mindustry/world/Generator.java b/core/src/io/anuke/mindustry/world/Generator.java index a1b29667be..b6109f5243 100644 --- a/core/src/io/anuke/mindustry/world/Generator.java +++ b/core/src/io/anuke/mindustry/world/Generator.java @@ -86,11 +86,11 @@ public class Generator{ floor = Blocks.coal; } - if(Noise.nnoise(x + 9999, y + 9999, 8, 1) > 0.253){ + if(Noise.nnoise(x + 9999, y + 9999, 8, 1) > 0.264){ floor = Blocks.titanium; } - if(Noise.nnoise(x + 99999, y + 99999, 7, 1) > 0.258){ + if(Noise.nnoise(x + 99999, y + 99999, 7, 1) > 0.259){ floor = Blocks.uranium; } } @@ -112,7 +112,7 @@ public class Generator{ } if(color == Hue.rgb(Color.PURPLE)){ - if(!Vars.android) new TargetEnemy(0).set(x * Vars.tilesize, y * Vars.tilesize).add(); + if(!Vars.android) new TargetEnemy().set(x * Vars.tilesize, y * Vars.tilesize).add(); floor = Blocks.stone; } diff --git a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java index a76c189a28..bfb64aff8f 100644 --- a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java @@ -151,6 +151,7 @@ public class ProductionBlocks{ stonedrill = new Drill("stonedrill"){{ resource = Blocks.stone; result = Item.stone; + time = 4; formalName = "stone drill"; description = "Mines 1 "+resource.name+" every "+time+" seconds."; fullDescription = "The essential drill. When placed on stone tiles, outputs stone at a slow pace indefinitely."; diff --git a/core/src/io/anuke/mindustry/world/blocks/WeaponBlocks.java b/core/src/io/anuke/mindustry/world/blocks/WeaponBlocks.java index 67b43d0ca0..3e315e9c0e 100644 --- a/core/src/io/anuke/mindustry/world/blocks/WeaponBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/WeaponBlocks.java @@ -74,8 +74,8 @@ public class WeaponBlocks{ bullet = BulletType.iron; ammo = Item.iron; health = 70; - shots = 7; - inaccuracy = 30f; + shots = 5; + inaccuracy = 15f; shotDelayScale = 0.7f; fullDescription = "A standard turret. Uses iron for ammo. Shoots a spread of 7 bullets. " + "Lower range, but higher damage output than the gattling turret."; diff --git a/core/src/io/anuke/mindustry/world/blocks/types/Wall.java b/core/src/io/anuke/mindustry/world/blocks/types/Wall.java index e2f2afefc7..f5f15533e5 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/Wall.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/Wall.java @@ -11,7 +11,7 @@ public class Wall extends Block{ } public boolean canReplace(Block other){ - return other instanceof Wall; + return other instanceof Wall && health > other.health; } } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/defense/Turret.java b/core/src/io/anuke/mindustry/world/blocks/types/defense/Turret.java index 32ef2ec8e8..b0cb9402f8 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/defense/Turret.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/defense/Turret.java @@ -228,6 +228,7 @@ public class Turret extends Block{ bullet(tile, entity.rotation + Mathf.range(inaccuracy)); }else{ Timers.run(i * shotDelayScale, ()->{ + Angles.translation(entity.rotation, width * Vars.tilesize / 2f); bullet(tile, entity.rotation + Mathf.range(inaccuracy)); }); } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Drill.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Drill.java index 72cb20bdd2..f9a67be841 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/Drill.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/Drill.java @@ -33,7 +33,7 @@ public class Drill extends Block{ @Override public void update(Tile tile){ - if(tile.floor() == resource && Timers.get(tile, "drill", 60 * time) && tile.entity.totalItems() < capacity){ + if((tile.floor() == resource || (resource.drops.equals(tile.floor().drops))) && Timers.get(tile, "drill", 60 * time) && tile.entity.totalItems() < capacity){ offloadNear(tile, result); Effects.effect(Fx.spark, tile.worldx(), tile.worldy()); } @@ -45,7 +45,7 @@ public class Drill extends Block{ @Override public void drawOver(Tile tile){ - if(tile.floor() != resource && resource != null){ + if(tile.floor() != resource && !(resource.drops.equals(tile.floor().drops)) && resource != null){ Draw.colorl(0.85f + Mathf.absin(Timers.time(), 6f, 0.15f)); Draw.rect("cross", tile.worldx(), tile.worldy()); Draw.color(); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java index 70a4b931ab..c8061930f0 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java @@ -58,7 +58,7 @@ public class Generator extends PowerBlock{ Effects.effect(Fx.shockwave, x, y); Timers.run(12f + Mathf.random(20f), () -> { - tile.damageNearby(3, 40, 0f); + tile.damageNearby(4, 40, 0f); }); Effects.sound(explosionSound, x, y); diff --git a/desktop/mindustry-saves/0.mins b/desktop/mindustry-saves/0.mins index 2badafeb22..bffadbd249 100644 Binary files a/desktop/mindustry-saves/0.mins and b/desktop/mindustry-saves/0.mins differ diff --git a/desktop/mindustry-saves/1.mins b/desktop/mindustry-saves/1.mins index a5297efc38..d780fe1229 100644 Binary files a/desktop/mindustry-saves/1.mins and b/desktop/mindustry-saves/1.mins differ diff --git a/desktop/mindustry-saves/2.mins b/desktop/mindustry-saves/2.mins index e8eda1212d..94eac02a14 100644 Binary files a/desktop/mindustry-saves/2.mins and b/desktop/mindustry-saves/2.mins differ