use of megamek.common.MiscType in project megameklab by MegaMek.
the class PrintMech method printShields.
private void printShields() {
for (Mounted m : mech.getMisc()) {
if (((MiscType) m.getType()).isShield()) {
String loc = mech.getLocationAbbr(m.getLocation());
Element element;
element = getSVGDocument().getElementById("armorDiagram" + loc);
if (null != element) {
hideElement(element, true);
}
element = getSVGDocument().getElementById("shield" + loc);
if (null != element) {
hideElement(element, false);
}
element = getSVGDocument().getElementById("shieldDC" + loc);
if (null != element) {
addPips(element, m.getBaseDamageCapacity(), false, PipType.CIRCLE);
}
element = getSVGDocument().getElementById("shieldDA" + loc);
if (null != element) {
addPips(element, m.getBaseDamageAbsorptionRate(), false, PipType.DIAMOND);
}
}
}
}
use of megamek.common.MiscType in project megameklab by MegaMek.
the class UnitUtil method getShieldDamageAbsorption.
public static int getShieldDamageAbsorption(Mech mech, int location) {
final String METHOD_NAME = "getShieldDamageAbsorption(Mech, int)";
for (int slot = 0; slot < mech.getNumberOfCriticals(location); slot++) {
CriticalSlot cs = mech.getCritical(location, slot);
if (cs == null) {
continue;
}
if (cs.getType() != CriticalSlot.TYPE_EQUIPMENT) {
continue;
}
Mounted m = cs.getMount();
if (m == null) {
getLogger().log(UnitUtil.class, METHOD_NAME, LogLevel.ERROR, "Null Mount index: " + cs.getIndex());
m = cs.getMount();
}
EquipmentType type = m.getType();
if ((type instanceof MiscType) && ((MiscType) type).isShield()) {
return m.getBaseDamageAbsorptionRate();
}
}
return 0;
}
Aggregations