Logic team-specific rules
This commit is contained in:
@@ -1299,6 +1299,18 @@ public class LExecutor{
|
||||
}
|
||||
}
|
||||
case ambientLight -> state.rules.ambientLight.fromDouble(exec.num(value));
|
||||
case unitBuildSpeed, unitDamage, blockHealth, blockDamage, buildSpeed -> {
|
||||
if(exec.obj(p1) instanceof Team team){
|
||||
float num = exec.numf(value);
|
||||
switch(rule){
|
||||
case buildSpeed -> team.rules().buildSpeedMultiplier = Mathf.clamp(num, 0.001f, 50f);
|
||||
case unitBuildSpeed -> team.rules().unitBuildSpeedMultiplier = Mathf.clamp(num, 0f, 50f);
|
||||
case unitDamage -> team.rules().unitDamageMultiplier = Math.max(num, 0f);
|
||||
case blockHealth -> team.rules().blockHealthMultiplier = Math.max(num, 0.001f);
|
||||
case blockDamage -> team.rules().blockDamageMultiplier = Math.max(num, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1237,13 +1237,20 @@ public class LStatements{
|
||||
@RegisterStatement("setrule")
|
||||
public static class SetRuleStatement extends LStatement{
|
||||
public LogicRule rule = LogicRule.waveSpacing;
|
||||
public String value = "100", p1 = "0", p2 = "0", p3 = "100", p4 = "100";
|
||||
public String value = "10", p1 = "0", p2 = "0", p3 = "100", p4 = "100";
|
||||
|
||||
@Override
|
||||
public void build(Table table){
|
||||
rebuild(table);
|
||||
}
|
||||
|
||||
/*
|
||||
unitBuildSpeed,
|
||||
unitDamage,
|
||||
blockHealth,
|
||||
blockDamage
|
||||
*/
|
||||
|
||||
void rebuild(Table table){
|
||||
table.clearChildren();
|
||||
|
||||
@@ -1253,19 +1260,31 @@ public class LStatements{
|
||||
rule = o;
|
||||
rebuild(table);
|
||||
}, 2, c -> c.width(150f)));
|
||||
}, Styles.logict, () -> {}).size(160f, 40f).pad(4f).color(table.color);
|
||||
|
||||
table.add(" = ");
|
||||
}, Styles.logict, () -> {}).size(160f, 40f).margin(5f).pad(4f).color(table.color);
|
||||
|
||||
switch(rule){
|
||||
case mapArea -> {
|
||||
table.add(" = ");
|
||||
|
||||
fields(table, "x", p1, s -> p1 = s);
|
||||
fields(table, "y", p2, s -> p2 = s);
|
||||
row(table);
|
||||
fields(table, "w", p3, s -> p3 = s);
|
||||
fields(table, "h", p4, s -> p4 = s);
|
||||
}
|
||||
case buildSpeed, unitBuildSpeed, unitDamage, blockHealth, blockDamage -> {
|
||||
if(p1.equals("0")){
|
||||
p1 = "@sharded";
|
||||
}
|
||||
|
||||
fields(table, "of", p1, s -> p1 = s);
|
||||
table.add(" = ");
|
||||
row(table);
|
||||
field(table, value, s -> value = s);
|
||||
}
|
||||
default -> {
|
||||
table.add(" = ");
|
||||
|
||||
field(table, value, s -> value = s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,14 @@ public enum LogicRule{
|
||||
unitCap,
|
||||
mapArea,
|
||||
lighting,
|
||||
ambientLight;
|
||||
ambientLight,
|
||||
|
||||
//team specific
|
||||
buildSpeed,
|
||||
unitBuildSpeed,
|
||||
unitDamage,
|
||||
blockHealth,
|
||||
blockDamage;
|
||||
|
||||
public static final LogicRule[] all = values();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user