From 1f8918c7737cc39c6c10cd87b9d821c7199dacec Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 6 Aug 2018 12:22:55 -0400 Subject: [PATCH] Added starter items based on difficulty --- core/src/io/anuke/mindustry/core/Logic.java | 12 +++++++++--- core/src/io/anuke/mindustry/maps/Sector.java | 3 +++ core/src/io/anuke/mindustry/maps/Sectors.java | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/core/src/io/anuke/mindustry/core/Logic.java b/core/src/io/anuke/mindustry/core/Logic.java index 89eeb2d4a0..bfc0d49b68 100644 --- a/core/src/io/anuke/mindustry/core/Logic.java +++ b/core/src/io/anuke/mindustry/core/Logic.java @@ -1,5 +1,6 @@ package io.anuke.mindustry.core; +import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.Vars; import io.anuke.mindustry.content.Items; import io.anuke.mindustry.core.GameState.State; @@ -13,6 +14,7 @@ import io.anuke.mindustry.game.TeamInfo; import io.anuke.mindustry.game.TeamInfo.TeamData; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.type.Item; +import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.ItemType; import io.anuke.mindustry.world.Tile; import io.anuke.ucore.core.Events; @@ -57,9 +59,13 @@ public class Logic extends Module{ tile.entity.items.set(item, 1000); } } - }else if(!state.mode.infiniteResources){ - tile.entity.items.add(Items.tungsten, 50); - tile.entity.items.add(Items.lead, 20); + } + + if(world.getSector() != null){ + Array items = world.getSector().startingItems; + for(ItemStack stack : items){ + tile.entity.items.add(stack.item, stack.amount); + } } } } diff --git a/core/src/io/anuke/mindustry/maps/Sector.java b/core/src/io/anuke/mindustry/maps/Sector.java index 1618b0c694..65847df630 100644 --- a/core/src/io/anuke/mindustry/maps/Sector.java +++ b/core/src/io/anuke/mindustry/maps/Sector.java @@ -6,6 +6,7 @@ import io.anuke.mindustry.game.Saves.SaveSlot; import io.anuke.mindustry.game.SpawnGroup; import io.anuke.mindustry.maps.missions.Mission; import io.anuke.mindustry.type.Item; +import io.anuke.mindustry.type.ItemStack; import io.anuke.ucore.util.Bits; import static io.anuke.mindustry.Vars.control; @@ -31,6 +32,8 @@ public class Sector{ public transient Array ores = new Array<>(); /**Difficulty of the sector, measured by calculating distance from origin and applying scaling.*/ public transient int difficulty; + /**Items the player starts with on this sector.*/ + public transient Array startingItems; public Mission currentMission(){ return missions.get(Math.min(completedMissions, missions.size - 1)); diff --git a/core/src/io/anuke/mindustry/maps/Sectors.java b/core/src/io/anuke/mindustry/maps/Sectors.java index 03648ad0ed..9d6d4752f8 100644 --- a/core/src/io/anuke/mindustry/maps/Sectors.java +++ b/core/src/io/anuke/mindustry/maps/Sectors.java @@ -11,6 +11,7 @@ import io.anuke.mindustry.game.Team; import io.anuke.mindustry.maps.generation.WorldGenerator.GenResult; import io.anuke.mindustry.maps.missions.BattleMission; import io.anuke.mindustry.maps.missions.WaveMission; +import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.world.ColorMapper; import io.anuke.mindustry.world.Edges; import io.anuke.ucore.core.Settings; @@ -147,6 +148,20 @@ public class Sectors{ //add all ores for now since material differences aren't well handled yet sector.ores.addAll(Items.tungsten, Items.coal, Items.lead, Items.thorium, Items.titanium); + + if(sector.difficulty > 12){ //now with titanium + sector.startingItems = Array.with(new ItemStack(Items.tungsten, 600), new ItemStack(Items.lead, 450), new ItemStack(Items.carbide, 400), new ItemStack(Items.silicon, 250), new ItemStack(Items.titanium, 150)); + }else if(sector.difficulty > 8){ //just more resources + sector.startingItems = Array.with(new ItemStack(Items.tungsten, 450), new ItemStack(Items.lead, 350), new ItemStack(Items.carbide, 250), new ItemStack(Items.silicon, 160)); + }else if(sector.difficulty > 5){ //now with silicon + sector.startingItems = Array.with(new ItemStack(Items.tungsten, 350), new ItemStack(Items.lead, 250), new ItemStack(Items.carbide, 150), new ItemStack(Items.silicon, 80)); + }else if(sector.difficulty > 3){ //now with carbide + sector.startingItems = Array.with(new ItemStack(Items.tungsten, 220), new ItemStack(Items.lead, 160), new ItemStack(Items.carbide, 70)); + }else if(sector.difficulty > 1){ //more starter items for faster start + sector.startingItems = Array.with(new ItemStack(Items.tungsten, 170), new ItemStack(Items.lead, 110)); + }else{ //base starting items to prevent grinding much + sector.startingItems = Array.with(new ItemStack(Items.tungsten, 50), new ItemStack(Items.lead, 50)); + } } private int round2(int i){