Drill balancing / More starting resources

This commit is contained in:
Anuken
2018-08-07 16:13:37 -04:00
parent 4b61f273d5
commit 18ebda01a4
4 changed files with 42 additions and 36 deletions

View File

@@ -14,10 +14,6 @@ public class Items implements ContentList{
@Override @Override
public void load(){ public void load(){
stone = new Item("stone", Color.valueOf("777777")){{
hardness = 3;
}};
tungsten = new Item("tungsten", Color.valueOf("a0b0c8")){{ tungsten = new Item("tungsten", Color.valueOf("a0b0c8")){{
type = ItemType.material; type = ItemType.material;
hardness = 1; hardness = 1;
@@ -54,6 +50,10 @@ public class Items implements ContentList{
cost = 1.2f; cost = 1.2f;
}}; }};
stone = new Item("stone", Color.valueOf("777777")){{
hardness = 3;
}};
silicon = new Item("silicon", Color.valueOf("53565c")){{ silicon = new Item("silicon", Color.valueOf("53565c")){{
type = ItemType.material; type = ItemType.material;
cost = 0.9f; cost = 0.9f;

View File

@@ -109,8 +109,8 @@ public class Recipes implements ContentList{
new Recipe(distribution, StorageBlocks.vault, new ItemStack(Items.carbide, 500), new ItemStack(Items.thorium, 350)); new Recipe(distribution, StorageBlocks.vault, new ItemStack(Items.carbide, 500), new ItemStack(Items.thorium, 350));
//DRILLS, PRODUCERS //DRILLS, PRODUCERS
new Recipe(production, ProductionBlocks.tungstenDrill, new ItemStack(Items.tungsten, 15)); new Recipe(production, ProductionBlocks.tungstenDrill, new ItemStack(Items.tungsten, 40));
new Recipe(production, ProductionBlocks.carbideDrill, new ItemStack(Items.tungsten, 25), new ItemStack(Items.carbide, 40)); new Recipe(production, ProductionBlocks.carbideDrill, new ItemStack(Items.tungsten, 50), new ItemStack(Items.carbide, 40));
new Recipe(production, ProductionBlocks.laserdrill, new ItemStack(Items.tungsten, 70), new ItemStack(Items.carbide, 90), new ItemStack(Items.silicon, 60), new ItemStack(Items.titanium, 50)); new Recipe(production, ProductionBlocks.laserdrill, new ItemStack(Items.tungsten, 70), new ItemStack(Items.carbide, 90), new ItemStack(Items.silicon, 60), new ItemStack(Items.titanium, 50));
new Recipe(production, ProductionBlocks.blastdrill, new ItemStack(Items.tungsten, 130), new ItemStack(Items.carbide, 180), new ItemStack(Items.silicon, 120), new ItemStack(Items.titanium, 100), new ItemStack(Items.thorium, 60)); new Recipe(production, ProductionBlocks.blastdrill, new ItemStack(Items.tungsten, 130), new ItemStack(Items.carbide, 180), new ItemStack(Items.silicon, 120), new ItemStack(Items.titanium, 100), new ItemStack(Items.thorium, 60));

View File

@@ -151,17 +151,17 @@ public class Sectors{
//set starter items //set starter items
if(sector.difficulty > 12){ //now with titanium if(sector.difficulty > 12){ //now with titanium
sector.startingItems = Array.with(new ItemStack(Items.tungsten, 1800), new ItemStack(Items.lead, 550), new ItemStack(Items.carbide, 470), new ItemStack(Items.silicon, 460), new ItemStack(Items.titanium, 230)); sector.startingItems = Array.with(new ItemStack(Items.tungsten, 1900), new ItemStack(Items.lead, 600), new ItemStack(Items.carbide, 470), new ItemStack(Items.silicon, 460), new ItemStack(Items.titanium, 230));
}else if(sector.difficulty > 8){ //just more resources }else if(sector.difficulty > 8){ //just more resources
sector.startingItems = Array.with(new ItemStack(Items.tungsten, 1400), new ItemStack(Items.lead, 400), new ItemStack(Items.carbide, 340), new ItemStack(Items.silicon, 250)); sector.startingItems = Array.with(new ItemStack(Items.tungsten, 1500), new ItemStack(Items.lead, 450), new ItemStack(Items.carbide, 340), new ItemStack(Items.silicon, 250));
}else if(sector.difficulty > 5){ //now with silicon }else if(sector.difficulty > 5){ //now with silicon
sector.startingItems = Array.with(new ItemStack(Items.tungsten, 900), new ItemStack(Items.lead, 300), new ItemStack(Items.carbide, 190), new ItemStack(Items.silicon, 140)); sector.startingItems = Array.with(new ItemStack(Items.tungsten, 950), new ItemStack(Items.lead, 350), new ItemStack(Items.carbide, 190), new ItemStack(Items.silicon, 140));
}else if(sector.difficulty > 3){ //now with carbide }else if(sector.difficulty > 3){ //now with carbide
sector.startingItems = Array.with(new ItemStack(Items.tungsten, 650), new ItemStack(Items.lead, 200), new ItemStack(Items.carbide, 130)); sector.startingItems = Array.with(new ItemStack(Items.tungsten, 700), new ItemStack(Items.lead, 250), new ItemStack(Items.carbide, 130));
}else if(sector.difficulty > 1){ //more starter items for faster start }else if(sector.difficulty > 1){ //more starter items for faster start
sector.startingItems = Array.with(new ItemStack(Items.tungsten, 400), new ItemStack(Items.lead, 150)); sector.startingItems = Array.with(new ItemStack(Items.tungsten, 500), new ItemStack(Items.lead, 180));
}else{ //base starting items to prevent grinding much }else{ //base starting items to prevent grinding much
sector.startingItems = Array.with(new ItemStack(Items.tungsten, 150), new ItemStack(Items.lead, 70)); sector.startingItems = Array.with(new ItemStack(Items.tungsten, 170), new ItemStack(Items.lead, 70));
} }
} }

View File

@@ -26,7 +26,6 @@ public class Drill extends Block{
protected final int timerDump = timers++; protected final int timerDump = timers++;
protected final Array<Tile> drawTiles = new Array<>(); protected final Array<Tile> drawTiles = new Array<>();
protected final Array<Item> toAdd = new Array<>();
/**Maximum tier of blocks this drill can mine.*/ /**Maximum tier of blocks this drill can mine.*/
protected int tier; protected int tier;
@@ -140,37 +139,44 @@ public class Drill extends Block{
@Override @Override
public void update(Tile tile){ public void update(Tile tile){
toAdd.clear();
DrillEntity entity = tile.entity(); DrillEntity entity = tile.entity();
float multiplier = 0f; if(entity.dominantItem == null){
float totalHardness = 0f; boolean foundDominant = false;
boolean foundDominant = entity.dominantItem != null;
for(Tile other : tile.getLinkedTiles(tempTiles)){ for(Tile other : tile.getLinkedTiles(tempTiles)){
if(isValid(other)){ if(isValid(other)){
Item drop = getDrop(other); Item drop = getDrop(other);
toAdd.add(drop);
totalHardness += drop.hardness;
multiplier += 1f;
if(!foundDominant){ if(!foundDominant){
entity.dominantItem = drop; entity.dominantItem = drop;
foundDominant = true; foundDominant = true;
}else if(entity.dominantItem != drop){ }else if(entity.dominantItem != drop && drop.id < entity.dominantItem.id){
entity.dominantItem = null; entity.dominantItem = drop;
}
}
}
for(Tile other : tile.getLinkedTiles(tempTiles)){
if(isValid(other) && other.floor().dropsItem(entity.dominantItem)){
entity.dominantItems ++;
} }
} }
} }
if(entity.dominantItem == null){
return;
}
float totalHardness = entity.dominantItems * entity.dominantItem.hardness;
if(entity.timer.get(timerDump, 15)){ if(entity.timer.get(timerDump, 15)){
tryDump(tile); tryDump(tile);
} }
entity.drillTime += entity.warmup * Timers.delta(); entity.drillTime += entity.warmup * Timers.delta();
if(entity.items.total() < itemCapacity && toAdd.size > 0 && entity.cons.valid()){ if(entity.items.total() < itemCapacity && entity.dominantItems > 0 && entity.cons.valid()){
float speed = 1f; float speed = 1f;
@@ -179,7 +185,7 @@ public class Drill extends Block{
} }
entity.warmup = Mathf.lerpDelta(entity.warmup, speed, warmupSpeed); entity.warmup = Mathf.lerpDelta(entity.warmup, speed, warmupSpeed);
entity.progress += Timers.delta() * multiplier * speed * entity.warmup; entity.progress += Timers.delta() * entity.dominantItems * speed * entity.warmup;
if(Mathf.chance(Timers.delta() * updateEffectChance * entity.warmup)) if(Mathf.chance(Timers.delta() * updateEffectChance * entity.warmup))
Effects.effect(updateEffect, entity.x + Mathf.range(size * 2f), entity.y + Mathf.range(size * 2f)); Effects.effect(updateEffect, entity.x + Mathf.range(size * 2f), entity.y + Mathf.range(size * 2f));
@@ -188,18 +194,17 @@ public class Drill extends Block{
return; return;
} }
if(toAdd.size > 0 && entity.progress >= drillTime + hardnessDrillMultiplier * Math.max(totalHardness, 1f) / multiplier if(entity.dominantItems > 0 && entity.progress >= drillTime + hardnessDrillMultiplier * Math.max(totalHardness, 1f) / entity.dominantItems
&& tile.entity.items.total() < itemCapacity){ && tile.entity.items.total() < itemCapacity){
int index = entity.index % toAdd.size; offloadNear(tile, entity.dominantItem);
offloadNear(tile, toAdd.get(index));
useContent(toAdd.get(index)); useContent(entity.dominantItem);
entity.index++; entity.index++;
entity.progress = 0f; entity.progress = 0f;
Effects.effect(drillEffect, toAdd.get(index).color, Effects.effect(drillEffect, entity.dominantItem.color,
entity.x + Mathf.range(size), entity.y + Mathf.range(size)); entity.x + Mathf.range(size), entity.y + Mathf.range(size));
} }
} }
@@ -237,6 +242,7 @@ public class Drill extends Block{
public float warmup; public float warmup;
public float drillTime; public float drillTime;
public int dominantItems;
public Item dominantItem; public Item dominantItem;
} }