From 3b3b1520f99542ff96b9fe99661f4aa1bf6bf692 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 13 Nov 2020 12:40:23 -0500 Subject: [PATCH] Apparently every base part had a base tier of 0 this whole time --- core/src/mindustry/ClientLauncher.java | 2 ++ core/src/mindustry/ai/BaseRegistry.java | 6 ++++-- core/src/mindustry/entities/comp/PlayerComp.java | 4 ++-- core/src/mindustry/game/Schematics.java | 3 --- core/src/mindustry/game/Waves.java | 7 ++++--- .../mindustry/maps/generators/BaseGenerator.java | 14 ++++++-------- .../maps/planet/SerpuloPlanetGenerator.java | 1 - core/src/mindustry/type/Planet.java | 4 ++-- 8 files changed, 20 insertions(+), 21 deletions(-) diff --git a/core/src/mindustry/ClientLauncher.java b/core/src/mindustry/ClientLauncher.java index 1d86d8e084..213f465156 100644 --- a/core/src/mindustry/ClientLauncher.java +++ b/core/src/mindustry/ClientLauncher.java @@ -9,6 +9,7 @@ import arc.graphics.g2d.*; import arc.math.*; import arc.util.*; import arc.util.async.*; +import mindustry.ai.*; import mindustry.core.*; import mindustry.ctype.*; import mindustry.game.EventType.*; @@ -104,6 +105,7 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform assets.load(schematics); assets.loadRun("contentinit", ContentLoader.class, () -> content.init(), () -> content.load()); + assets.loadRun("baseparts", BaseRegistry.class, () -> {}, () -> bases.load()); } @Override diff --git a/core/src/mindustry/ai/BaseRegistry.java b/core/src/mindustry/ai/BaseRegistry.java index 269b79d3bf..735e9162ef 100644 --- a/core/src/mindustry/ai/BaseRegistry.java +++ b/core/src/mindustry/ai/BaseRegistry.java @@ -82,7 +82,7 @@ public class BaseRegistry{ } schem.tiles.removeAll(s -> s.block.buildVisibility == BuildVisibility.sandboxOnly); - part.tier = schem.tiles.sumf(s -> Mathf.pow(s.block.buildCost / s.block.buildCostMultiplier, 1.2f)); + part.tier = schem.tiles.sumf(s -> Mathf.pow(s.block.buildCost / s.block.buildCostMultiplier, 1.4f)); if(part.core != null){ cores.add(part); @@ -99,7 +99,9 @@ public class BaseRegistry{ part.centerY = part.schematic.height/2; } - if(part.required != null) reqParts.get(part.required, Seq::new).add(part); + if(part.required != null && part.core == null){ + reqParts.get(part.required, Seq::new).add(part); + } }catch(IOException e){ throw new RuntimeException(e); diff --git a/core/src/mindustry/entities/comp/PlayerComp.java b/core/src/mindustry/entities/comp/PlayerComp.java index 512487b0e0..8cc3d093a2 100644 --- a/core/src/mindustry/entities/comp/PlayerComp.java +++ b/core/src/mindustry/entities/comp/PlayerComp.java @@ -28,7 +28,7 @@ import static mindustry.Vars.*; @EntityDef(value = {Playerc.class}, serialize = false) @Component(base = true) abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Drawc{ - static final float deathDelay = 30f; + static final float deathDelay = 60f; @Import float x, y; @@ -130,7 +130,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra } }else if(core != null){ //have a small delay before death to prevent the camera from jumping around too quickly - //(this is not for balance) + //(this is not for balance, it just looks better this way) deathTimer += Time.delta; if(deathTimer >= deathDelay){ //request spawn - this happens serverside only diff --git a/core/src/mindustry/game/Schematics.java b/core/src/mindustry/game/Schematics.java index 7db0531fb7..7cd51ecec4 100644 --- a/core/src/mindustry/game/Schematics.java +++ b/core/src/mindustry/game/Schematics.java @@ -108,9 +108,6 @@ public class Schematics implements Loadable{ if(shadowBuffer == null){ Core.app.post(() -> shadowBuffer = new FrameBuffer(maxSchematicSize + padding + 8, maxSchematicSize + padding + 8)); } - - //load base schematics - bases.load(); } private void loadLoadouts(){ diff --git a/core/src/mindustry/game/Waves.java b/core/src/mindustry/game/Waves.java index 7b8c12c6ef..8309f99a8b 100644 --- a/core/src/mindustry/game/Waves.java +++ b/core/src/mindustry/game/Waves.java @@ -10,7 +10,7 @@ import mindustry.type.*; import static mindustry.content.UnitTypes.*; public class Waves{ - public static final int waveVersion = 2; + public static final int waveVersion = 3; private Seq spawns; @@ -256,7 +256,8 @@ public class Waves{ } public static Seq generate(float difficulty){ - return generate(new Rand(), difficulty); + //apply power curve to make starting sectors easier + return generate(new Rand(), Mathf.pow(difficulty, 1.12f)); } public static Seq generate(Rand rand, float difficulty){ @@ -339,7 +340,7 @@ public class Waves{ step += (int)(rand.random(15, 30) * Mathf.lerp(1f, 0.5f, difficulty)); } - int bossWave = (int)(rand.random(50, 70) * Mathf.lerp(1f, 0.6f, difficulty)); + int bossWave = (int)(rand.random(50, 70) * Mathf.lerp(1f, 0.5f, difficulty)); int bossSpacing = (int)(rand.random(25, 40) * Mathf.lerp(1f, 0.6f, difficulty)); int bossTier = difficulty < 0.5 ? 3 : 4; diff --git a/core/src/mindustry/maps/generators/BaseGenerator.java b/core/src/mindustry/maps/generators/BaseGenerator.java index d33b8709ba..b63b3a5ad5 100644 --- a/core/src/mindustry/maps/generators/BaseGenerator.java +++ b/core/src/mindustry/maps/generators/BaseGenerator.java @@ -39,24 +39,22 @@ public class BaseGenerator{ Mathf.rand.setSeed(sector.id); - Seq wallsSmall = content.blocks().select(b -> b instanceof Wall && b.size == 1 && b.buildVisibility == BuildVisibility.shown && !(b instanceof Door)); - Seq wallsLarge = content.blocks().select(b -> b instanceof Wall && b.size == 2 && b.buildVisibility == BuildVisibility.shown && !(b instanceof Door)); + Seq wallsSmall = content.blocks().select(b -> b instanceof Wall && b.size == 1 && !b.insulated && b.buildVisibility == BuildVisibility.shown && !(b instanceof Door)); + Seq wallsLarge = content.blocks().select(b -> b instanceof Wall && b.size == 2 && !b.insulated && b.buildVisibility == BuildVisibility.shown && !(b instanceof Door)); //sort by cost for correct fraction wallsSmall.sort(b -> b.buildCost); wallsLarge.sort(b -> b.buildCost); - //TODO proper difficulty selection - float bracket = difficulty; float bracketRange = 0.2f; float baseChance = Mathf.lerp(0.7f, 1.9f, difficulty); int wallAngle = 70; //180 for full coverage double resourceChance = 0.5 * baseChance; double nonResourceChance = 0.0005 * baseChance; - BasePart coreschem = bases.cores.getFrac(bracket); + BasePart coreschem = bases.cores.getFrac(difficulty); int passes = difficulty < 0.4 ? 1 : difficulty < 0.8 ? 2 : 3; - Block wall = wallsSmall.getFrac(bracket), wallLarge = wallsLarge.getFrac(bracket); + Block wall = wallsSmall.getFrac(difficulty), wallLarge = wallsLarge.getFrac(difficulty); for(Tile tile : cores){ tile.clearOverlay(); @@ -78,10 +76,10 @@ public class BaseGenerator{ || (tile.floor().liquidDrop != null && Mathf.chance(nonResourceChance * 2))) && Mathf.chance(resourceChance)){ Seq parts = bases.forResource(tile.drop() != null ? tile.drop() : tile.floor().liquidDrop); if(!parts.isEmpty()){ - tryPlace(parts.getFrac(bracket + Mathf.range(bracketRange)), tile.x, tile.y, team); + tryPlace(parts.getFrac(difficulty + Mathf.range(bracketRange)), tile.x, tile.y, team); } }else if(Mathf.chance(nonResourceChance)){ - tryPlace(bases.parts.getFrac(bracket + Mathf.range(bracketRange)), tile.x, tile.y, team); + tryPlace(bases.parts.getFrac(difficulty + Mathf.range(bracketRange)), tile.x, tile.y, team); } }); } diff --git a/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java b/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java index 5fc443d82a..cd3b224b6f 100644 --- a/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java @@ -431,7 +431,6 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{ state.rules.waves = sector.info.waves = true; state.rules.enemyCoreBuildRadius = 600f; - //TODO better waves state.rules.spawns = Waves.generate(difficulty); } diff --git a/core/src/mindustry/type/Planet.java b/core/src/mindustry/type/Planet.java index a9e6764078..a8911a502a 100644 --- a/core/src/mindustry/type/Planet.java +++ b/core/src/mindustry/type/Planet.java @@ -183,10 +183,10 @@ public class Planet extends UnlockableContent{ } if(sector.hasEnemyBase()){ - sum += 2f; + sum += 2.5f; } - sector.threat = sector.preset == null ? Mathf.clamp(sum / 5f) : Mathf.clamp(sector.preset.difficulty / 10f); + sector.threat = sector.preset == null ? Math.min(sum / 5f, 1.5f) : Mathf.clamp(sector.preset.difficulty / 10f); } }