From dcbe06229c3ab91f4f91b5292a27853b26bd9b60 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 23 Nov 2020 10:36:41 -0500 Subject: [PATCH] Campaign fixes & balance --- core/assets/bundles/bundle.properties | 1 + core/src/mindustry/content/SectorPresets.java | 2 +- core/src/mindustry/content/UnitTypes.java | 4 ++-- core/src/mindustry/core/Control.java | 15 +++++++++++++-- .../src/mindustry/entities/bullet/BulletType.java | 4 ++-- core/src/mindustry/game/Objectives.java | 12 ++---------- core/src/mindustry/game/Waves.java | 6 +++--- core/src/mindustry/maps/SectorDamage.java | 2 +- core/src/mindustry/type/UnitType.java | 2 +- 9 files changed, 26 insertions(+), 22 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 82654724eb..72f241b9b4 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -147,6 +147,7 @@ planetmap = Planet Map launchcore = Launch Core filename = File Name: unlocked = New content unlocked! +available = New research available! completed = [accent]Completed techtree = Tech Tree research.list = [lightgray]Research: diff --git a/core/src/mindustry/content/SectorPresets.java b/core/src/mindustry/content/SectorPresets.java index 75583b19bf..7e2586eb9d 100644 --- a/core/src/mindustry/content/SectorPresets.java +++ b/core/src/mindustry/content/SectorPresets.java @@ -27,7 +27,7 @@ public class SectorPresets implements ContentList{ }}; frozenForest = new SectorPreset("frozenForest", serpulo, 86){{ - captureWave = 20; + captureWave = 15; difficulty = 2; }}; diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index ed54cf324f..3a3d3041f4 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -556,7 +556,7 @@ public class UnitTypes implements ContentList{ range = 40f; weapons.add(new Weapon(){{ - reload = 12f; + reload = 24f; shootCone = 180f; ejectEffect = Fx.none; shootSound = Sounds.explosion; @@ -1321,7 +1321,7 @@ public class UnitTypes implements ContentList{ sprite = "large-bomb"; width = height = 120/4f; - range = 30f; + maxRange = 30f; ignoreRotation = true; backColor = Pal.heal; diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index cd1768b25c..a810c61946 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -6,6 +6,7 @@ import arc.audio.*; import arc.graphics.g2d.*; import arc.input.*; import arc.math.*; +import arc.scene.style.*; import arc.scene.ui.*; import arc.struct.*; import arc.util.*; @@ -16,6 +17,7 @@ import mindustry.core.GameState.*; import mindustry.entities.*; import mindustry.game.EventType.*; import mindustry.game.*; +import mindustry.game.Objectives.*; import mindustry.game.Saves.*; import mindustry.gen.*; import mindustry.input.*; @@ -24,6 +26,7 @@ import mindustry.io.SaveIO.*; import mindustry.maps.Map; import mindustry.net.*; import mindustry.type.*; +import mindustry.ui.*; import mindustry.ui.dialogs.*; import mindustry.world.*; @@ -124,10 +127,18 @@ public class Control implements ApplicationListener, Loadable{ } })); - Events.on(UnlockEvent.class, e -> ui.hudfrag.showUnlock(e.content)); - Events.on(UnlockEvent.class, e -> { + ui.hudfrag.showUnlock(e.content); + checkAutoUnlocks(); + + if(e.content instanceof SectorPreset){ + for(TechNode node : TechTree.all){ + if(!node.content.unlocked() && node.objectives.contains(o -> o instanceof SectorComplete sec && sec.preset == e.content) && !node.objectives.contains(o -> !o.complete())){ + ui.hudfrag.showToast(new TextureRegionDrawable(node.content.icon(Cicon.large)), bundle.get("available")); + } + } + } }); Events.on(SectorCaptureEvent.class, e -> { diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index f3d09de8ed..a384dd18b2 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -78,7 +78,7 @@ public abstract class BulletType extends Content{ * Do not change unless you know what you're doing. */ public boolean backMove = true; /** Bullet range override. */ - public float range = -1f; + public float maxRange = -1f; /** % of block health healed **/ public float healPercent = 0f; /** whether to make fire on impact */ @@ -154,7 +154,7 @@ public abstract class BulletType extends Content{ /** Returns maximum distance the bullet this bullet type has can travel. */ public float range(){ - return Math.max(speed * lifetime * (1f - drag), range); + return Math.max(speed * lifetime * (1f - drag), maxRange); } public boolean collides(Bullet bullet, Building tile){ diff --git a/core/src/mindustry/game/Objectives.java b/core/src/mindustry/game/Objectives.java index acf7fad876..bf306cb957 100644 --- a/core/src/mindustry/game/Objectives.java +++ b/core/src/mindustry/game/Objectives.java @@ -48,7 +48,8 @@ public class Objectives{ } } - public static class SectorComplete extends SectorObjective{ + public static class SectorComplete implements Objective{ + public SectorPreset preset; public SectorComplete(SectorPreset zone){ this.preset = zone; @@ -67,11 +68,6 @@ public class Objectives{ } } - //TODO merge - public abstract static class SectorObjective implements Objective{ - public SectorPreset preset; - } - /** Defines a specific objective for a game. */ public interface Objective{ @@ -86,9 +82,5 @@ public class Objectives{ default void build(Table table){ } - - default SectorPreset zone(){ - return this instanceof SectorObjective ? ((SectorObjective)this).preset : null; - } } } diff --git a/core/src/mindustry/game/Waves.java b/core/src/mindustry/game/Waves.java index 586fb285c1..8e65a0b1b9 100644 --- a/core/src/mindustry/game/Waves.java +++ b/core/src/mindustry/game/Waves.java @@ -277,7 +277,7 @@ public class Waves{ int cap = 150; float shieldStart = 30, shieldsPerWave = 20 + difficulty*30f; - float[] scaling = {1, 1, 1.5f, 3f, 4f}; + float[] scaling = {1, 1.2f, 1.5f, 3f, 4f}; Intc createProgression = start -> { //main sequence @@ -298,7 +298,7 @@ public class Waves{ begin = f; end = f + next >= cap ? never : f + next; max = 13; - unitScaling = (difficulty < 0.4f ? rand.random(2.5f, 4f) : rand.random(1f, 4f)) * scaling[ctier]; + unitScaling = (difficulty < 0.4f ? rand.random(2.5f, 5f) : rand.random(1f, 4f)) * scaling[ctier]; shields = shieldAmount; shieldScaling = shieldsPerWave; spacing = space; @@ -310,7 +310,7 @@ public class Waves{ begin = f + next - 1; end = f + next + rand.random(6, 10); max = 6; - unitScaling = rand.random(1f, 2f); + unitScaling = rand.random(2f, 4f); spacing = rand.random(2, 4); shields = shieldAmount/2f; shieldScaling = shieldsPerWave; diff --git a/core/src/mindustry/maps/SectorDamage.java b/core/src/mindustry/maps/SectorDamage.java index 1fce5590e9..156c49515f 100644 --- a/core/src/mindustry/maps/SectorDamage.java +++ b/core/src/mindustry/maps/SectorDamage.java @@ -233,7 +233,7 @@ public class SectorDamage{ //first, calculate the total health of blocks in the path //radius around the path that gets counted - int radius = 8; + int radius = 9; IntSet counted = new IntSet(); for(Tile t : sparse2){ diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index a83f6532ae..f5a40de645 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -328,7 +328,7 @@ public class UnitType extends UnlockableContent{ //suicide enemy if(weapons.contains(w -> w.bullet.killShooter)){ //scale down DPS to be insignificant - dpsEstimate /= 20f; + dpsEstimate /= 25f; } } }