mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-28 07:22:21 -08:00
Sector simplification
This commit is contained in:
parent
65d9978fa1
commit
3d99e38f10
13 changed files with 64 additions and 27 deletions
|
|
@ -291,6 +291,8 @@ waiting = [lightgray]Waiting...
|
|||
waiting.players = Waiting for players...
|
||||
wave.enemies = [lightgray]{0} Enemies Remaining
|
||||
wave.enemy = [lightgray]{0} Enemy Remaining
|
||||
wave.guardianwarn = Guardian approaching in [accent]{0}[] waves.
|
||||
wave.guardianwarn.one = Guardian approaching in [accent]{0}[] wave.
|
||||
loadimage = Load Image
|
||||
saveimage = Save Image
|
||||
unknown = Unknown
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -85,7 +85,7 @@ public class Vars implements Loadable{
|
|||
/** range for moving items for logic units */
|
||||
public static final float logicItemTransferRange = 45f;
|
||||
/** duration of time between turns in ticks */
|
||||
public static final float turnDuration = 20 * Time.toMinutes;
|
||||
public static final float turnDuration = 2 * Time.toMinutes;
|
||||
/** turns needed to destroy a sector completely */
|
||||
public static final float sectorDestructionTurns = 2f;
|
||||
/** min armor fraction damage; e.g. 0.05 = at least 5% damage */
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class StatusEffects implements ContentList{
|
|||
|
||||
freezing = new StatusEffect("freezing"){{
|
||||
speedMultiplier = 0.6f;
|
||||
armorMultiplier = 0.8f;
|
||||
healthMultiplier = 0.8f;
|
||||
effect = Fx.freezing;
|
||||
|
||||
init(() -> {
|
||||
|
|
@ -81,7 +81,7 @@ public class StatusEffects implements ContentList{
|
|||
|
||||
melting = new StatusEffect("melting"){{
|
||||
speedMultiplier = 0.8f;
|
||||
armorMultiplier = 0.8f;
|
||||
healthMultiplier = 0.8f;
|
||||
damage = 0.3f;
|
||||
effect = Fx.melting;
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ public class StatusEffects implements ContentList{
|
|||
|
||||
sapped = new StatusEffect("sapped"){{
|
||||
speedMultiplier = 0.7f;
|
||||
armorMultiplier = 0.8f;
|
||||
healthMultiplier = 0.8f;
|
||||
effect = Fx.sapped;
|
||||
effectChance = 0.1f;
|
||||
}};
|
||||
|
|
@ -115,7 +115,7 @@ public class StatusEffects implements ContentList{
|
|||
}};
|
||||
|
||||
overdrive = new StatusEffect("overdrive"){{
|
||||
armorMultiplier = 0.95f;
|
||||
healthMultiplier = 0.95f;
|
||||
speedMultiplier = 1.15f;
|
||||
damageMultiplier = 1.4f;
|
||||
damage = -0.01f;
|
||||
|
|
@ -132,13 +132,13 @@ public class StatusEffects implements ContentList{
|
|||
}};
|
||||
|
||||
shielded = new StatusEffect("shielded"){{
|
||||
armorMultiplier = 3f;
|
||||
healthMultiplier = 3f;
|
||||
}};
|
||||
|
||||
boss = new StatusEffect("boss"){{
|
||||
permanent = true;
|
||||
damageMultiplier = 1.5f;
|
||||
armorMultiplier = 1.5f;
|
||||
damageMultiplier = 2f;
|
||||
healthMultiplier = 2f;
|
||||
}};
|
||||
|
||||
shocked = new StatusEffect("shocked");
|
||||
|
|
|
|||
|
|
@ -197,6 +197,8 @@ public class Logic implements ApplicationListener{
|
|||
state.rules.waves = false;
|
||||
}
|
||||
|
||||
//TODO capturing is disabled
|
||||
/*
|
||||
//if there's a "win" wave and no enemies are present, win automatically
|
||||
if(state.rules.waves && state.enemies == 0 && state.rules.winWave > 0 && state.wave >= state.rules.winWave && !spawner.isSpawning()){
|
||||
//the sector has been conquered - waves get disabled
|
||||
|
|
@ -209,7 +211,7 @@ public class Logic implements ApplicationListener{
|
|||
if(!headless){
|
||||
control.saves.saveSector(state.rules.sector);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}else{
|
||||
if(!state.rules.attackMode && state.teams.playerCores().size == 0 && !state.gameOver){
|
||||
state.gameOver = true;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import static mindustry.Vars.*;
|
|||
|
||||
@Component
|
||||
abstract class ShieldComp implements Healthc, Posc{
|
||||
@Import float health, hitTime, x, y;
|
||||
@Import float health, hitTime, x, y, healthMultiplier;
|
||||
@Import boolean dead;
|
||||
|
||||
/** Absorbs health damage. */
|
||||
|
|
@ -22,6 +22,7 @@ abstract class ShieldComp implements Healthc, Posc{
|
|||
@Replace
|
||||
@Override
|
||||
public void damage(float amount){
|
||||
amount /= healthMultiplier;
|
||||
//apply armor
|
||||
amount = Math.max(amount - armor, minArmorDamage * amount);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ abstract class StatusComp implements Posc, Flyingc{
|
|||
private Seq<StatusEntry> statuses = new Seq<>();
|
||||
private transient Bits applied = new Bits(content.getBy(ContentType.status).size);
|
||||
|
||||
@ReadOnly transient float speedMultiplier = 1, damageMultiplier = 1, armorMultiplier = 1, reloadMultiplier = 1;
|
||||
@ReadOnly transient float speedMultiplier = 1, damageMultiplier = 1, healthMultiplier = 1, reloadMultiplier = 1;
|
||||
|
||||
@Import UnitType type;
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ abstract class StatusComp implements Posc, Flyingc{
|
|||
}
|
||||
|
||||
applied.clear();
|
||||
speedMultiplier = damageMultiplier = armorMultiplier = reloadMultiplier = 1f;
|
||||
speedMultiplier = damageMultiplier = healthMultiplier = reloadMultiplier = 1f;
|
||||
|
||||
if(statuses.isEmpty()) return;
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ abstract class StatusComp implements Posc, Flyingc{
|
|||
statuses.remove(index);
|
||||
}else{
|
||||
speedMultiplier *= entry.effect.speedMultiplier;
|
||||
armorMultiplier *= entry.effect.armorMultiplier;
|
||||
healthMultiplier *= entry.effect.healthMultiplier;
|
||||
damageMultiplier *= entry.effect.damageMultiplier;
|
||||
reloadMultiplier *= entry.effect.reloadMultiplier;
|
||||
entry.effect.update(self(), entry.time);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public class Objectives{
|
|||
}
|
||||
}
|
||||
|
||||
//TODO fix
|
||||
public static class SectorComplete extends SectorObjective{
|
||||
|
||||
public SectorComplete(SectorPreset zone){
|
||||
|
|
@ -38,12 +39,12 @@ public class Objectives{
|
|||
|
||||
@Override
|
||||
public boolean complete(){
|
||||
return preset.sector.isCaptured();
|
||||
return preset.sector.save != null && preset.sector.save.meta.wave >= preset.sector.save.meta.rules.winWave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String display(){
|
||||
return Core.bundle.format("requirement.capture", preset.localizedName);
|
||||
return Core.bundle.format("requirement.wave", preset.sector.save == null ? "<unknown>" : preset.sector.save.meta.rules.winWave, preset.localizedName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class SpawnGroup implements Serializable{
|
|||
/** The spacing, in waves, of spawns. For example, 2 = spawns every other wave */
|
||||
public int spacing = 1;
|
||||
/** Maximum amount of units that spawn */
|
||||
public int max = 100;
|
||||
public int max = 40;
|
||||
/** How many waves need to pass before the amount of units spawned increases by 1 */
|
||||
public float unitScaling = never;
|
||||
/** Shield points that this unit has. */
|
||||
|
|
@ -88,7 +88,7 @@ public class SpawnGroup implements Serializable{
|
|||
if(begin != 0) json.writeValue("begin", begin);
|
||||
if(end != never) json.writeValue("end", end);
|
||||
if(spacing != 1) json.writeValue("spacing", spacing);
|
||||
//if(max != 40) json.writeValue("max", max);
|
||||
if(max != 40) json.writeValue("max", max);
|
||||
if(unitScaling != never) json.writeValue("scaling", unitScaling);
|
||||
if(shields != 0) json.writeValue("shields", shields);
|
||||
if(shieldScaling != 0) json.writeValue("shieldScaling", shieldScaling);
|
||||
|
|
@ -105,12 +105,18 @@ public class SpawnGroup implements Serializable{
|
|||
begin = data.getInt("begin", 0);
|
||||
end = data.getInt("end", never);
|
||||
spacing = data.getInt("spacing", 1);
|
||||
//max = data.getInt("max", 40);
|
||||
max = data.getInt("max", 40);
|
||||
unitScaling = data.getFloat("scaling", never);
|
||||
shields = data.getFloat("shields", 0);
|
||||
shieldScaling = data.getFloat("shieldScaling", 0);
|
||||
unitAmount = data.getInt("amount", 1);
|
||||
effect = content.getByName(ContentType.status, data.hasChild("effect") && data.getChild("effect").isString() ? data.getString("effect", "none") : "none");
|
||||
|
||||
//old boss effect ID
|
||||
if(data.has("effect") && data.get("effect").isNumber() && data.getInt("effect", -1) == 8){
|
||||
effect = StatusEffects.boss;
|
||||
}else{
|
||||
effect = content.getByName(ContentType.status, data.has("effect") && data.get("effect").isString() ? data.getString("effect", "none") : "none");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ import mindustry.gen.*;
|
|||
public class StatusEffect extends MappableContent{
|
||||
/** Damage dealt by the unit with the effect. */
|
||||
public float damageMultiplier = 1f;
|
||||
/** Unit armor multiplier. */
|
||||
public float armorMultiplier = 1f;
|
||||
/** Unit health multiplier. */
|
||||
public float healthMultiplier = 1f;
|
||||
/** Unit speed multiplier */
|
||||
public float speedMultiplier = 1f;
|
||||
/** Unit speed multiplier */
|
||||
|
|
|
|||
|
|
@ -35,10 +35,11 @@ public class PausedDialog extends BaseDialog{
|
|||
|
||||
if(!mobile){
|
||||
//TODO localize
|
||||
cont.label(() -> state.getSector() == null ? "" :
|
||||
("[lightgray]Next turn in [accent]" + state.getSector().displayTimeRemaining() +
|
||||
(state.rules.winWave > 0 && !state.getSector().isCaptured() ? "\n[lightgray]Reach wave[accent] " + state.rules.winWave + "[] to capture" : "")))
|
||||
.visible(() -> state.getSector() != null).colspan(2);
|
||||
//TODO capturing is disabled, remove?
|
||||
//cont.label(() -> state.getSector() == null ? "" :
|
||||
//("[lightgray]Next turn in [accent]" + state.getSector().displayTimeRemaining() +
|
||||
// (state.rules.winWave > 0 && !state.getSector().isCaptured() ? "\n[lightgray]Reach wave[accent] " + state.rules.winWave + "[] to capture" : "")))
|
||||
// .visible(() -> state.getSector() != null).colspan(2);
|
||||
cont.row();
|
||||
|
||||
float dw = 220f;
|
||||
|
|
|
|||
|
|
@ -263,9 +263,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||
}
|
||||
},
|
||||
new Table(t -> {
|
||||
t.touchable = Touchable.disabled;
|
||||
//TODO localize
|
||||
t.top();
|
||||
t.label(() -> mode == select ? "@sectors.select" : mode == launch ? "Select Launch Sector" : "Turn " + universe.turn()).style(Styles.outlineLabel).color(Pal.accent);
|
||||
t.label(() -> mode == select ? "@sectors.select" : mode == launch ? "Select Launch Sector" : "").style(Styles.outlineLabel).color(Pal.accent);
|
||||
})).grow();
|
||||
|
||||
}
|
||||
|
|
@ -338,6 +339,8 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||
stable.add("[accent]Difficulty: " + (int)(sector.baseCoverage * 10)).row();
|
||||
}
|
||||
|
||||
//TODO sector damage is disabled, remove when finalized
|
||||
/*
|
||||
if(sector.hasBase() && sector.hasWaves()){
|
||||
//TODO localize when finalized
|
||||
//these mechanics are likely to change and as such are not added to the bundle
|
||||
|
|
@ -345,7 +348,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||
stable.row();
|
||||
stable.add("[accent]" + Mathf.ceil(sectorDestructionTurns - (sector.getSecondsPassed() * 60) / turnDuration) + " turn(s)\nuntil destruction");
|
||||
stable.row();
|
||||
}
|
||||
}*/
|
||||
|
||||
if(sector.save != null){
|
||||
stable.add("@sectors.resources").row();
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import arc.scene.ui.layout.*;
|
|||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.core.GameState.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.game.EventType.*;
|
||||
|
|
@ -47,6 +48,26 @@ public class HudFragment extends Fragment{
|
|||
@Override
|
||||
public void build(Group parent){
|
||||
|
||||
//warn about guardian/boss waves
|
||||
Events.on(WaveEvent.class, e -> {
|
||||
int max = 10;
|
||||
outer:
|
||||
for(int i = state.wave - 1; i <= state.wave + max; i++){
|
||||
for(SpawnGroup group : state.rules.spawns){
|
||||
if(group.effect == StatusEffects.boss && group.getUnitsSpawned(i) > 0){
|
||||
int diff = (i + 2) - state.wave;
|
||||
|
||||
//increments at which to warn about incoming guardian
|
||||
if(diff == 1 || diff == 2 || diff == 5 || diff == 10){
|
||||
showToast(Icon.warning, Core.bundle.format("wave.guardianwarn" + (diff == 1 ? ".one" : ""), diff));
|
||||
}
|
||||
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//TODO details and stuff
|
||||
Events.on(SectorCaptureEvent.class, e ->{
|
||||
//TODO localize
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue