Min attack weight rule
This commit is contained in:
@@ -28,8 +28,6 @@ public class RtsAI{
|
||||
static final IntSet assignedTargets = new IntSet();
|
||||
static final float squadRadius = 120f;
|
||||
static final int timeUpdate = 0, timerSpawn = 1;
|
||||
//TODO make configurable
|
||||
static final float minWeight = 1f;
|
||||
|
||||
//in order of priority??
|
||||
static final BlockFlag[] flags = {BlockFlag.generator, BlockFlag.factory, BlockFlag.core, BlockFlag.battery};
|
||||
@@ -267,7 +265,7 @@ public class RtsAI{
|
||||
);
|
||||
|
||||
float weight = weights.get(result, 0f);
|
||||
if(weight < minWeight && total < Units.getCap(data.team)){
|
||||
if(weight < data.team.rules().minAttackWeight && total < Units.getCap(data.team)){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -226,6 +226,8 @@ public class Rules{
|
||||
public boolean rtsAi;
|
||||
/** Minimum size of attack squads. */
|
||||
public int rtsAiMinSquadSize = 4;
|
||||
/** Minimum "advantage" needed for a squad to attack. Higher -> more cautious. */
|
||||
public float minAttackWeight = 1.2f;
|
||||
|
||||
/** How fast unit factories build units. */
|
||||
public float unitBuildSpeedMultiplier = 1f;
|
||||
|
||||
@@ -255,6 +255,7 @@ public class CustomRulesDialog extends BaseDialog{
|
||||
|
||||
check("@rules.rtsai", b -> teams.rtsAi = b, () -> teams.rtsAi, () -> team != rules.defaultTeam);
|
||||
numberi("@rules.rtsminsquadsize", f -> teams.rtsAiMinSquadSize = f, () -> teams.rtsAiMinSquadSize, () -> teams.rtsAi, 0, 100);
|
||||
number("@rules.rtsminattackweight", f -> teams.minAttackWeight = f, () -> teams.minAttackWeight, () -> teams.rtsAi);
|
||||
|
||||
check("@rules.infiniteresources", b -> teams.infiniteResources = b, () -> teams.infiniteResources);
|
||||
number("@rules.buildspeedmultiplier", f -> teams.buildSpeedMultiplier = f, () -> teams.buildSpeedMultiplier, 0.001f, 50f);
|
||||
|
||||
Reference in New Issue
Block a user