Campaign survival wave display tweaks
This commit is contained in:
@@ -424,7 +424,7 @@ public class Bullets implements ContentList{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
basicFlame = new BulletType(3.35f, 15f){{
|
basicFlame = new BulletType(3.35f, 16f){{
|
||||||
ammoMultiplier = 3f;
|
ammoMultiplier = 3f;
|
||||||
hitSize = 7f;
|
hitSize = 7f;
|
||||||
lifetime = 18f;
|
lifetime = 18f;
|
||||||
@@ -439,7 +439,7 @@ public class Bullets implements ContentList{
|
|||||||
hittable = false;
|
hittable = false;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
pyraFlame = new BulletType(3.35f, 22f){{
|
pyraFlame = new BulletType(3.35f, 25f){{
|
||||||
ammoMultiplier = 4f;
|
ammoMultiplier = 4f;
|
||||||
hitSize = 7f;
|
hitSize = 7f;
|
||||||
lifetime = 18f;
|
lifetime = 18f;
|
||||||
|
|||||||
@@ -21,9 +21,10 @@ import mindustry.world.blocks.storage.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class SectorDamage{
|
public class SectorDamage{
|
||||||
|
public static final int maxRetWave = 30, maxWavesSimulated = 50;
|
||||||
|
|
||||||
//direct damage is for testing only
|
//direct damage is for testing only
|
||||||
private static final boolean direct = false, rubble = true;
|
private static final boolean direct = false, rubble = true;
|
||||||
private static final int maxWavesSimulated = 50, maxRetWave = 100;
|
|
||||||
|
|
||||||
/** @return calculated capture progress of the enemy */
|
/** @return calculated capture progress of the enemy */
|
||||||
public static float getDamage(SectorInfo info){
|
public static float getDamage(SectorInfo info){
|
||||||
@@ -107,7 +108,7 @@ public class SectorDamage{
|
|||||||
float damage = getDamage(state.rules.sector.info);
|
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)
|
//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
|
//apply damage to units
|
||||||
float unitDamage = damage * state.rules.sector.info.sumHealth;
|
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);
|
float falloff = (damage) / (Math.max(tiles.width, tiles.height) * Mathf.sqrt2);
|
||||||
int peak = 0;
|
int peak = 0;
|
||||||
|
|
||||||
//phase two: propagate the damage
|
if(damage > 0.1f){
|
||||||
while(!frontier.isEmpty()){
|
//phase two: propagate the damage
|
||||||
peak = Math.max(peak, frontier.size);
|
while(!frontier.isEmpty()){
|
||||||
Tile tile = frontier.removeFirst();
|
peak = Math.max(peak, frontier.size);
|
||||||
float currDamage = values[tile.x][tile.y] - falloff;
|
Tile tile = frontier.removeFirst();
|
||||||
|
float currDamage = values[tile.x][tile.y] - falloff;
|
||||||
|
|
||||||
for(int i = 0; i < 4; i++){
|
for(int i = 0; i < 4; i++){
|
||||||
int cx = tile.x + Geometry.d4x[i], cy = tile.y + Geometry.d4y[i];
|
int cx = tile.x + Geometry.d4x[i], cy = tile.y + Geometry.d4y[i];
|
||||||
|
|
||||||
//propagate to new tiles
|
//propagate to new tiles
|
||||||
if(tiles.in(cx, cy) && values[cx][cy] < currDamage){
|
if(tiles.in(cx, cy) && values[cx][cy] < currDamage){
|
||||||
Tile other = tiles.getn(cx, cy);
|
Tile other = tiles.getn(cx, cy);
|
||||||
float resultDamage = currDamage;
|
float resultDamage = currDamage;
|
||||||
|
|
||||||
//damage the tile if it's not friendly
|
//damage the tile if it's not friendly
|
||||||
if(other.build != null && other.team() != state.rules.waveTeam){
|
if(other.build != null && other.team() != state.rules.waveTeam){
|
||||||
resultDamage -= other.build.health();
|
resultDamage -= other.build.health();
|
||||||
|
|
||||||
if(direct){
|
if(direct){
|
||||||
other.build.damage(currDamage);
|
other.build.damage(currDamage);
|
||||||
}else{ //indirect damage happens at game load time
|
}else{ //indirect damage happens at game load time
|
||||||
other.build.health -= currDamage;
|
other.build.health -= currDamage;
|
||||||
//don't kill the core!
|
//don't kill the core!
|
||||||
if(other.block() instanceof CoreBlock) other.build.health = Math.max(other.build.health, 1f);
|
if(other.block() instanceof CoreBlock) other.build.health = Math.max(other.build.health, 1f);
|
||||||
|
|
||||||
//remove the block when destroyed
|
//remove the block when destroyed
|
||||||
if(other.build.health < 0){
|
if(other.build.health < 0){
|
||||||
//rubble
|
//rubble
|
||||||
if(rubble && !other.floor().solid && !other.floor().isLiquid && Mathf.chance(0.4)){
|
if(rubble && !other.floor().solid && !other.floor().isLiquid && Mathf.chance(0.4)){
|
||||||
Effect.rubble(other.build.x, other.build.y, other.block().size);
|
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
|
if(resultDamage > 0 && values[cx][cy] < resultDamage){
|
||||||
continue;
|
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){
|
static float cost(Tile tile){
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import mindustry.game.*;
|
|||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.graphics.g3d.*;
|
import mindustry.graphics.g3d.*;
|
||||||
|
import mindustry.maps.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.blocks.storage.*;
|
import mindustry.world.blocks.storage.*;
|
||||||
@@ -382,8 +383,8 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
stable.row();
|
stable.row();
|
||||||
|
|
||||||
if(sector.info.wavesSurvived >= 0 && sector.info.wavesSurvived - sector.info.wavesPassed >= 0 && !sector.isBeingPlayed()){
|
if(sector.info.wavesSurvived >= 0 && sector.info.wavesSurvived - sector.info.wavesPassed >= 0 && !sector.isBeingPlayed()){
|
||||||
boolean plus = (sector.info.wavesSurvived - sector.info.wavesPassed) >= 99;
|
boolean plus = (sector.info.wavesSurvived - sector.info.wavesPassed) >= SectorDamage.maxRetWave - 1;
|
||||||
stable.add("[accent]Will survive " + (sector.info.wavesSurvived - sector.info.wavesPassed) + (plus ? "+" : "") + " waves");
|
stable.add("[accent]Will survive\n" + (sector.info.wavesSurvived - sector.info.wavesPassed) + (plus ? "+" : "") + " waves");
|
||||||
stable.row();
|
stable.row();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user