Class BombLoadout

All Implemented Interfaces:
Serializable, Cloneable, Map<BombType.BombTypeEnum,Integer>

public class BombLoadout extends HashMap<BombType.BombTypeEnum,Integer>
Represents a collection of bombs with their quantities.
See Also:
  • Constructor Details

    • BombLoadout

      public BombLoadout()
    • BombLoadout

      public BombLoadout(BombLoadout bombs)
  • Method Details

    • put

      public Integer put(BombType.BombTypeEnum key, Integer count)
      Specified by:
      put in interface Map<BombType.BombTypeEnum,Integer>
      Overrides:
      put in class HashMap<BombType.BombTypeEnum,Integer>
    • getCount

      public int getCount(BombType.BombTypeEnum bombType)
      Returns 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
    • addBombs

      public void addBombs(BombType.BombTypeEnum bombType, int count)
      Adds 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
    • getTotalBombs

      public int getTotalBombs()
      Returns the total number of bombs in this loadout.
      Returns:
      total number of bombs
    • getTotalBombCost

      public int getTotalBombCost()
      Returns the total cost of all bombs in this loadout.
      Returns:
      total cost of bombs
    • hasGuidedOrdnance

      public boolean hasGuidedOrdnance()
      Checks if this loadout contains any guided ordnance that requires TAG
      Returns:
      true if loadout contains ordnance that requires TAG
    • canGroundBomb

      public boolean canGroundBomb()
      Checks if this loadout contains bombs capable of ground attack
      Returns:
      true if loadout contains any ground-capable bombs
    • canSpaceBomb

      public boolean canSpaceBomb()
      Checks if this loadout contains bombs capable of space attack
      Returns:
      true if loadout contains any space-capable bombs