Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken 2021-02-16 09:13:49 -05:00
commit 2c368953f9
4 changed files with 18 additions and 1 deletions

View File

@ -957,6 +957,8 @@ rules.blockdamagemultiplier = Block Damage Multiplier
rules.unitbuildspeedmultiplier = Unit Production Speed Multiplier
rules.unithealthmultiplier = Unit Health Multiplier
rules.unitdamagemultiplier = Unit Damage Multiplier
rules.unitcapvariable = Cores Contribute To Unit Cap
rules.unitcap = Base Unit Cap
rules.enemycorebuildradius = Enemy Core No-Build Radius:[lightgray] (tiles)
rules.wavespacing = Wave Spacing:[lightgray] (sec)
rules.buildcostmultiplier = Build Cost Multiplier

View File

@ -76,7 +76,7 @@ public class Units{
if((team == state.rules.waveTeam && !state.rules.pvp) || (state.isCampaign() && team == state.rules.waveTeam)){
return Integer.MAX_VALUE;
}
return state.rules.unitCap + indexer.getExtraUnits(team);
return Math.max(0, state.rules.unitCapVariable ? state.rules.unitCap + indexer.getExtraUnits(team) : state.rules.unitCap);
}
/** @return whether this player can interact with a specific tile. if either of these are null, returns true.*/

View File

@ -44,6 +44,8 @@ public class Rules{
public boolean fire = true;
/** Whether units use and require ammo. */
public boolean unitAmmo = false;
/** Whether cores add to unit limit */
public boolean unitCapVariable = true;
/** How fast unit pads build units. */
public float unitBuildSpeedMultiplier = 1f;
/** How much damage any other units deal. */

View File

@ -161,6 +161,8 @@ public class CustomRulesDialog extends BaseDialog{
title("@rules.title.unit");
check("@rules.unitammo", b -> rules.unitAmmo = b, () -> rules.unitAmmo);
check("@rules.unitcapvariable", b -> rules.unitCapVariable = b, () -> rules.unitCapVariable);
number("@rules.unitcap", true, f -> rules.unitCap = f, () -> rules.unitCap, -999, 999);
number("@rules.unitdamagemultiplier", f -> rules.unitDamageMultiplier = f, () -> rules.unitDamageMultiplier);
number("@rules.unitbuildspeedmultiplier", f -> rules.unitBuildSpeedMultiplier = f, () -> rules.unitBuildSpeedMultiplier, 0.001f, 50f);
@ -204,6 +206,17 @@ public class CustomRulesDialog extends BaseDialog{
number(text, false, cons, prov, condition, 0, Float.MAX_VALUE);
}
void number(String text, boolean integer, Intc cons, Intp prov, int min, int max){
main.table(t -> {
t.left();
t.add(text).left().padRight(5);
t.field((integer ? (int)prov.get() : prov.get()) + "", s -> cons.get(Strings.parseInt(s)))
.padRight(100f)
.valid(f -> Strings.parseInt(f) >= min && Strings.parseInt(f) <= max).width(120f).left().addInputDialog();
}).padTop(0);
main.row();
}
void number(String text, boolean integer, Floatc cons, Floatp prov, Boolp condition, float min, float max){
main.table(t -> {
t.left();