Status apply instruction / Bugfixes

This commit is contained in:
Anuken
2022-05-09 04:10:18 -04:00
parent aace191116
commit eb52c6d61f
7 changed files with 107 additions and 9 deletions

View File

@@ -1234,6 +1234,71 @@ public class LStatements{
}
}
@RegisterStatement("status")
public static class ApplyStatusStatement extends LStatement{
public boolean clear;
public String effect = "wet", unit = "unit", duration = "10";
private static @Nullable String[] statusNames;
@Override
public void build(Table table){
rebuild(table);
}
void rebuild(Table table){
table.clearChildren();
table.button(clear ? "clear" : "apply", Styles.logict, () -> {
clear = !clear;
rebuild(table);
}).size(80f, 40f).pad(4f).color(table.color);
if(statusNames == null){
statusNames = content.statusEffects().select(s -> !s.isHidden()).map(s -> s.name).toArray(String.class);
}
table.button(b -> {
b.label(() -> effect).grow().wrap().labelAlign(Align.center).center();
b.clicked(() -> showSelect(b, statusNames, effect, o -> {
effect = o;
}, 2, c -> c.size(120f, 38f)));
}, Styles.logict, () -> {}).size(120f, 40f).pad(4f).color(table.color);
//TODO effect select
table.add(clear ? " from " : " to ");
row(table);
fields(table, unit, str -> unit = str);
if(!clear){
table.add(" for ");
fields(table, duration, str -> duration = str);
table.add(" sec");
}
}
@Override
public boolean privileged(){
return true;
}
@Override
public Color color(){
return Pal.logicWorld;
}
@Override
public LInstruction build(LAssembler builder){
return new ApplyEffectI(clear, effect, builder.var(unit), builder.var(duration));
}
}
@RegisterStatement("spawnwave")
public static class SpawnWaveStatement extends LStatement{
public String x = "10", y = "10";