Added config option to tweak maximum total armor per piece
This commit is contained in:
parent
5bd3759dd6
commit
de68d469c5
2 changed files with 19 additions and 2 deletions
|
@ -109,6 +109,18 @@ public class Config {
|
|||
public static double getSalvageChance() {
|
||||
return config.get(Configuration.CATEGORY_GENERAL, "Salvage Ratio", 0.9).getDouble(0.9);
|
||||
}
|
||||
|
||||
/**
|
||||
* The maximum amount of armor contribution allowed per armor piece. Total
|
||||
* armor when the full set is worn can never exceed 4 times this amount.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static double getMaximumArmorPerPiece() {
|
||||
// Clamp this value between 0 and 6 armor points.
|
||||
// The default of 6 will allow 24% reduction per piece.
|
||||
return Math.min(6.0, Math.max(0.0, config.get(Configuration.CATEGORY_GENERAL, "Maximum Armor per Piece", 6.0).getDouble(6.0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not to print debugging info.
|
||||
|
@ -442,6 +454,10 @@ public class Config {
|
|||
.setDescription("An alternative armor texture, c/o CitizenJoe of IC2 forums.");
|
||||
|
||||
addModule(module);
|
||||
|
||||
// Make the maximum armor per piece value show up in config file
|
||||
getMaximumArmorPerPiece();
|
||||
|
||||
// red = 1, green = 2, blue = 4
|
||||
}
|
||||
|
||||
|
|
|
@ -217,8 +217,9 @@ public abstract class ItemPowerArmor extends ItemArmor
|
|||
if (energy > enerConsum) {
|
||||
totalArmor += enerArmor;
|
||||
}
|
||||
// Make it so each armor piece can only contribute 24% reduction
|
||||
totalArmor = Math.min(6, totalArmor);
|
||||
// Make it so each armor piece can only contribute reduction up to the configured amount.
|
||||
// Defaults to 6 armor points, or 24% reduction.
|
||||
totalArmor = Math.min(Config.getMaximumArmorPerPiece(), totalArmor);
|
||||
return totalArmor;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue