Added campaign target wave

This commit is contained in:
Anuken
2020-06-17 21:41:39 -04:00
parent e88ff1a358
commit ae47f37b27
6 changed files with 22 additions and 30 deletions

View File

@@ -112,14 +112,6 @@ public class Logic implements ApplicationListener{
} }
});*/ });*/
//disable new waves after the boss spawns
Events.on(WaveEvent.class, e -> {
//only works for non-attack sectors
if(state.isCampaign() && state.boss() != null && !state.rules.attackMode){
state.rules.waitEnemies = true;
}
});
} }
/** Handles the event of content being used by either the player or some block. */ /** Handles the event of content being used by either the player or some block. */
@@ -185,10 +177,8 @@ public class Logic implements ApplicationListener{
state.rules.waves = false; state.rules.waves = false;
} }
//check if there is a boss present //if there's a "win" wave and no enemies are present, win automatically
Unitc boss = state.boss(); if(state.rules.waves && state.enemies == 0 && state.rules.winWave > 0 && state.wave >= state.rules.winWave && !spawner.isSpawning()){
//if this was a boss wave and there is no boss anymore, then it's a victory
if(boss == null && state.rules.waves && state.rules.waitEnemies){
//the sector has been conquered - waves get disabled //the sector has been conquered - waves get disabled
state.rules.waves = false; state.rules.waves = false;
@@ -222,8 +212,6 @@ public class Logic implements ApplicationListener{
} }
} }
} }
} }
private void updateWeather(){ private void updateWeather(){
@@ -321,7 +309,7 @@ public class Logic implements ApplicationListener{
} }
if(state.rules.waves && state.rules.waveTimer && !state.gameOver){ if(state.rules.waves && state.rules.waveTimer && !state.gameOver){
if(!state.rules.waitEnemies || state.enemies == 0){ if(!isWaitingWave()){
state.wavetime = Math.max(state.wavetime - Time.delta(), 0); state.wavetime = Math.max(state.wavetime - Time.delta(), 0);
} }
} }
@@ -339,4 +327,9 @@ public class Logic implements ApplicationListener{
} }
} }
/** @return whether the wave timer is paused due to enemies */
public boolean isWaitingWave(){
return (state.rules.waitEnemies || (state.wave >= state.rules.winWave && state.rules.winWave > 0)) && state.enemies > 0;
}
} }

View File

@@ -62,10 +62,10 @@ public class Rules{
public float dropZoneRadius = 300f; public float dropZoneRadius = 300f;
/** Time between waves in ticks. */ /** Time between waves in ticks. */
public float waveSpacing = 60 * 60 * 2; public float waveSpacing = 60 * 60 * 2;
/** How many times longer a boss wave takes. */
public float bossWaveMultiplier = 3f;
/** How many times longer a launch wave takes. */ /** How many times longer a launch wave takes. */
public float launchWaveMultiplier = 2f; public float launchWaveMultiplier = 2f;
/** Wave after which the player 'wins'. Used in sectors. Use a value <= 0 to disable. */
public int winWave = 0;
/** Base unit cap. Can still be increased by blocks. */ /** Base unit cap. Can still be increased by blocks. */
public int unitCap = 0; public int unitCap = 0;
/** Sector for saves that have them.*/ /** Sector for saves that have them.*/

View File

@@ -27,7 +27,10 @@ public class WarningBar extends Element{
rx + barWidth, y rx + barWidth, y
); );
} }
Lines.stroke(3f);
Lines.line(x, y, x + width, y);
Lines.line(x, y + height, x + width, y + height);
Draw.color(); Draw.reset();
} }
} }

View File

@@ -24,13 +24,11 @@ public class SaveDialog extends LoadDialog{
public void addSetup(){ public void addSetup(){
buttons.button("$save.new", Icon.add, () -> buttons.button("$save.new", Icon.add, () ->
ui.showTextInput("$save", "$save.newslot", 30, "", text -> { ui.showTextInput("$save", "$save.newslot", 30, "",
ui.loadAnd("$saving", () -> { text -> ui.loadAnd("$saving", () -> {
control.saves.addSave(text); control.saves.addSave(text);
Core.app.post(() -> Core.app.post(this::setup)); Core.app.post(() -> Core.app.post(this::setup));
}); }))).fillX().margin(10f);
})
).fillX().margin(10f);
} }
@Override @Override

View File

@@ -644,7 +644,7 @@ public class HudFragment extends Fragment{
} }
if(state.rules.waveTimer){ if(state.rules.waveTimer){
builder.append((state.rules.waitEnemies && state.enemies > 0 ? Core.bundle.get("wave.waveInProgress") : ( waitingf.get((int)(state.wavetime/60))))); builder.append((logic.isWaitingWave() ? Core.bundle.get("wave.waveInProgress") : ( waitingf.get((int)(state.wavetime/60)))));
}else if(state.enemies == 0){ }else if(state.enemies == 0){
builder.append(Core.bundle.get("waiting")); builder.append(Core.bundle.get("waiting"));
} }

View File

@@ -21,13 +21,11 @@ public class LoadingFragment extends Fragment{
t.visible(false); t.visible(false);
t.touchable(Touchable.enabled); t.touchable(Touchable.enabled);
t.add().height(133f).row(); t.add().height(133f).row();
//t.image().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent); t.add(new WarningBar()).growX().height(24f);
t.add(new WarningBar()).growX().height(30f);
t.row(); t.row();
t.add("$loading").name("namelabel").pad(10f).style(Styles.techLabel); t.add("$loading").name("namelabel").pad(10f).style(Styles.techLabel);
t.row(); t.row();
t.add(new WarningBar()).growX().height(30f); t.add(new WarningBar()).growX().height(24f);
//t.image().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
t.row(); t.row();
bar = t.add(new Bar()).pad(3).size(500f, 40f).visible(false).get(); bar = t.add(new Bar()).pad(3).size(500f, 40f).visible(false).get();