Starting items / Zone balancing
This commit is contained in:
@@ -242,7 +242,7 @@ public class Bullets implements ContentList{
|
||||
bulletHeight = 9f;
|
||||
shootEffect = Fx.shootSmall;
|
||||
smokeEffect = Fx.shootSmallSmoke;
|
||||
ammoMultiplier = 5;
|
||||
ammoMultiplier = 2;
|
||||
}};
|
||||
|
||||
standardDense = new BasicBulletType(3.5f, 18, "bullet"){{
|
||||
|
||||
@@ -43,13 +43,6 @@ public class Recipes implements ContentList{
|
||||
new Recipe(effect, Blocks.vault, new ItemStack(Items.titanium, 500), new ItemStack(Items.thorium, 250));
|
||||
new Recipe(effect, Blocks.launchPad, new ItemStack(Items.copper, 500));
|
||||
|
||||
//removed; no longer fits gameplay
|
||||
/*new Recipe(effect, Blocks.core,
|
||||
new ItemStack(Items.copper, 2000), new ItemStack(Items.titanium, 2000),
|
||||
new ItemStack(Items.silicon, 1750), new ItemStack(Items.thorium, 1000),
|
||||
new ItemStack(Items.surgealloy, 500), new ItemStack(Items.phasefabric, 750)
|
||||
);*/
|
||||
|
||||
//projectors
|
||||
new Recipe(effect, Blocks.mendProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.titanium, 150), new ItemStack(Items.titanium, 50), new ItemStack(Items.silicon, 180));
|
||||
new Recipe(effect, Blocks.overdriveProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.titanium, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250));
|
||||
@@ -131,7 +124,7 @@ public class Recipes implements ContentList{
|
||||
new Recipe(power, Blocks.rtgGenerator, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 150), new ItemStack(Items.phasefabric, 50), new ItemStack(Items.plastanium, 150), new ItemStack(Items.thorium, 100));
|
||||
|
||||
//DRILLS, PRODUCERS
|
||||
new Recipe(production, Blocks.mechanicalDrill, new ItemStack(Items.copper, 45)).setAlwaysUnlocked(true);
|
||||
new Recipe(production, Blocks.mechanicalDrill, new ItemStack(Items.copper, 20)).setAlwaysUnlocked(true);
|
||||
new Recipe(production, Blocks.pneumaticDrill, new ItemStack(Items.copper, 60), new ItemStack(Items.graphite, 50));
|
||||
new Recipe(production, Blocks.laserDrill, new ItemStack(Items.copper, 70), new ItemStack(Items.graphite, 90), new ItemStack(Items.silicon, 60), new ItemStack(Items.titanium, 50));
|
||||
new Recipe(production, Blocks.blastDrill, new ItemStack(Items.copper, 130), new ItemStack(Items.silicon, 120), new ItemStack(Items.titanium, 100), new ItemStack(Items.thorium, 60));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.anuke.mindustry.content;
|
||||
|
||||
import io.anuke.mindustry.game.ContentList;
|
||||
import io.anuke.mindustry.game.Rules;
|
||||
import io.anuke.mindustry.maps.generators.BasicGenerator;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.Zone;
|
||||
@@ -12,7 +13,13 @@ public class Zones implements ContentList{
|
||||
public void load(){
|
||||
|
||||
wasteland = new Zone("wasteland", new BasicGenerator(256, 256, Items.lead, Items.copper)){{
|
||||
deployCost = new ItemStack[]{new ItemStack(Items.copper, 2)};
|
||||
deployCost = ItemStack.with(Items.copper, 100);
|
||||
startingItems = ItemStack.with(Items.copper, 50);
|
||||
rules = () -> new Rules(){{
|
||||
waves = true;
|
||||
waveTimer = true;
|
||||
waveSpacing = 60 * 60;
|
||||
}};
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import static io.anuke.mindustry.Vars.waveTeam;
|
||||
public class GameState{
|
||||
/**Current wave number, can be anything in non-wave modes.*/
|
||||
public int wave = 1;
|
||||
/**Wave time in ticks.*/
|
||||
/**Wave countdown in ticks.*/
|
||||
public float wavetime;
|
||||
/**Whether the game is in game over state.*/
|
||||
public boolean gameOver = false;
|
||||
|
||||
@@ -57,14 +57,14 @@ public class Logic implements ApplicationListener{
|
||||
|
||||
public void play(){
|
||||
state.set(State.playing);
|
||||
state.wavetime = 0;
|
||||
state.wavetime = state.rules.waveSpacing * 2; //grace period of 2x wave time before game starts
|
||||
|
||||
Events.fire(new PlayEvent());
|
||||
}
|
||||
|
||||
public void reset(){
|
||||
state.wave = 1;
|
||||
state.wavetime = 0;
|
||||
state.wavetime = state.rules.waveSpacing;
|
||||
state.gameOver = false;
|
||||
state.teams = new Teams();
|
||||
state.rules = new Rules();
|
||||
@@ -79,7 +79,7 @@ public class Logic implements ApplicationListener{
|
||||
public void runWave(){
|
||||
world.spawner.spawnEnemies();
|
||||
state.wave++;
|
||||
state.wavetime = 0;
|
||||
state.wavetime = state.rules.waveSpacing;
|
||||
|
||||
Events.fire(new WaveEvent());
|
||||
}
|
||||
@@ -122,10 +122,10 @@ public class Logic implements ApplicationListener{
|
||||
Time.update();
|
||||
|
||||
if(state.rules.waves && state.rules.waveTimer && !state.gameOver){
|
||||
state.wavetime += Time.delta();
|
||||
state.wavetime = Math.max(state.wavetime - Time.delta(), 0);
|
||||
}
|
||||
|
||||
if(!Net.client() && state.wavetime >= state.rules.waveSpacing && state.rules.waves){
|
||||
if(!Net.client() && state.wavetime <= 0 && state.rules.waves){
|
||||
runWave();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ import io.anuke.mindustry.maps.MapTileData;
|
||||
import io.anuke.mindustry.maps.MapTileData.TileDataMarker;
|
||||
import io.anuke.mindustry.maps.Maps;
|
||||
import io.anuke.mindustry.maps.generators.Generator;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.Zone;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Pos;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
@@ -188,10 +190,16 @@ public class World implements ApplicationListener{
|
||||
return generating;
|
||||
}
|
||||
|
||||
public void playGenerator(Generator generator){
|
||||
public void playZone(Zone zone){
|
||||
ui.loadAnd(() -> {
|
||||
logic.reset();
|
||||
loadGenerator(generator);
|
||||
state.rules = zone.rules.get();
|
||||
loadGenerator(zone.generator);
|
||||
for(Tile core : state.teams.get(defaultTeam).cores){
|
||||
for(ItemStack stack : zone.startingItems){
|
||||
core.entity.items.add(stack.item, stack.amount);
|
||||
}
|
||||
}
|
||||
logic.play();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ public abstract class RandomGenerator extends Generator{
|
||||
}
|
||||
|
||||
tiles[width/2][height/2].setBlock(Blocks.core, Team.blue);
|
||||
tiles[width/2][height/2 - 6].setBlock(Blocks.launchPad, Team.blue);
|
||||
}
|
||||
|
||||
/**Sets {@link #floor} and {@link #block} to the correct values as output.
|
||||
|
||||
@@ -12,4 +12,12 @@ public class ItemStack{
|
||||
public boolean equals(ItemStack other){
|
||||
return other != null && other.item == item && other.amount == amount;
|
||||
}
|
||||
|
||||
public static ItemStack[] with(Object... items){
|
||||
ItemStack[] stacks = new ItemStack[items.length/2];
|
||||
for(int i = 0; i < items.length; i+= 2){
|
||||
stacks[i/2] = new ItemStack((Item)items[i], (Integer)items[i + 1]);
|
||||
}
|
||||
return stacks;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package io.anuke.mindustry.type;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.function.Supplier;
|
||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.mindustry.game.Rules;
|
||||
import io.anuke.mindustry.game.UnlockableContent;
|
||||
import io.anuke.mindustry.maps.generators.Generator;
|
||||
|
||||
@@ -10,6 +12,8 @@ public class Zone extends UnlockableContent{
|
||||
public final String name;
|
||||
public final Generator generator;
|
||||
public ItemStack[] deployCost = {};
|
||||
public ItemStack[] startingItems = {};
|
||||
public Supplier<Rules> rules = Rules::new;
|
||||
|
||||
public Zone(String name, Generator generator){
|
||||
this.name = name;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class DeployDialog extends FloatingDialog{
|
||||
t.addButton(zone.localizedName(), () -> {
|
||||
data.removeItems(zone.deployCost);
|
||||
hide();
|
||||
world.playGenerator(zone.generator);
|
||||
world.playZone(zone);
|
||||
}).size(150f).disabled(b -> !data.hasItems(zone.deployCost));
|
||||
t.row();
|
||||
t.table(req -> {
|
||||
|
||||
Reference in New Issue
Block a user