From a12583eb4dc37dd2994f05b1e30e096110d764c7 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 30 Oct 2020 12:54:24 -0400 Subject: [PATCH] Campaign survival wave display tweaks --- core/src/mindustry/content/Bullets.java | 4 +- core/src/mindustry/maps/SectorDamage.java | 78 ++++++++++--------- .../mindustry/ui/dialogs/PlanetDialog.java | 5 +- 3 files changed, 46 insertions(+), 41 deletions(-) diff --git a/core/src/mindustry/content/Bullets.java b/core/src/mindustry/content/Bullets.java index e76eb681a4..b8a6ab843f 100644 --- a/core/src/mindustry/content/Bullets.java +++ b/core/src/mindustry/content/Bullets.java @@ -424,7 +424,7 @@ public class Bullets implements ContentList{ } }; - basicFlame = new BulletType(3.35f, 15f){{ + basicFlame = new BulletType(3.35f, 16f){{ ammoMultiplier = 3f; hitSize = 7f; lifetime = 18f; @@ -439,7 +439,7 @@ public class Bullets implements ContentList{ hittable = false; }}; - pyraFlame = new BulletType(3.35f, 22f){{ + pyraFlame = new BulletType(3.35f, 25f){{ ammoMultiplier = 4f; hitSize = 7f; lifetime = 18f; diff --git a/core/src/mindustry/maps/SectorDamage.java b/core/src/mindustry/maps/SectorDamage.java index b3f3d5d960..6b59328f12 100644 --- a/core/src/mindustry/maps/SectorDamage.java +++ b/core/src/mindustry/maps/SectorDamage.java @@ -21,9 +21,10 @@ import mindustry.world.blocks.storage.*; import static mindustry.Vars.*; public class SectorDamage{ + public static final int maxRetWave = 30, maxWavesSimulated = 50; + //direct damage is for testing only private static final boolean direct = false, rubble = true; - private static final int maxWavesSimulated = 50, maxRetWave = 100; /** @return calculated capture progress of the enemy */ public static float getDamage(SectorInfo info){ @@ -107,7 +108,7 @@ public class SectorDamage{ float damage = getDamage(state.rules.sector.info); //scaled damage has a power component to make it seem a little more realistic (as systems fail, enemy capturing gets easier and easier) - float scaled = Mathf.pow(damage, 1.5f); + float scaled = Mathf.pow(damage, 1.6f); //apply damage to units float unitDamage = damage * state.rules.sector.info.sumHealth; @@ -429,54 +430,57 @@ public class SectorDamage{ float falloff = (damage) / (Math.max(tiles.width, tiles.height) * Mathf.sqrt2); int peak = 0; - //phase two: propagate the damage - while(!frontier.isEmpty()){ - peak = Math.max(peak, frontier.size); - Tile tile = frontier.removeFirst(); - float currDamage = values[tile.x][tile.y] - falloff; + if(damage > 0.1f){ + //phase two: propagate the damage + while(!frontier.isEmpty()){ + peak = Math.max(peak, frontier.size); + Tile tile = frontier.removeFirst(); + float currDamage = values[tile.x][tile.y] - falloff; - for(int i = 0; i < 4; i++){ - int cx = tile.x + Geometry.d4x[i], cy = tile.y + Geometry.d4y[i]; + for(int i = 0; i < 4; i++){ + int cx = tile.x + Geometry.d4x[i], cy = tile.y + Geometry.d4y[i]; - //propagate to new tiles - if(tiles.in(cx, cy) && values[cx][cy] < currDamage){ - Tile other = tiles.getn(cx, cy); - float resultDamage = currDamage; + //propagate to new tiles + if(tiles.in(cx, cy) && values[cx][cy] < currDamage){ + Tile other = tiles.getn(cx, cy); + float resultDamage = currDamage; - //damage the tile if it's not friendly - if(other.build != null && other.team() != state.rules.waveTeam){ - resultDamage -= other.build.health(); + //damage the tile if it's not friendly + if(other.build != null && other.team() != state.rules.waveTeam){ + resultDamage -= other.build.health(); - if(direct){ - other.build.damage(currDamage); - }else{ //indirect damage happens at game load time - other.build.health -= currDamage; - //don't kill the core! - if(other.block() instanceof CoreBlock) other.build.health = Math.max(other.build.health, 1f); + if(direct){ + other.build.damage(currDamage); + }else{ //indirect damage happens at game load time + other.build.health -= currDamage; + //don't kill the core! + if(other.block() instanceof CoreBlock) other.build.health = Math.max(other.build.health, 1f); - //remove the block when destroyed - if(other.build.health < 0){ - //rubble - if(rubble && !other.floor().solid && !other.floor().isLiquid && Mathf.chance(0.4)){ - Effect.rubble(other.build.x, other.build.y, other.block().size); + //remove the block when destroyed + if(other.build.health < 0){ + //rubble + if(rubble && !other.floor().solid && !other.floor().isLiquid && Mathf.chance(0.4)){ + Effect.rubble(other.build.x, other.build.y, other.block().size); + } + + other.build.addPlan(false); + other.remove(); } - - other.build.addPlan(false); - other.remove(); } + + }else if(other.solid() && !other.synthetic()){ //skip damage propagation through solid blocks + continue; } - }else if(other.solid() && !other.synthetic()){ //skip damage propagation through solid blocks - continue; - } - - if(resultDamage > 0 && values[cx][cy] < resultDamage){ - frontier.addLast(other); - values[cx][cy] = resultDamage; + if(resultDamage > 0 && values[cx][cy] < resultDamage){ + frontier.addLast(other); + values[cx][cy] = resultDamage; + } } } } } + } static float cost(Tile tile){ diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 3cf4840d1c..9b541949ef 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -20,6 +20,7 @@ import mindustry.game.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.graphics.g3d.*; +import mindustry.maps.*; import mindustry.type.*; import mindustry.ui.*; import mindustry.world.blocks.storage.*; @@ -382,8 +383,8 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ 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"); + boolean plus = (sector.info.wavesSurvived - sector.info.wavesPassed) >= SectorDamage.maxRetWave - 1; + stable.add("[accent]Will survive\n" + (sector.info.wavesSurvived - sector.info.wavesPassed) + (plus ? "+" : "") + " waves"); stable.row(); } }