Package card.pokemon

Class PokemonCard

java.lang.Object
card.Card
card.pokemon.PokemonCard
Direct Known Subclasses:
Diglett, Dratini, Growlithe, Hitmonchan, Machop, Ponyta, Rattata, Seel, Staryu

public class PokemonCard extends Card
This class represents a Pokémon card in the Pokémon Trading Card Game. It extends the Card class and provides methods to get various attributes of the card, including HP, weakness, resistance, retreat cost, energy count, moves, and more.
Version:
1.0
Author:
Tyler Mong
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Map<String,Integer>
    A map of energy types and their counts for the Pokémon card (e.g., {"Fire": 2, "Water": 1}).
    private int
    The HP of the Pokémon card (e.g., 40).
    private List<Move>
    The list of moves associated with the Pokémon card.
    private String
    The resistance of the Pokémon card (e.g., "Water").
    private int
    The retreat cost of the Pokémon card (e.g., 2).
    private String
    The weakness of the Pokémon card (e.g., "Fire").
  • Constructor Summary

    Constructors
    Constructor
    Description
    PokemonCard(String name, int HP, String weakness, String resistance, int retreatCost)
    Constructor to initialize a Pokémon card with a name, HP, weakness, resistance, retreat cost, moves, and energy count.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addEnergy(EnergyCard energyCard)
    Attaches an energy card to the Pokémon card.
    void
    addMove(Move move)
    Adds a move to the Pokémon card's list of moves.
    Displays the energy attached to the Pokémon card in a list format.
    Returns the type of energy attached to the Pokémon card and its count.
    int
    Returns the HP of the Pokémon card.
    Returns a Pokémon card's moves.
    Returns the resistance of the Pokémon card.
    int
    Returns the Pokémon card's retreat cost.
    int
    Returns the total count of all energy attached to the Pokémon card.
    int
    getTypeEnergy(String energyType)
    Returns the count of a specific type of energy attached to the Pokémon card.
    Returns the weakness of the Pokémon card.
    void
    removeEnergy(String energyType)
    Removes an energy card from the Pokémon card.
    void
    setHP(int HP)
    Sets the HP of the Pokémon card.

    Methods inherited from class card.Card

    getName, getType

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • HP

      private int HP
      The HP of the Pokémon card (e.g., 40).
    • weakness

      private String weakness
      The weakness of the Pokémon card (e.g., "Fire"). Double damage is dealt to the Pokémon if it is weak to the attacker's type.
    • resistance

      private String resistance
      The resistance of the Pokémon card (e.g., "Water"). -30 damage is dealt to the Pokémon if it is resistant to the attacker's type.
    • retreatCost

      private int retreatCost
      The retreat cost of the Pokémon card (e.g., 2). This is the number of energy cards required to retreat the Pokémon.
    • moves

      private List<Move> moves
      The list of moves associated with the Pokémon card.
    • energyCount

      private Map<String,Integer> energyCount
      A map of energy types and their counts for the Pokémon card (e.g., {"Fire": 2, "Water": 1}). The key is the energy type, and the value is the count of that energy type attached to the Pokémon card.
  • Constructor Details

    • PokemonCard

      public PokemonCard(String name, int HP, String weakness, String resistance, int retreatCost)
      Constructor to initialize a Pokémon card with a name, HP, weakness, resistance, retreat cost, moves, and energy count. This constructor is called by the subclasses to create a new Pokémon card.
  • Method Details

    • getHP

      public int getHP()
      Returns the HP of the Pokémon card.
      Returns:
      The HP of the Pokémon card.
    • setHP

      public void setHP(int HP)
      Sets the HP of the Pokémon card. This method is used to update the HP of the Pokémon card when it takes damage.
      Parameters:
      HP - The HP to set for the Pokémon card.
    • getWeakness

      public String getWeakness()
      Returns the weakness of the Pokémon card.
      Returns:
      The weakness of the Pokémon card.
    • getResistance

      public String getResistance()
      Returns the resistance of the Pokémon card.
      Returns:
      The resistance of the Pokémon card.
    • getRetreatCost

      public int getRetreatCost()
      Returns the Pokémon card's retreat cost.
      Returns:
      The Pokémon card's retreat cost.
    • addMove

      public void addMove(Move move)
      Adds a move to the Pokémon card's list of moves.
      Parameters:
      move - The move to add.
    • getMoves

      public Move[] getMoves()
      Returns a Pokémon card's moves.
      Returns:
      The list of moves associated with the Pokémon card.
    • addEnergy

      public void addEnergy(EnergyCard energyCard)
      Attaches an energy card to the Pokémon card.
      Parameters:
      energyCard - The energy card to attach to the Pokémon card.
    • removeEnergy

      public void removeEnergy(String energyType)
      Removes an energy card from the Pokémon card.
      Parameters:
      energyType - The type of energy to remove.
    • displayEnergyInMap

      public Map<String,Integer> displayEnergyInMap()
      Returns the type of energy attached to the Pokémon card and its count.
      Returns:
      A map containing the type of energy attached to the Pokémon card and its count.
    • displayEnergyInList

      public List<String> displayEnergyInList()
      Displays the energy attached to the Pokémon card in a list format.
      Returns:
      A list of energy attached to the Pokémon card.
    • getTypeEnergy

      public int getTypeEnergy(String energyType)
      Returns the count of a specific type of energy attached to the Pokémon card. This method is used to verify Energy requirements for attack moves.
      Parameters:
      energyType - The type of energy to get the count for.
      Returns:
      The count of the specified type of energy attached to the Pokémon card.
    • getTotalEnergy

      public int getTotalEnergy()
      Returns the total count of all energy attached to the Pokémon card. This method is used to verify the total energy count for retreating.
      Returns:
      The total count of all energy attached to the Pokémon card.