unitHealthMultiplier re-implemented
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package mindustry.entities.comp;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
|
import mindustry.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
@@ -26,7 +27,7 @@ abstract class ShieldComp implements Healthc, Posc{
|
|||||||
@Override
|
@Override
|
||||||
public void damage(float amount){
|
public void damage(float amount){
|
||||||
//apply armor and scaling effects
|
//apply armor and scaling effects
|
||||||
rawDamage(Damage.applyArmor(amount, armor) / healthMultiplier);
|
rawDamage(Damage.applyArmor(amount, armor) / healthMultiplier / Vars.state.rules.unitHealth(team));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Replace
|
@Replace
|
||||||
@@ -34,7 +35,7 @@ abstract class ShieldComp implements Healthc, Posc{
|
|||||||
public void damagePierce(float amount, boolean withEffect){
|
public void damagePierce(float amount, boolean withEffect){
|
||||||
float pre = hitTime;
|
float pre = hitTime;
|
||||||
|
|
||||||
rawDamage(amount / healthMultiplier);
|
rawDamage(amount / healthMultiplier / Vars.state.rules.unitHealth(team));
|
||||||
|
|
||||||
if(!withEffect){
|
if(!withEffect){
|
||||||
hitTime = pre;
|
hitTime = pre;
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ public class Rules{
|
|||||||
public float unitCostMultiplier = 1f;
|
public float unitCostMultiplier = 1f;
|
||||||
/** How much damage units deal. */
|
/** How much damage units deal. */
|
||||||
public float unitDamageMultiplier = 1f;
|
public float unitDamageMultiplier = 1f;
|
||||||
|
/** How much health units start with. */
|
||||||
|
public float unitHealthMultiplier = 1f;
|
||||||
/** How much damage unit crash damage deals. (Compounds with unitDamageMultiplier) */
|
/** How much damage unit crash damage deals. (Compounds with unitDamageMultiplier) */
|
||||||
public float unitCrashDamageMultiplier = 1f;
|
public float unitCrashDamageMultiplier = 1f;
|
||||||
/** If true, ghost blocks will appear upon destruction, letting builder blocks/units rebuild them. */
|
/** 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;
|
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){
|
public float unitCrashDamage(Team team){
|
||||||
return unitDamage(team) * unitCrashDamageMultiplier * teams.get(team).unitCrashDamageMultiplier;
|
return unitDamage(team) * unitCrashDamageMultiplier * teams.get(team).unitCrashDamageMultiplier;
|
||||||
}
|
}
|
||||||
@@ -233,7 +240,6 @@ public class Rules{
|
|||||||
public float blockHealth(Team team){
|
public float blockHealth(Team team){
|
||||||
return blockHealthMultiplier * teams.get(team).blockHealthMultiplier;
|
return blockHealthMultiplier * teams.get(team).blockHealthMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float blockDamage(Team team){
|
public float blockDamage(Team team){
|
||||||
return blockDamageMultiplier * teams.get(team).blockDamageMultiplier;
|
return blockDamageMultiplier * teams.get(team).blockDamageMultiplier;
|
||||||
}
|
}
|
||||||
@@ -278,6 +284,8 @@ public class Rules{
|
|||||||
public float unitCrashDamageMultiplier = 1f;
|
public float unitCrashDamageMultiplier = 1f;
|
||||||
/** Multiplier of resources that units take to build. */
|
/** Multiplier of resources that units take to build. */
|
||||||
public float unitCostMultiplier = 1f;
|
public float unitCostMultiplier = 1f;
|
||||||
|
/** How much health units start with. */
|
||||||
|
public float unitHealthMultiplier = 1f;
|
||||||
/** How much health blocks start with. */
|
/** How much health blocks start with. */
|
||||||
public float blockHealthMultiplier = 1f;
|
public float blockHealthMultiplier = 1f;
|
||||||
/** How much damage blocks (turrets) deal. */
|
/** How much damage blocks (turrets) deal. */
|
||||||
|
|||||||
@@ -192,13 +192,14 @@ public class CustomRulesDialog extends BaseDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
title("@rules.title.unit");
|
title("@rules.title.unit");
|
||||||
//check("@rules.unitammo", b -> rules.unitAmmo = b, () -> rules.unitAmmo);
|
|
||||||
check("@rules.unitcapvariable", b -> rules.unitCapVariable = b, () -> rules.unitCapVariable);
|
check("@rules.unitcapvariable", b -> rules.unitCapVariable = b, () -> rules.unitCapVariable);
|
||||||
numberi("@rules.unitcap", f -> rules.unitCap = f, () -> rules.unitCap, -999, 999);
|
numberi("@rules.unitcap", f -> rules.unitCap = f, () -> rules.unitCap, -999, 999);
|
||||||
number("@rules.unitdamagemultiplier", f -> rules.unitDamageMultiplier = f, () -> rules.unitDamageMultiplier);
|
number("@rules.unitdamagemultiplier", f -> rules.unitDamageMultiplier = f, () -> rules.unitDamageMultiplier);
|
||||||
number("@rules.unitcrashdamagemultiplier", f -> rules.unitCrashDamageMultiplier = f, () -> rules.unitCrashDamageMultiplier);
|
number("@rules.unitcrashdamagemultiplier", f -> rules.unitCrashDamageMultiplier = f, () -> rules.unitCrashDamageMultiplier);
|
||||||
number("@rules.unitbuildspeedmultiplier", f -> rules.unitBuildSpeedMultiplier = f, () -> rules.unitBuildSpeedMultiplier, 0f, 50f);
|
number("@rules.unitbuildspeedmultiplier", f -> rules.unitBuildSpeedMultiplier = f, () -> rules.unitBuildSpeedMultiplier, 0f, 50f);
|
||||||
number("@rules.unitcostmultiplier", f -> rules.unitCostMultiplier = f, () -> rules.unitCostMultiplier);
|
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();
|
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);
|
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.unitcrashdamagemultiplier", f -> teams.unitCrashDamageMultiplier = f, () -> teams.unitCrashDamageMultiplier);
|
||||||
number("@rules.unitbuildspeedmultiplier", f -> teams.unitBuildSpeedMultiplier = f, () -> teams.unitBuildSpeedMultiplier, 0.001f, 50f);
|
number("@rules.unitbuildspeedmultiplier", f -> teams.unitBuildSpeedMultiplier = f, () -> teams.unitBuildSpeedMultiplier, 0.001f, 50f);
|
||||||
number("@rules.unitcostmultiplier", f -> teams.unitCostMultiplier = f, () -> teams.unitCostMultiplier);
|
number("@rules.unitcostmultiplier", f -> teams.unitCostMultiplier = f, () -> teams.unitCostMultiplier);
|
||||||
|
number("@rules.unithealthmultiplier", f -> teams.unitHealthMultiplier = f, () -> teams.unitHealthMultiplier);
|
||||||
|
|
||||||
|
|
||||||
main = wasMain;
|
main = wasMain;
|
||||||
}, () -> shown[0]).growX().row();
|
}, () -> shown[0]).growX().row();
|
||||||
|
|||||||
Reference in New Issue
Block a user