Skip to content

Commit

Permalink
Removed static armor weight methods for BA and protos from EquipmentT…
Browse files Browse the repository at this point in the history
…ype.
  • Loading branch information
neoancient committed Jan 28, 2024
1 parent c1c266e commit 2b2e22f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions MekHQ/src/mekhq/campaign/parts/BaArmor.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Objects;

import megamek.common.EquipmentType;
import megamek.common.equipment.ArmorType;
import mekhq.campaign.Campaign;
import mekhq.campaign.finances.Money;
import mekhq.campaign.work.IAcquisitionWork;
Expand All @@ -43,7 +44,7 @@ public static boolean canBeIs(int type) {


public static double getPointsPerTon(int t, boolean isClan) {
return 1.0/EquipmentType.getBaArmorWeightPerPoint(t, isClan);
return 1.0 / ArmorType.of(t, isClan).getWeightPerPoint();
}

public BaArmor() {
Expand All @@ -64,7 +65,7 @@ public BaArmor clone() {

@Override
public double getTonnage() {
return EquipmentType.getBaArmorWeightPerPoint(type, clan) * amount;
return ArmorType.of(type, clan).getWeightPerPoint() * amount;
}

public Money getPointCost() {
Expand Down
11 changes: 6 additions & 5 deletions MekHQ/src/mekhq/campaign/parts/ProtomekArmor.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import megamek.common.EquipmentType;
import megamek.common.Protomech;
import megamek.common.TechAdvancement;
import megamek.common.equipment.ArmorType;
import mekhq.campaign.Campaign;
import mekhq.campaign.finances.Money;
import mekhq.campaign.work.IAcquisitionWork;
Expand Down Expand Up @@ -54,18 +55,18 @@ public ProtomekArmor clone() {

@Override
public double getTonnage() {
return EquipmentType.getProtomechArmorWeightPerPoint(type) * amount;
return ArmorType.of(type, true).getWeightPerPoint() * amount;
}

@Override
public Money getActualValue() {
return adjustCostsForCampaignOptions(
Money.of(amount * EquipmentType.getProtomechArmorCostPerPoint(type)));
Money.of(amount * ArmorType.of(type, true).getWeightPerPoint()));
}

@Override
public double getTonnageNeeded() {
return amountNeeded / EquipmentType.getProtomechArmorWeightPerPoint(type);
return amountNeeded / ArmorType.of(type, true).getWeightPerPoint();
}

@Override
Expand All @@ -77,7 +78,7 @@ public Money getValueNeeded() {
@Override
public Money getStickerPrice() {
// always in 5-ton increments
return Money.of(5.0 / EquipmentType.getProtomechArmorWeightPerPoint(type) * getArmorPointsPerTon()
return Money.of(5.0 / ArmorType.of(type, true).getWeightPerPoint() * getArmorPointsPerTon()
* EquipmentType.getProtomechArmorCostPerPoint(type));
}

Expand Down Expand Up @@ -117,7 +118,7 @@ public int getDifficulty() {

@Override
public double getArmorPointsPerTon() {
return 1.0 / EquipmentType.getProtomechArmorWeightPerPoint(type);
return 1.0 / ArmorType.of(type, true).getWeightPerPoint();
}

@Override
Expand Down

0 comments on commit 2b2e22f

Please sign in to comment.