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
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
FieldsModifier and TypeFieldDescriptionA 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).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
ConstructorsConstructorDescriptionPokemonCard
(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 TypeMethodDescriptionvoid
addEnergy
(EnergyCard energyCard) Attaches an energy card to the Pokémon card.void
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
getHP()
Returns the HP of the Pokémon card.Move[]
getMoves()
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.
-
Field Details
-
HP
private int HPThe HP of the Pokémon card (e.g., 40). -
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
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 retreatCostThe retreat cost of the Pokémon card (e.g., 2). This is the number of energy cards required to retreat the Pokémon. -
moves
The list of moves associated with the Pokémon card. -
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
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
Returns the weakness of the Pokémon card.- Returns:
- The weakness of the Pokémon card.
-
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
Adds a move to the Pokémon card's list of moves.- Parameters:
move
- The move to add.
-
getMoves
Returns a Pokémon card's moves.- Returns:
- The list of moves associated with the Pokémon card.
-
addEnergy
Attaches an energy card to the Pokémon card.- Parameters:
energyCard
- The energy card to attach to the Pokémon card.
-
removeEnergy
Removes an energy card from the Pokémon card.- Parameters:
energyType
- The type of energy to remove.
-
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
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
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.
-