Package megameklab.printing
Class WeaponBayText
java.lang.Object
megameklab.printing.WeaponBayText
- All Implemented Interfaces:
Comparable<WeaponBayText>
Convenience class for storing information about weapon bays for printing. This consists of a list of the weapons in
the bay with heat and damage, along with the location of the bay.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBayAmmo(megamek.common.equipment.WeaponType weaponType, megamek.common.equipment.AmmoMounted ammo) Add a new ammo into this bay.booleanaddBayWeapon(megamek.common.equipment.Mounted<?> weapon) Add a new weapon into this bay.booleanallHaveAugmentation(megamek.common.equipment.EquipmentFlag flag) booleancanCombine(WeaponBayText other) Determines if two WeaponBayTexts are laterally similar and hence can be combined.voidcombine(WeaponBayText other) Combine two WeaponBayTexts.intCompare two WeaponBayTexts based upon locationintcountAugmentations(megamek.common.equipment.EquipmentFlag flag) intcountAugmentations(megamek.common.equipment.WeaponType weaponType, megamek.common.equipment.EquipmentFlag flag)
-
Field Details
-
loc
The location of the bay, or locations if multiple identical bays are combined.
-
-
Constructor Details
-
WeaponBayText
public WeaponBayText(int l, boolean rear) - Parameters:
l- The location indexrear- Whether the bay is rear mounted (dropship wing/aft sides)
-
-
Method Details
-
addBayWeapon
public boolean addBayWeapon(megamek.common.equipment.Mounted<?> weapon) Add a new weapon into this bay.- Parameters:
weapon- The weapon to add to the bay- Returns:
- Whether true if the weapon was added as new, false if it was already in the bay and just incremented
-
addBayAmmo
public void addBayAmmo(megamek.common.equipment.WeaponType weaponType, megamek.common.equipment.AmmoMounted ammo) Add a new ammo into this bay.- Parameters:
ammo- The ammo to add to the bay
-
canCombine
Determines if two WeaponBayTexts are laterally similar and hence can be combined. That is, if there is a weapon bay on the left side that is identical to one on the right side, then those two can be combined in a location like FRS/FLS. This allows weapon lists to be compacted.- Parameters:
other- The other instance- Returns:
- Whether the two bays are identical
-
combine
Combine two WeaponBayTexts. Since they should both contain the same weapons, the only thing that needs to be updated is the locations. This should only be called if canCombine returns true for both WeaponBayTexts.- Parameters:
other- The other bay to combine with this one
-
countAugmentations
public int countAugmentations(megamek.common.equipment.EquipmentFlag flag) - Parameters:
flag- A MiscType flag- Returns:
- The number of weapons in the entire bay linked by equipment with the given flag
-
countAugmentations
public int countAugmentations(megamek.common.equipment.WeaponType weaponType, megamek.common.equipment.EquipmentFlag flag) - Parameters:
weaponType- A type of weapon in the bayflag- A MiscType flag- Returns:
- The number of weapons of the given type in the bay linked by equipment with the given flag
-
allHaveAugmentation
public boolean allHaveAugmentation(megamek.common.equipment.EquipmentFlag flag) - Parameters:
flag- A MiscType flag- Returns:
- Whether all weapons in the bay are linked by equipment with the given flag
-
compareTo
Compare two WeaponBayTexts based upon location- Specified by:
compareToin interfaceComparable<WeaponBayText>
-