Package megamek.common.equipment
Class BombLoadout
- All Implemented Interfaces:
- Serializable,- Cloneable,- Map<BombType.BombTypeEnum,- Integer> 
Represents a collection of bombs with their quantities.
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class java.util.AbstractMapAbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> 
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddBombs(BombType.BombTypeEnum bombType, int count) Adds a specified number of bombs of a given type to this loadout.booleanChecks if this loadout contains bombs capable of ground attackbooleanChecks if this loadout contains bombs capable of space attackintgetCount(BombType.BombTypeEnum bombType) Returns the count of bombs of a given type in this loadout.intReturns the total cost of all bombs in this loadout.intReturns the total number of bombs in this loadout.booleanChecks if this loadout contains any guided ordnance that requires TAGput(BombType.BombTypeEnum key, Integer count) Methods inherited from class java.util.HashMapclear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.util.AbstractMapequals, hashCode, toString
- 
Constructor Details- 
BombLoadoutpublic BombLoadout()
- 
BombLoadout
 
- 
- 
Method Details- 
put- Specified by:
- putin interface- Map<BombType.BombTypeEnum,- Integer> 
- Overrides:
- putin class- HashMap<BombType.BombTypeEnum,- Integer> 
 
- 
getCountReturns the count of bombs of a given type in this loadout. If the bomb type does not exist, returns 0.- Parameters:
- bombType- the type of bomb to check
- Returns:
- the count of bombs of the specified type
 
- 
addBombsAdds a specified number of bombs of a given type to this loadout. If the bomb type does not exist, it will be added with the specified count. If the count is zero or negative, the bomb type will be removed from the loadout.- Parameters:
- bombType- the type of bomb to add
- count- the number of bombs to add
 
- 
getTotalBombspublic int getTotalBombs()Returns the total number of bombs in this loadout.- Returns:
- total number of bombs
 
- 
getTotalBombCostpublic int getTotalBombCost()Returns the total cost of all bombs in this loadout.- Returns:
- total cost of bombs
 
- 
hasGuidedOrdnancepublic boolean hasGuidedOrdnance()Checks if this loadout contains any guided ordnance that requires TAG- Returns:
- true if loadout contains ordnance that requires TAG
 
- 
canGroundBombpublic boolean canGroundBomb()Checks if this loadout contains bombs capable of ground attack- Returns:
- true if loadout contains any ground-capable bombs
 
- 
canSpaceBombpublic boolean canSpaceBomb()Checks if this loadout contains bombs capable of space attack- Returns:
- true if loadout contains any space-capable bombs
 
 
-