diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index d4adbf0738..a4aeee5848 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -22,9 +22,8 @@ stat.destroyed = Buildings Destroyed:[accent] {0} stat.deconstructed = Buildings Deconstructed:[accent] {0} stat.delivered = Resources Launched: -level.highscore = High Score: [accent]{0} -level.delete.title = Confirm Delete map.delete = Are you sure you want to delete the map "[accent]{0}[]"? +level.highscore = High Score: [accent]{0} level.select = Level Select level.mode = Gamemode: construction.desktop = To deselect a block or stop building, [accent]use space[]. @@ -238,7 +237,10 @@ tutorial = Tutorial editor = Editor mapeditor = Map Editor donate = Donate + +complete = Complete: resume = Resume Zone:\n[LIGHT_GRAY]{0} +bestwave = [LIGHT_GRAY]Best: {0} launch = Launch launch.title = Launch Successful diff --git a/core/src/io/anuke/mindustry/content/Blocks.java b/core/src/io/anuke/mindustry/content/Blocks.java index 7448a2f1b5..7d7f222ac7 100644 --- a/core/src/io/anuke/mindustry/content/Blocks.java +++ b/core/src/io/anuke/mindustry/content/Blocks.java @@ -865,10 +865,10 @@ public class Blocks implements ContentList{ duo = new DoubleTurret("duo"){{ requirements(Category.turret, ItemStack.with(Items.copper, 60), true); ammo( - Items.copper, Bullets.standardCopper, - Items.graphite, Bullets.standardDense, - Items.pyratite, Bullets.standardIncendiary, - Items.silicon, Bullets.standardHoming + Items.copper, Bullets.standardCopper, + Items.graphite, Bullets.standardDense, + Items.pyratite, Bullets.standardIncendiary, + Items.silicon, Bullets.standardHoming ); reload = 20f; restitution = 0.03f; diff --git a/core/src/io/anuke/mindustry/content/Bullets.java b/core/src/io/anuke/mindustry/content/Bullets.java index 0cc7113f10..a9d7abd474 100644 --- a/core/src/io/anuke/mindustry/content/Bullets.java +++ b/core/src/io/anuke/mindustry/content/Bullets.java @@ -267,7 +267,7 @@ public class Bullets implements ContentList{ bulletHeight = 9f; homingPower = 5f; reloadMultiplier = 1.4f; - ammoMultiplier = 5; + ammoMultiplier = 3; }}; standardIncendiary = new BasicBulletType(3.2f, 11, "bullet"){{ diff --git a/core/src/io/anuke/mindustry/core/Logic.java b/core/src/io/anuke/mindustry/core/Logic.java index a18d9ea5b2..6554acb117 100644 --- a/core/src/io/anuke/mindustry/core/Logic.java +++ b/core/src/io/anuke/mindustry/core/Logic.java @@ -10,8 +10,8 @@ import io.anuke.arc.entities.EntityQuery; import io.anuke.arc.util.Time; import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.entities.TileEntity; -import io.anuke.mindustry.game.*; import io.anuke.mindustry.game.EventType.*; +import io.anuke.mindustry.game.*; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.world.Tile; @@ -33,6 +33,12 @@ public class Logic implements ApplicationListener{ handleContent(event.tile.block()); } }); + + Events.on(WaveEvent.class, event -> { + if(world.isZone()){ + data.updateWaveScore(world.getZone(), state.wave); + } + }); } @Override diff --git a/core/src/io/anuke/mindustry/game/GlobalData.java b/core/src/io/anuke/mindustry/game/GlobalData.java index 940a300734..126597ed8b 100644 --- a/core/src/io/anuke/mindustry/game/GlobalData.java +++ b/core/src/io/anuke/mindustry/game/GlobalData.java @@ -12,6 +12,7 @@ import io.anuke.mindustry.game.EventType.UnlockEvent; import io.anuke.mindustry.type.ContentType; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.ItemStack; +import io.anuke.mindustry.type.Zone; import static io.anuke.mindustry.Vars.*; @@ -26,6 +27,22 @@ public class GlobalData{ Core.settings.setSerializer(Item.class, (stream, t) -> stream.writeUTF(t.name), stream -> content.getByName(ContentType.item, stream.readUTF())); } + public void updateWaveScore(Zone zone, int wave){ + int value = Core.settings.getInt(zone.name + "-wave", 0); + if(value < wave){ + Core.settings.put(zone.name + "-wave", wave); + modified = true; + } + } + + public int getWaveScore(Zone zone){ + return Core.settings.getInt(zone.name + "-wave", 0); + } + + public boolean isCompleted(Zone zone){ + return getWaveScore(zone) >= zone.conditionWave; + } + public void addItem(Item item, int amount){ modified = true; items.getAndIncrement(item, 0, amount); diff --git a/core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java index f12e903d34..06ebd73159 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java @@ -2,6 +2,7 @@ package io.anuke.mindustry.ui.dialogs; import io.anuke.arc.Core; import io.anuke.arc.collection.ObjectIntMap; +import io.anuke.arc.scene.ui.ScrollPane; import io.anuke.arc.scene.ui.TextButton; import io.anuke.arc.scene.ui.layout.Table; import io.anuke.mindustry.core.GameState.State; @@ -41,32 +42,70 @@ public class DeployDialog extends FloatingDialog{ } } - }}, new Table(){{ + }}, new ScrollPane(new Table(){{ if(control.saves.getZoneSlot() == null){ int i = 0; for(Zone zone : content.zones()){ table(t -> { - TextButton button = t.addButton(zone.localizedName(), () -> { + TextButton button = t.addButton(data.isUnlocked(zone) ? zone.localizedName() : "???", () -> { data.removeItems(zone.deployCost); hide(); world.playZone(zone); - }).size(150f).disabled(b -> !data.hasItems(zone.deployCost) || !data.isUnlocked(zone)).get(); + }).size(200f).disabled(!data.hasItems(zone.deployCost) || !data.isUnlocked(zone)).get(); button.row(); - button.table(req -> { - for(ItemStack stack : zone.deployCost){ - req.addImage(stack.item.region).size(8 * 3); - req.add(stack.amount + "").left(); + + if(data.getWaveScore(zone) > 0){ + button.add(Core.bundle.format("bestwave", data.getWaveScore(zone))); + } + + button.row(); + + if(data.isUnlocked(zone)){ + button.table(req -> { + for(ItemStack stack : zone.deployCost){ + req.addImage(stack.item.region).size(8 * 3); + req.add(stack.amount + "").left(); + } + }).pad(3).growX(); + }else{ + boolean anyNeeded = false; + for(Zone other : zone.zoneRequirements){ + if(!data.isCompleted(other)){ + anyNeeded = true; + break; + } } - }).pad(3).growX(); + + if(anyNeeded){ + button.row(); + button.table(req -> { + req.add("$complete").left(); + req.row(); + for(Zone other : zone.zoneRequirements){ + if(!data.isCompleted(other)){ + req.add("- [LIGHT_GRAY]" + other.localizedName()).left(); + req.row(); + } + } + + req.table(r -> { + if(zone.itemRequirements.length > 0){ + for(ItemStack stack : zone.itemRequirements){ + r.addImage(stack.item.region).size(8 * 3); + r.add(stack.amount + "").left(); + } + } + }); + }).pad(3).growX(); + } + } button.row(); button.addImage("icon-zone-locked").visible(() -> !data.isUnlocked(zone)); - - button.update(() -> button.setText(data.isUnlocked(zone) ? zone.localizedName() : "???")); - }).pad(3); + }).pad(4); if(++i % 4 == 0){ row(); @@ -88,6 +127,6 @@ public class DeployDialog extends FloatingDialog{ }); }).size(200f); } - }}).grow(); + }})).grow(); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ItemTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ItemTurret.java index 47fe135c5a..f2f41708aa 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ItemTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ItemTurret.java @@ -14,7 +14,7 @@ import java.io.DataOutput; import java.io.IOException; public class ItemTurret extends CooledTurret{ - protected int maxAmmo = 50; + protected int maxAmmo = 30; protected ObjectMap ammo = new ObjectMap<>(); public ItemTurret(String name){