mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-13 12:16:53 +07:00
Added boss to sector damage calculations
This commit is contained in:
parent
525dc0cd7e
commit
d06b32c20b
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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<Vec2> 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;
|
||||
|
@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=d0690313b33aeb5e611005f5a03516d2cdcec338
|
||||
archash=2d451f0c342755ef84e609c951a8fca654ef41b5
|
||||
|
Loading…
Reference in New Issue
Block a user