Added starter items based on difficulty

This commit is contained in:
Anuken
2018-08-06 12:22:55 -04:00
parent 80001246ef
commit 1f8918c773
3 changed files with 27 additions and 3 deletions

View File

@@ -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<Item> 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<ItemStack> startingItems;
public Mission currentMission(){
return missions.get(Math.min(completedMissions, missions.size - 1));

View File

@@ -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){