diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index cd4e6b3463..7c99e603dc 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -483,6 +483,7 @@ launch.text = Launch research.multiplayer = Only the host can research items. uncover = Uncover configure = Configure Loadout + #TODO loadout = Loadout resources = Resources diff --git a/core/src/mindustry/content/TechTree.java b/core/src/mindustry/content/TechTree.java index 63eb9f2679..7855e14a3a 100644 --- a/core/src/mindustry/content/TechTree.java +++ b/core/src/mindustry/content/TechTree.java @@ -112,7 +112,7 @@ public class TechTree implements ContentList{ node(Items.graphite, with(Items.coal, 1000), () -> { node(graphitePress, () -> { - node(Items.titanium, with(Items.graphite, 6000, Items.copper, 10000, Items.lead, 10000), () -> { + node(Items.titanium, with(Items.graphite, 3000, Items.copper, 7000, Items.lead, 7000), () -> { node(pneumaticDrill, () -> { node(Items.sporePod, with(Items.coal, 5000, Items.graphite, 5000, Items.lead, 5000), () -> { node(cultivator, () -> { diff --git a/core/src/mindustry/game/SectorInfo.java b/core/src/mindustry/game/SectorInfo.java index 8fd048a533..90e70a9521 100644 --- a/core/src/mindustry/game/SectorInfo.java +++ b/core/src/mindustry/game/SectorInfo.java @@ -45,6 +45,8 @@ public class SectorInfo{ public boolean attack = false; /** Wave # from state */ public int wave = 1, winWave = -1; + /** Waves this sector can survive if under attack. Based on wave in info. <0 means uncalculated. */ + public int wavesSurvived = -1; /** Time between waves. */ public float waveSpacing = 60 * 60 * 2; /** Damage dealt to sector. */ diff --git a/core/src/mindustry/game/Universe.java b/core/src/mindustry/game/Universe.java index fa96e491a2..cfb0a58b0f 100644 --- a/core/src/mindustry/game/Universe.java +++ b/core/src/mindustry/game/Universe.java @@ -84,7 +84,7 @@ public class Universe{ if(state.hasSector()){ //update sector light float light = state.getSector().getLight(); - float alpha = Mathf.clamp(Mathf.map(light, 0f, 0.8f, 0.1f, 1f)); + float alpha = Mathf.clamp(Mathf.map(light, 0f, 0.8f, 0.2f, 1f)); //assign and map so darkness is not 100% dark state.rules.ambientLight.a = 1f - alpha; diff --git a/core/src/mindustry/maps/SectorDamage.java b/core/src/mindustry/maps/SectorDamage.java index 5e1c36b539..b3f3d5d960 100644 --- a/core/src/mindustry/maps/SectorDamage.java +++ b/core/src/mindustry/maps/SectorDamage.java @@ -23,7 +23,7 @@ import static mindustry.Vars.*; public class SectorDamage{ //direct damage is for testing only private static final boolean direct = false, rubble = true; - private static final int maxWavesSimulated = 50; + private static final int maxWavesSimulated = 50, maxRetWave = 100; /** @return calculated capture progress of the enemy */ public static float getDamage(SectorInfo info){ @@ -32,6 +32,17 @@ public class SectorDamage{ /** @return calculated capture progress of the enemy */ public static float getDamage(SectorInfo info, int wavesPassed){ + return getDamage(info, wavesPassed, false); + } + + /** @return maximum waves survived, up to maxRetWave. */ + public static int getWavesSurvived(SectorInfo info){ + return (int)getDamage(info, maxRetWave, true); + } + + /** @return calculated capture progress of the enemy if retWave if false, otherwise return the maximum waves survived as int. + * if it survives all the waves, returns maxRetWave. */ + public static float getDamage(SectorInfo info, int wavesPassed, boolean retWave){ float health = info.sumHealth; int wave = info.wave; float waveSpace = info.waveSpacing; @@ -43,7 +54,7 @@ public class SectorDamage{ int waveEnd = wave + wavesPassed; //do not simulate every single wave if there's too many - if(wavesPassed > maxWavesSimulated){ + if(wavesPassed > maxWavesSimulated && !retWave){ waveBegin = waveEnd - maxWavesSimulated; } @@ -66,6 +77,8 @@ public class SectorDamage{ //sector is lost, enemy took too long. if(timeDestroyEnemy > timeDestroyBase){ health = 0f; + //return current wave if simulating + if(retWave) return i - waveBegin; break; } @@ -80,6 +93,11 @@ public class SectorDamage{ } } + //survived everything + if(retWave){ + return maxRetWave; + } + return 1f - Mathf.clamp(health / info.sumHealth); } @@ -318,8 +336,7 @@ public class SectorDamage{ info.sumDps = sumDps * 1.5f; info.sumRps = sumRps; - //finally, find an equation to put it all together and produce a 0-1 number - //due to the way most defenses are structured, this number will likely need a ^4 power or so + info.wavesSurvived = getWavesSurvived(info); } public static void apply(float fraction){ diff --git a/core/src/mindustry/type/Sector.java b/core/src/mindustry/type/Sector.java index bee7809de5..4d35ea220f 100644 --- a/core/src/mindustry/type/Sector.java +++ b/core/src/mindustry/type/Sector.java @@ -39,17 +39,6 @@ public class Sector{ this.id = tile.id; } - /** @return a copy of the items in this sector - may be core items, or stored data. */ - public ItemSeq getItems(){ - if(isBeingPlayed()){ - ItemSeq out = new ItemSeq(); - if(state.rules.defaultTeam.core() != null) out.add(state.rules.defaultTeam.core().items); - return out; - }else{ - return info.items; - } - } - public Seq near(){ tmpSeq1.clear(); for(Ptile tile : tile.tiles){ @@ -181,7 +170,7 @@ public class Sector{ //for sectors being played on, add items directly if(isBeingPlayed()){ - count.add(state.rules.defaultTeam.items()); + if(state.rules.defaultTeam.core() != null) count.add(state.rules.defaultTeam.items()); }else{ //add items already present count.add(info.items); diff --git a/core/src/mindustry/ui/dialogs/LaunchLoadoutDialog.java b/core/src/mindustry/ui/dialogs/LaunchLoadoutDialog.java index 6a90ce322f..9f03ba3532 100644 --- a/core/src/mindustry/ui/dialogs/LaunchLoadoutDialog.java +++ b/core/src/mindustry/ui/dialogs/LaunchLoadoutDialog.java @@ -38,7 +38,7 @@ public class LaunchLoadoutDialog extends BaseDialog{ addCloseListener(); - ItemSeq sitems = sector.getItems(); + ItemSeq sitems = sector.items(); //updates sum requirements Runnable update = () -> { @@ -59,7 +59,7 @@ public class LaunchLoadoutDialog extends BaseDialog{ table.image(s.item.icon(Cicon.small)).left(); int as = schems.get(s.item), al = launches.get(s.item); - String amountStr = "[lightgray]" + (al + " + [accent]" + as + "[lightgray]"); + String amountStr = (al + as) + "[gray] (" + (al + " + " + as + ")"); table.add( sitems.has(s.item, s.amount) ? amountStr : diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index a0536d87f4..3cf4840d1c 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -380,6 +380,12 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ stable.row(); stable.add("[accent]" + (int)(sector.info.damage * 100) + "% damaged"); stable.row(); + + if(sector.info.wavesSurvived >= 0 && sector.info.wavesSurvived - sector.info.wavesPassed >= 0 && !sector.isBeingPlayed()){ + boolean plus = (sector.info.wavesSurvived - sector.info.wavesPassed) >= 99; + stable.add("[accent]Will survive " + (sector.info.wavesSurvived - sector.info.wavesPassed) + (plus ? "+" : "") + " waves"); + stable.row(); + } } if(sector.save != null && sector.info.resources.any()){ @@ -416,14 +422,16 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ } } + ItemSeq items = sector.items(); + //stored resources - if(sector.hasBase() && sector.info.items.total > 0){ + if(sector.hasBase() && items.total > 0){ + stable.add("@sectors.stored").row(); stable.table(t -> { t.left(); t.table(res -> { - ItemSeq items = sector.items(); int i = 0; for(ItemStack stack : items){ diff --git a/core/src/mindustry/world/blocks/storage/CoreBlock.java b/core/src/mindustry/world/blocks/storage/CoreBlock.java index 9ed4285070..c1bcca2418 100644 --- a/core/src/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/mindustry/world/blocks/storage/CoreBlock.java @@ -217,7 +217,7 @@ public class CoreBlock extends StorageBlock{ @Override public void drawLight(){ - Drawf.light(team, x, y, 30f * size, Pal.accent, 0.5f + Mathf.absin(20f, 0.1f)); + Drawf.light(team, x, y, 30f + 20f * size, Pal.accent, 0.65f + Mathf.absin(20f, 0.1f)); } @Override