Skip to content

Commit

Permalink
Removed armor PPT static methods from EquipmentType.
Browse files Browse the repository at this point in the history
  • Loading branch information
neoancient committed Jan 28, 2024
1 parent f384523 commit 253d1d4
Showing 1 changed file with 4 additions and 29 deletions.
33 changes: 4 additions & 29 deletions megameklab/src/megameklab/util/UnitUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import megamek.common.*;
import megamek.common.annotations.Nullable;
import megamek.common.equipment.ArmorType;
import megamek.common.verifier.*;
import megamek.common.verifier.TestEntity.Ceil;
import megamek.common.verifier.TestProtomech.ProtomechArmor;
Expand Down Expand Up @@ -843,8 +844,7 @@ public static double getMaximumArmorTonnage(Entity unit) {
return TestAdvancedAerospace.maxArmorWeight((Jumpship) unit);
}

double armorPerTon = 16.0 * EquipmentType.getArmorPointMultiplier(
unit.getArmorType(1), unit.getArmorTechLevel(1));
double armorPerTon = ArmorType.forEntity(unit).getPointsPerTon(unit);
double armorWeight = 0;

if (unit.getArmorType(1) == EquipmentType.T_ARMOR_HARDENED) {
Expand Down Expand Up @@ -934,7 +934,7 @@ public static double getSIBonusArmorPoints(Entity entity) {
points = Math.round(((Jumpship) entity).getSI() / 10.0) * 6;
}
if (entity.isPrimitive()) {
return points * EquipmentType.getArmorPointMultiplier(EquipmentType.T_ARMOR_PRIMITIVE_AERO);
return points * ArmorType.of(EquipmentType.T_ARMOR_PRIMITIVE_AERO, false).getArmorPointsMultiplier();
} else {
return points;
}
Expand All @@ -953,23 +953,6 @@ public static int getArmorPoints(Entity unit, double armorTons) {
return Math.min(raw, UnitUtil.getMaximumArmorPoints(unit));
}

/**
* NOTE: only use for non-patchwork armor
*
* @param unit The entity
* @param armorTons
* @return
*/
public static int getArmorPoints(Entity unit, int loc, double armorTons) {
double armorPerTon = 16.0 * EquipmentType.getArmorPointMultiplier(
unit.getArmorType(loc), unit.getArmorTechLevel(loc));
if (unit.getArmorType(loc) == EquipmentType.T_ARMOR_HARDENED) {
armorPerTon = 8.0;
}
return Math.min((int) Math.floor(armorPerTon * armorTons),
UnitUtil.getMaximumArmorPoints(unit, loc));
}

/**
* Calculate the number of armor points per ton of armor for the given unit.
*
Expand All @@ -980,15 +963,7 @@ public static int getArmorPoints(Entity unit, int loc, double armorTons) {
*/
// TODO: aerospace and support vehicle armor
public static double getArmorPointsPerTon(Entity en, int at, boolean clanArmor) {
if (at == EquipmentType.T_ARMOR_HARDENED) {
return 8.0;
} else if (en.hasETypeFlag(Entity.ETYPE_JUMPSHIP)) {
return TestAdvancedAerospace.armorPointsPerTon((Jumpship) en, at, clanArmor);
} else if (en.hasETypeFlag(Entity.ETYPE_SMALL_CRAFT)) {
return SmallCraft.armorPointsPerTon(en.getWeight(), ((Aero) en).isSpheroid(), at, clanArmor);
} else {
return 16.0 * EquipmentType.getArmorPointMultiplier(at, clanArmor);
}
return ArmorType.of(at, clanArmor).getPointsPerTon(en);
}

/**
Expand Down

0 comments on commit 253d1d4

Please sign in to comment.