Many things

This commit is contained in:
Anuken 2020-09-27 17:15:31 -04:00
parent ff84d72e20
commit 3bf01334c9
8 changed files with 90 additions and 21 deletions

View File

@ -67,7 +67,7 @@ public class LogicStatementProcessor extends BaseProcessor{
int index = 0;
for(Svar field : fields){
if(field.is(Modifier.TRANSIENT)) continue;
if(field.isAny(Modifier.TRANSIENT, Modifier.STATIC)) continue;
writer.addStatement("out.append(\" \")");
writer.addStatement("out.append((($T)obj).$L$L)", c.mirror(), field.name(),

View File

@ -866,7 +866,8 @@ public class Blocks implements ContentList{
size = 2;
reload = 250f;
range = 85f;
healPercent = 14f;
healPercent = 11f;
phaseBoost = 15f;
health = 80 * size * size;
consumes.item(Items.phasefabric).boost();
}};

View File

@ -52,7 +52,7 @@ public class GameState{
/** @return whether the player is in a campaign and they are out of sector time */
public boolean isOutOfTime(){
return isCampaign() && isGame() && getSector().getTimeSpent() >= turnDuration;
return isCampaign() && isGame() && getSector().getTimeSpent() >= turnDuration && !net.active();
}
public boolean hasSector(){

View File

@ -18,8 +18,6 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{
@Import Vec2 vel;
@Import UnitType type;
/** minimum cursor distance from unit, fixes 'cross-eyed' shooting */
static final float minAimDst = 18f;
/** temporary weapon sequence number */
static int sequenceNum = 0;
@ -67,7 +65,7 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{
/** Aim at something. This will make all mounts point at it. */
void aim(float x, float y){
Tmp.v1.set(x, y).sub(this.x, this.y);
if(Tmp.v1.len() < minAimDst) Tmp.v1.setLength(minAimDst);
if(Tmp.v1.len() < type.aimDst) Tmp.v1.setLength(type.aimDst);
x = Tmp.v1.x + this.x;
y = Tmp.v1.y + this.y;

View File

@ -1,6 +1,8 @@
package mindustry.game;
import arc.math.*;
import arc.struct.*;
import arc.util.*;
import mindustry.content.*;
import mindustry.type.*;
@ -197,7 +199,8 @@ public class DefaultWaves{
return spawns == null ? new Seq<>() : spawns;
}
private static void generate(){
//TODO move elsewhere
public static Seq<SpawnGroup> generate(){
UnitType[][] species = {
{dagger, mace, fortress, scepter, reign},
{nova, pulsar, quasar, vela, corvus},
@ -208,16 +211,63 @@ public class DefaultWaves{
};
//required progression:
//- main progression of units, up to wave ~20
//- changes from
//- extra periodic patterns
Seq<SpawnGroup> out = new Seq<>();
//max reasonable wave, after which everything gets boring
int cap = 300;
for(int i = 0; i < cap; i++){
int cap = 400;
//main sequence
float shieldStart = 30, shieldsPerWave = 12;
UnitType[] curSpecies = Structs.random(species);
int curTier = 0;
for(int i = 0; i < cap;){
int f = i;
int next = Mathf.random(15, 25);
float shieldAmount = Math.max((i - shieldStart) * shieldsPerWave, 0);
//main progression
out.add(new SpawnGroup(curSpecies[Math.min(curTier, curSpecies.length - 1)]){{
unitAmount = f == 0 ? 1 : 10;
begin = f;
end = f + next >= cap ? never : f + next;
max = 16;
unitScaling = Mathf.random(1f, 2f);
shields = shieldAmount;
shieldScaling = shieldsPerWave;
}});
//extra progression that tails out, blends in
out.add(new SpawnGroup(curSpecies[Math.min(curTier, curSpecies.length - 1)]){{
unitAmount = 6;
begin = f + next;
end = f + next + Mathf.random(8, 12);
max = 10;
unitScaling = Mathf.random(2f);
spacing = Mathf.random(2, 3);
shields = shieldAmount;
shieldScaling = shieldsPerWave;
}});
i += next;
if(curTier < 3 || Mathf.chance(0.2)){
curTier ++;
}
//do not spawn bosses
curTier = Math.min(curTier, 3);
//small chance to switch species
if(Mathf.chance(0.2)){
curSpecies = Structs.random(species);
}
}
return out;
}
}

View File

@ -6,7 +6,8 @@ public enum ConditionOp{
lessThan("<", (a, b) -> a < b),
lessThanEq("<=", (a, b) -> a <= b),
greaterThan(">", (a, b) -> a > b),
greaterThanEq(">=", (a, b) -> a >= b);
greaterThanEq(">=", (a, b) -> a >= b),
always("always", (a, b) -> true);
public static final ConditionOp[] all = values();

View File

@ -1,6 +1,7 @@
package mindustry.logic;
import arc.func.*;
import arc.graphics.*;
import arc.scene.style.*;
import arc.scene.ui.*;
import arc.scene.ui.layout.*;
@ -633,6 +634,8 @@ public class LStatements{
@RegisterStatement("jump")
public static class JumpStatement extends LStatement{
private static Color last = new Color();
public transient StatementElem dest;
public int destIndex;
@ -644,19 +647,30 @@ public class LStatements{
public void build(Table table){
table.add("if ").padLeft(4);
field(table, value, str -> value = str);
table.button(b -> {
b.label(() -> op.symbol);
b.clicked(() -> showSelect(b, ConditionOp.all, op, o -> op = o));
}, Styles.logict, () -> {}).size(48f, 40f).pad(4f).color(table.color);
field(table, compare, str -> compare = str);
last = table.color;
table.table(this::rebuild);
table.add().growX();
table.add(new JumpButton(() -> dest, s -> dest = s)).size(30).right().padLeft(-8);
}
void rebuild(Table table){
table.clearChildren();
table.setColor(last);
if(op != ConditionOp.always) field(table, value, str -> value = str);
table.button(b -> {
b.label(() -> op.symbol);
b.clicked(() -> showSelect(b, ConditionOp.all, op, o -> {
op = o;
rebuild(table);
}));
}, Styles.logict, () -> {}).size(op == ConditionOp.always ? 80f : 48f, 40f).pad(4f).color(table.color);
if(op != ConditionOp.always) field(table, compare, str -> compare = str);
}
//elements need separate conversion logic
@Override
public void setupUI(){

View File

@ -51,6 +51,7 @@ public class UnitType extends UnlockableContent{
public boolean destructibleWreck = true;
public float groundLayer = Layer.groundUnit;
public float payloadCapacity = 8;
public float aimDst = -1f;
public int commandLimit = 24;
public float visualElevation = -1f;
public boolean allowLegStep = false;
@ -218,6 +219,10 @@ public class UnitType extends UnlockableContent{
mechStride = 4f + (hitSize -8f)/2.1f;
}
if(aimDst < 0){
aimDst = weapons.contains(w -> !w.rotate) ? hitSize * 2f : hitSize / 2f;
}
if(mechStepShake < 0){
mechStepShake = Mathf.round((hitSize - 11f) / 9f);
mechStepParticles = hitSize > 15f;