mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-03 13:30:25 +07:00
Zone wave correctness checks
This commit is contained in:
parent
4b028b3435
commit
f591403b7d
@ -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){{
|
||||
|
7
core/src/io/anuke/mindustry/game/Loadout.java
Normal file
7
core/src/io/anuke/mindustry/game/Loadout.java
Normal file
@ -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);
|
||||
}
|
@ -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*/
|
||||
|
@ -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 = 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<ItemStack> startingItems = new Array<>();
|
||||
|
@ -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<SpawnGroup> 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<SpawnGroup> 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();
|
||||
|
Loading…
Reference in New Issue
Block a user