From 9c54fcee2ef1094f5122f6e847df00cee26ceb98 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 31 Oct 2020 13:42:43 -0400 Subject: [PATCH] Sector damage calculation fix --- core/src/mindustry/entities/bullet/LightningBulletType.java | 5 +++++ core/src/mindustry/maps/SectorDamage.java | 3 +++ core/src/mindustry/type/UnitType.java | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/entities/bullet/LightningBulletType.java b/core/src/mindustry/entities/bullet/LightningBulletType.java index dbfbcc0301..6421eedb77 100644 --- a/core/src/mindustry/entities/bullet/LightningBulletType.java +++ b/core/src/mindustry/entities/bullet/LightningBulletType.java @@ -26,6 +26,11 @@ public class LightningBulletType extends BulletType{ return (lightningLength + lightningLengthRand/2f) * 6f; } + @Override + public float estimateDPS(){ + return super.estimateDPS() * Math.max(lightningLength / 2f, 1); + } + @Override public void draw(Bullet b){ } diff --git a/core/src/mindustry/maps/SectorDamage.java b/core/src/mindustry/maps/SectorDamage.java index bc7c4b8cef..79ae02be5c 100644 --- a/core/src/mindustry/maps/SectorDamage.java +++ b/core/src/mindustry/maps/SectorDamage.java @@ -75,6 +75,9 @@ public class SectorDamage{ float timeDestroyEnemy = dps <= 0.0001f ? Float.POSITIVE_INFINITY : enemyHealth / dps; //if dps == 0, this is infinity float timeDestroyBase = health / (enemyDps - rps); //if regen > enemyDps this is negative + //regenerating faster than the base can be damaged + if(timeDestroyBase < 0) continue; + //sector is lost, enemy took too long. if(timeDestroyEnemy > timeDestroyBase){ health = 0f; diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 2c425c0223..09c4f4bca4 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -323,7 +323,7 @@ public class UnitType extends UnlockableContent{ //suicide enemy if(weapons.contains(w -> w.bullet.killShooter)){ //scale down DPS to be insignificant - dpsEstimate /= 100f; + dpsEstimate /= 40f; } } }