Unit Mine Speed Game Rule Implementation and World Processor Set Rule for Unit Mine Speed (#10318)
* unitMineSpeedMultiplier Creation
added unitMineSpeedMultiplier
added unitMineSpeed(Team team)
* World Proccesor: SetRuleI unitMineSpeed Implemented
* World Processor: SetRuleI unitCrashDamage Implemented
* Revert "World Processor: SetRuleI unitCrashDamage Implemented"
This reverts commit 1b7187b046.
* Forgor to add, unitMineSpeedMultiplier is now editable per team
This commit is contained in:
@@ -65,7 +65,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{
|
||||
}
|
||||
|
||||
public boolean canMine(){
|
||||
return type.mineSpeed > 0 && type.mineTier >= 0;
|
||||
return type.mineSpeed * state.rules.unitMineSpeed(team()) > 0 && type.mineTier >= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,7 +89,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{
|
||||
mineTile = null;
|
||||
mineTimer = 0f;
|
||||
}else if(mining() && item != null){
|
||||
mineTimer += Time.delta * type.mineSpeed;
|
||||
mineTimer += Time.delta * type.mineSpeed * state.rules.unitMineSpeed(team());
|
||||
|
||||
if(Mathf.chance(0.06 * Time.delta)){
|
||||
Fx.pulverizeSmall.at(mineTile.worldx() + Mathf.range(tilesize / 2f), mineTile.worldy() + Mathf.range(tilesize / 2f), 0f, item.color);
|
||||
|
||||
@@ -84,6 +84,8 @@ public class Rules{
|
||||
public float unitHealthMultiplier = 1f;
|
||||
/** How much damage unit crash damage deals. (Compounds with unitDamageMultiplier) */
|
||||
public float unitCrashDamageMultiplier = 1f;
|
||||
/** How fast units can mine. */
|
||||
public float unitMineSpeedMultiplier = 1f;
|
||||
/** If true, ghost blocks will appear upon destruction, letting builder blocks/units rebuild them. */
|
||||
public boolean ghostBlocks = true;
|
||||
/** Whether to allow units to build with logic. */
|
||||
@@ -262,6 +264,10 @@ public class Rules{
|
||||
return unitDamage(team) * unitCrashDamageMultiplier * teams.get(team).unitCrashDamageMultiplier;
|
||||
}
|
||||
|
||||
public float unitMineSpeed(Team team){
|
||||
return unitMineSpeedMultiplier * teams.get(team).unitMineSpeedMultiplier;
|
||||
}
|
||||
|
||||
public float blockHealth(Team team){
|
||||
return blockHealthMultiplier * teams.get(team).blockHealthMultiplier;
|
||||
}
|
||||
@@ -312,6 +318,8 @@ public class Rules{
|
||||
public float unitDamageMultiplier = 1f;
|
||||
/** How much damage unit crash damage deals. (Compounds with unitDamageMultiplier) */
|
||||
public float unitCrashDamageMultiplier = 1f;
|
||||
/** How fast units can mine. */
|
||||
public float unitMineSpeedMultiplier = 1f;
|
||||
/** Multiplier of resources that units take to build. */
|
||||
public float unitCostMultiplier = 1f;
|
||||
/** How much health units start with. */
|
||||
|
||||
@@ -1515,7 +1515,7 @@ public class LExecutor{
|
||||
state.rules.bannedUnits.remove(u);
|
||||
}
|
||||
}
|
||||
case unitHealth, unitBuildSpeed, unitCost, unitDamage, blockHealth, blockDamage, buildSpeed, rtsMinSquad, rtsMinWeight -> {
|
||||
case unitHealth, unitBuildSpeed, unitMineSpeed, unitCost, unitDamage, blockHealth, blockDamage, buildSpeed, rtsMinSquad, rtsMinWeight -> {
|
||||
Team team = p1.team();
|
||||
if(team != null){
|
||||
float num = value.numf();
|
||||
@@ -1523,6 +1523,7 @@ public class LExecutor{
|
||||
case buildSpeed -> team.rules().buildSpeedMultiplier = Mathf.clamp(num, 0.001f, 50f);
|
||||
case unitHealth -> team.rules().unitHealthMultiplier = Math.max(num, 0.001f);
|
||||
case unitBuildSpeed -> team.rules().unitBuildSpeedMultiplier = Mathf.clamp(num, 0f, 50f);
|
||||
case unitMineSpeed -> team.rules().unitMineSpeedMultiplier = Math.max(num, 0f);
|
||||
case unitCost -> team.rules().unitCostMultiplier = Math.max(num, 0f);
|
||||
case unitDamage -> team.rules().unitDamageMultiplier = Math.max(num, 0f);
|
||||
case blockHealth -> team.rules().blockHealthMultiplier = Math.max(num, 0.001f);
|
||||
|
||||
@@ -1547,7 +1547,7 @@ public class LStatements{
|
||||
fields(table, "w", p3, s -> p3 = s);
|
||||
fields(table, "h", p4, s -> p4 = s);
|
||||
}
|
||||
case buildSpeed, unitHealth, unitBuildSpeed, unitCost, unitDamage, blockHealth, blockDamage, rtsMinSquad, rtsMinWeight -> {
|
||||
case buildSpeed, unitHealth, unitBuildSpeed, unitMineSpeed, unitCost, unitDamage, blockHealth, blockDamage, rtsMinSquad, rtsMinWeight -> {
|
||||
if(p1.equals("0")){
|
||||
p1 = "@sharded";
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ public enum LogicRule{
|
||||
buildSpeed,
|
||||
unitHealth,
|
||||
unitBuildSpeed,
|
||||
unitMineSpeed,
|
||||
unitCost,
|
||||
unitDamage,
|
||||
blockHealth,
|
||||
|
||||
@@ -265,6 +265,7 @@ public class CustomRulesDialog extends BaseDialog{
|
||||
numberi("@rules.unitcap", f -> rules.unitCap = f, () -> rules.unitCap, -999, 999);
|
||||
number("@rules.unitdamagemultiplier", f -> rules.unitDamageMultiplier = f, () -> rules.unitDamageMultiplier);
|
||||
number("@rules.unitcrashdamagemultiplier", f -> rules.unitCrashDamageMultiplier = f, () -> rules.unitCrashDamageMultiplier);
|
||||
number("@rules.unitminespeedmultiplier", f -> rules.unitMineSpeedMultiplier = f, () -> rules.unitMineSpeedMultiplier);
|
||||
number("@rules.unitbuildspeedmultiplier", f -> rules.unitBuildSpeedMultiplier = f, () -> rules.unitBuildSpeedMultiplier, 0f, 50f);
|
||||
number("@rules.unitcostmultiplier", f -> rules.unitCostMultiplier = f, () -> rules.unitCostMultiplier);
|
||||
number("@rules.unithealthmultiplier", f -> rules.unitHealthMultiplier = f, () -> rules.unitHealthMultiplier);
|
||||
@@ -383,6 +384,7 @@ public class CustomRulesDialog extends BaseDialog{
|
||||
|
||||
number("@rules.unitdamagemultiplier", f -> teams.unitDamageMultiplier = f, () -> teams.unitDamageMultiplier);
|
||||
number("@rules.unitcrashdamagemultiplier", f -> teams.unitCrashDamageMultiplier = f, () -> teams.unitCrashDamageMultiplier);
|
||||
number("@rules.unitminespeedmultiplier", f -> teams.unitMineSpeedMultiplier = f, () -> teams.unitMineSpeedMultiplier);
|
||||
number("@rules.unitbuildspeedmultiplier", f -> teams.unitBuildSpeedMultiplier = f, () -> teams.unitBuildSpeedMultiplier, 0.001f, 50f);
|
||||
number("@rules.unitcostmultiplier", f -> teams.unitCostMultiplier = f, () -> teams.unitCostMultiplier);
|
||||
number("@rules.unithealthmultiplier", f -> teams.unitHealthMultiplier = f, () -> teams.unitHealthMultiplier);
|
||||
|
||||
Reference in New Issue
Block a user