unitHealthMultiplier re-implemented
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package mindustry.entities.comp;
|
||||
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
@@ -26,7 +27,7 @@ abstract class ShieldComp implements Healthc, Posc{
|
||||
@Override
|
||||
public void damage(float amount){
|
||||
//apply armor and scaling effects
|
||||
rawDamage(Damage.applyArmor(amount, armor) / healthMultiplier);
|
||||
rawDamage(Damage.applyArmor(amount, armor) / healthMultiplier / Vars.state.rules.unitHealth(team));
|
||||
}
|
||||
|
||||
@Replace
|
||||
@@ -34,7 +35,7 @@ abstract class ShieldComp implements Healthc, Posc{
|
||||
public void damagePierce(float amount, boolean withEffect){
|
||||
float pre = hitTime;
|
||||
|
||||
rawDamage(amount / healthMultiplier);
|
||||
rawDamage(amount / healthMultiplier / Vars.state.rules.unitHealth(team));
|
||||
|
||||
if(!withEffect){
|
||||
hitTime = pre;
|
||||
|
||||
@@ -69,6 +69,8 @@ public class Rules{
|
||||
public float unitCostMultiplier = 1f;
|
||||
/** How much damage units deal. */
|
||||
public float unitDamageMultiplier = 1f;
|
||||
/** How much health units start with. */
|
||||
public float unitHealthMultiplier = 1f;
|
||||
/** How much damage unit crash damage deals. (Compounds with unitDamageMultiplier) */
|
||||
public float unitCrashDamageMultiplier = 1f;
|
||||
/** If true, ghost blocks will appear upon destruction, letting builder blocks/units rebuild them. */
|
||||
@@ -226,6 +228,11 @@ public class Rules{
|
||||
return unitDamageMultiplier * teams.get(team).unitDamageMultiplier;
|
||||
}
|
||||
|
||||
public float unitHealth(Team team){
|
||||
//a 0 here would be a very bad idea.
|
||||
return Math.max(unitHealthMultiplier * teams.get(team).unitHealthMultiplier, 0.000001f);
|
||||
}
|
||||
|
||||
public float unitCrashDamage(Team team){
|
||||
return unitDamage(team) * unitCrashDamageMultiplier * teams.get(team).unitCrashDamageMultiplier;
|
||||
}
|
||||
@@ -233,7 +240,6 @@ public class Rules{
|
||||
public float blockHealth(Team team){
|
||||
return blockHealthMultiplier * teams.get(team).blockHealthMultiplier;
|
||||
}
|
||||
|
||||
public float blockDamage(Team team){
|
||||
return blockDamageMultiplier * teams.get(team).blockDamageMultiplier;
|
||||
}
|
||||
@@ -278,6 +284,8 @@ public class Rules{
|
||||
public float unitCrashDamageMultiplier = 1f;
|
||||
/** Multiplier of resources that units take to build. */
|
||||
public float unitCostMultiplier = 1f;
|
||||
/** How much health units start with. */
|
||||
public float unitHealthMultiplier = 1f;
|
||||
/** How much health blocks start with. */
|
||||
public float blockHealthMultiplier = 1f;
|
||||
/** How much damage blocks (turrets) deal. */
|
||||
|
||||
@@ -192,13 +192,14 @@ 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);
|
||||
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.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);
|
||||
|
||||
|
||||
main.button("@bannedunits", () -> showBanned("@bannedunits", ContentType.unit, rules.bannedUnits, u -> !u.isHidden())).left().width(300f).row();
|
||||
check("@bannedunits.whitelist", b -> rules.unitWhitelist = b, () -> rules.unitWhitelist);
|
||||
@@ -302,6 +303,8 @@ public class CustomRulesDialog extends BaseDialog{
|
||||
number("@rules.unitcrashdamagemultiplier", f -> teams.unitCrashDamageMultiplier = f, () -> teams.unitCrashDamageMultiplier);
|
||||
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);
|
||||
|
||||
|
||||
main = wasMain;
|
||||
}, () -> shown[0]).growX().row();
|
||||
|
||||
Reference in New Issue
Block a user