diff --git a/core/src/io/anuke/mindustry/content/Zones.java b/core/src/io/anuke/mindustry/content/Zones.java index d59fcf43ea..4197268190 100644 --- a/core/src/io/anuke/mindustry/content/Zones.java +++ b/core/src/io/anuke/mindustry/content/Zones.java @@ -41,22 +41,22 @@ public class Zones implements ContentList{ new SpawnGroup(UnitTypes.dagger){{ begin = 15; - unitScaling = 1; + unitScaling = 3; }}, new SpawnGroup(UnitTypes.dagger){{ begin = 20; - unitScaling = 1; + unitScaling = 3; }}, new SpawnGroup(UnitTypes.dagger){{ begin = 25; - unitScaling = 1; + unitScaling = 3; }}, new SpawnGroup(UnitTypes.dagger){{ begin = 30; - unitScaling = 1; + unitScaling = 2; }} ); }}; @@ -87,7 +87,7 @@ public class Zones implements ContentList{ new SpawnGroup(UnitTypes.dagger){{ begin = 10; - unitScaling = 1; + unitScaling = 1.5f; }}, new SpawnGroup(UnitTypes.crawler){{ @@ -98,7 +98,7 @@ public class Zones implements ContentList{ new SpawnGroup(UnitTypes.dagger){{ begin = 20; - unitScaling = 1; + unitScaling = 2; }}, new SpawnGroup(UnitTypes.crawler){{ diff --git a/core/src/io/anuke/mindustry/game/Loadout.java b/core/src/io/anuke/mindustry/game/Loadout.java new file mode 100644 index 0000000000..257b52424a --- /dev/null +++ b/core/src/io/anuke/mindustry/game/Loadout.java @@ -0,0 +1,7 @@ +package io.anuke.mindustry.game; + +import io.anuke.mindustry.world.Tile; + +public abstract class Loadout{ + public abstract void setup(Tile tile); +} diff --git a/core/src/io/anuke/mindustry/game/SpawnGroup.java b/core/src/io/anuke/mindustry/game/SpawnGroup.java index dbdaaa8a7d..a7cc2a0eca 100644 --- a/core/src/io/anuke/mindustry/game/SpawnGroup.java +++ b/core/src/io/anuke/mindustry/game/SpawnGroup.java @@ -20,7 +20,7 @@ public class SpawnGroup{ /**The spacing, in waves, of spawns. For example, 2 = spawns every other wave*/ protected int spacing = 1; /**Maximum amount of units that spawn*/ - protected int max = 60; + protected int max = 40; /**How many waves need to pass before the amount of units spawned increases by 1*/ protected float unitScaling = 9999f; /**Amount of enemies spawned initially, with no scaling*/ diff --git a/core/src/io/anuke/mindustry/type/Zone.java b/core/src/io/anuke/mindustry/type/Zone.java index 0b40c5cccc..a1228e2bba 100644 --- a/core/src/io/anuke/mindustry/type/Zone.java +++ b/core/src/io/anuke/mindustry/type/Zone.java @@ -8,6 +8,7 @@ import io.anuke.arc.graphics.g2d.TextureRegion; import io.anuke.arc.scene.ui.layout.Table; import io.anuke.mindustry.game.EventType.ZoneCompleteEvent; import io.anuke.mindustry.game.EventType.ZoneConfigureCompleteEvent; +import io.anuke.mindustry.game.Loadout; import io.anuke.mindustry.game.Rules; import io.anuke.mindustry.game.UnlockableContent; import io.anuke.mindustry.maps.generators.MapGenerator; @@ -25,8 +26,9 @@ public class Zone extends UnlockableContent{ public Supplier rules = Rules::new; public boolean alwaysUnlocked; public int conditionWave = Integer.MAX_VALUE; - public int configureWave = 50; + public int configureWave = 40; public int launchPeriod = 10; + public Loadout loadout; protected ItemStack[] baseLaunchCost = {}; protected Array startingItems = new Array<>(); diff --git a/tests/src/test/java/ApplicationTests.java b/tests/src/test/java/ApplicationTests.java index 725b6246a4..d00d090621 100644 --- a/tests/src/test/java/ApplicationTests.java +++ b/tests/src/test/java/ApplicationTests.java @@ -1,6 +1,7 @@ import io.anuke.arc.ApplicationCore; import io.anuke.arc.backends.headless.HeadlessApplication; import io.anuke.arc.backends.headless.HeadlessApplicationConfiguration; +import io.anuke.arc.collection.Array; import io.anuke.arc.math.geom.Point2; import io.anuke.arc.util.Log; import io.anuke.arc.util.Time; @@ -16,12 +17,14 @@ import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest; import io.anuke.mindustry.entities.type.BaseUnit; import io.anuke.mindustry.entities.type.base.Spirit; import io.anuke.mindustry.game.Content; +import io.anuke.mindustry.game.SpawnGroup; import io.anuke.mindustry.game.Team; import io.anuke.mindustry.io.BundleLoader; import io.anuke.mindustry.io.SaveIO; import io.anuke.mindustry.maps.Map; import io.anuke.mindustry.type.ContentType; import io.anuke.mindustry.type.Item; +import io.anuke.mindustry.type.Zone; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Edges; import io.anuke.mindustry.world.Tile; @@ -235,6 +238,44 @@ public class ApplicationTests{ assertEquals(Blocks.part, world.tile(1, 1).block()); } + @Test + void zoneEmptyWaves(){ + for(Zone zone : content.zones()){ + checkNoEmptyWaves(zone, zone.rules.get().spawns, 1, 100); + } + } + + @Test + void zoneOverflowWaves(){ + for(Zone zone : content.zones()){ + checkExtraWaves(zone, zone.rules.get().spawns, 1, 40, 140); + } + } + + void checkNoEmptyWaves(Zone zone, Array spawns, int from, int to){ + for(int i = from; i <= to; i++){ + int total = 0; + for(SpawnGroup spawn : spawns){ + total += spawn.getUnitsSpawned(i); + } + + assertNotEquals(0, total, "Zone " + zone + " has no spawned enemies at wave " + i); + } + } + + void checkExtraWaves(Zone zone, Array spawns, int from, int to, int max){ + for(int i = from; i <= to; i++){ + int total = 0; + for(SpawnGroup spawn : spawns){ + total += spawn.getUnitsSpawned(i); + } + + if(total >= max){ + fail("Zone '" + zone + "' has too many spawned enemies at wave " + i + " : " + total); + } + } + } + @Test void buildingDestruction(){ initBuilding();