From d06b32c20b2310db73924ddd0edb04b3604017eb Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 27 Nov 2020 14:18:09 -0500 Subject: [PATCH] Added boss to sector damage calculations --- core/src/mindustry/core/Control.java | 2 ++ core/src/mindustry/game/SectorInfo.java | 4 +++- core/src/mindustry/maps/SectorDamage.java | 26 +++++++++++++++++++++++ gradle.properties | 2 +- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index 2a1c79f107..4f4f45bd64 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -336,6 +336,8 @@ public class Control implements ApplicationListener, Loadable{ state.wavetime = state.rules.waveSpacing * 2f; //reset captured state sector.info.wasCaptured = false; + //re-enable waves + state.rules.waves = true; //reset win wave?? state.rules.winWave = state.rules.attackMode ? -1 : sector.preset != null ? sector.preset.captureWave : 40; diff --git a/core/src/mindustry/game/SectorInfo.java b/core/src/mindustry/game/SectorInfo.java index 50425ec4af..2701fc1dcb 100644 --- a/core/src/mindustry/game/SectorInfo.java +++ b/core/src/mindustry/game/SectorInfo.java @@ -71,7 +71,9 @@ public class SectorInfo{ public boolean shown = false; /** Special variables for simulation. */ - public float sumHealth, sumRps, sumDps, waveHealthBase, waveHealthSlope, waveDpsBase, waveDpsSlope; + public float sumHealth, sumRps, sumDps, waveHealthBase, waveHealthSlope, waveDpsBase, waveDpsSlope, bossHealth, bossDps; + /** Wave where first boss shows up. */ + public int bossWave = -1; /** Counter refresh state. */ private transient Interval time = new Interval(); diff --git a/core/src/mindustry/maps/SectorDamage.java b/core/src/mindustry/maps/SectorDamage.java index 128ec3fcd2..cab8c2060b 100644 --- a/core/src/mindustry/maps/SectorDamage.java +++ b/core/src/mindustry/maps/SectorDamage.java @@ -68,6 +68,11 @@ public class SectorDamage{ float enemyDps = info.waveDpsBase + info.waveDpsSlope * (i); float enemyHealth = info.waveHealthBase + info.waveHealthSlope * (i); + if(info.bossWave == i){ + enemyDps += info.bossDps; + enemyHealth += info.bossHealth; + } + //happens due to certain regressions if(enemyHealth < 0 || enemyDps < 0) continue; @@ -305,6 +310,7 @@ public class SectorDamage{ //calculate DPS and health for the next few waves and store in list var reg = new LinearRegression(); + SpawnGroup bossGroup = null; Seq waveDps = new Seq<>(), waveHealth = new Seq<>(); for(int wave = state.wave; wave < state.wave + 10; wave ++){ @@ -320,6 +326,11 @@ public class SectorDamage{ float healthMult = 1f + Mathf.clamp(group.type.armor / 20f); StatusEffect effect = (group.effect == null ? StatusEffects.none : group.effect); int spawned = group.getSpawned(wave); + //save the boss group + if(group.effect == StatusEffects.boss){ + bossGroup = group; + continue; + } if(spawned <= 0) continue; sumWaveHealth += spawned * (group.getShield(wave) + group.type.health * effect.healthMultiplier * healthMult); sumWaveDps += spawned * group.type.dpsEstimate * effect.damageMultiplier; @@ -328,6 +339,21 @@ public class SectorDamage{ waveHealth.add(new Vec2(wave, sumWaveHealth)); } + if(bossGroup != null){ + float bossMult = 1.1f; + //calculate first boss appearaance + for(int wave = state.wave; wave < state.wave + 60; wave++){ + int spawned = bossGroup.getSpawned(wave - 1); + if(spawned > 0){ + //set up relevant stats + info.bossWave = wave; + info.bossDps = spawned * bossGroup.type.dpsEstimate * StatusEffects.boss.damageMultiplier * bossMult; + info.bossHealth = spawned * (bossGroup.getShield(wave) + bossGroup.type.health * StatusEffects.boss.healthMultiplier * (1f + Mathf.clamp(bossGroup.type.armor / 20f))) * bossMult; + break; + } + } + } + //calculate linear regression of the wave data and store it reg.calculate(waveHealth); info.waveHealthBase = reg.intercept; diff --git a/gradle.properties b/gradle.properties index 2599276717..c95e0534b6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=d0690313b33aeb5e611005f5a03516d2cdcec338 +archash=2d451f0c342755ef84e609c951a8fca654ef41b5