Package com.mg105.entities
Class BattleCharacter
java.lang.Object
com.mg105.entities.BattleCharacter
- All Implemented Interfaces:
Comparable<BattleCharacter>
BattleCharacter is a class which contains the stats and other battle related information corresponding to a
specific character.
-
Constructor Summary
ConstructorDescriptionBattleCharacter
(int health, String name, int attack, int speed, boolean isOpponent, Move first, Move second) Creates a new BattleCharacter with the given stats. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(BattleCharacter other) Allow BattleCharacters to be compared with each other based on their speed stat.void
Ensure this BattleCharacter is completely healed.int
getDmg()
Returns the current damage stat of the character.int
getHp()
Returns the current health of the character.int
getMaxHp()
Returns the maximum health of the character.Returns the character's first move.Returns the character's second move.getName()
Returns the name of the character.int
getSpeed()
Returns the speed of the character.boolean
Returns whether the character is an opponent or not.void
modifyDamage
(int damageChange) Updates the character's attack damage by the given amount.void
modifyHealth
(int healthChange) Updates the character's current health by the given amount.void
modifyMaxHp
(int maximumChange) Updates the character's maximum health by the given amount.void
modifySpeed
(int speedChange) Updates the character's speed by the given amount.
-
Constructor Details
-
BattleCharacter
public BattleCharacter(int health, String name, int attack, int speed, boolean isOpponent, Move first, Move second) Creates a new BattleCharacter with the given stats.- Parameters:
health
- The integer amount of (max) health the character will have.name
- The character's name String.attack
- The integer amount of the character's attack strength.speed
- The speed integer of the character.isOpponent
- boolean for if character is an opponent.first
- The first Move the character can use.second
- The second Move the character can use.
-
-
Method Details
-
getHp
public int getHp()Returns the current health of the character.- Returns:
- the number of hit points the character currently has.
-
getMaxHp
public int getMaxHp()Returns the maximum health of the character.- Returns:
- the maximum number of hit points the character has.
-
getName
Returns the name of the character.- Returns:
- the name of the BattleCharacter as a String.
-
getDmg
public int getDmg()Returns the current damage stat of the character.- Returns:
- the attack damage the character currently has.
-
getSpeed
public int getSpeed()Returns the speed of the character.- Returns:
- the speed of the BattleCharacter.
-
isOpponent
public boolean isOpponent()Returns whether the character is an opponent or not.- Returns:
- whether the BattleCharacter is an opponent or not.
-
getMoveOne
Returns the character's first move.- Returns:
- the first Move of the BattleCharacter.
-
getMoveTwo
Returns the character's second move.- Returns:
- the second Move of the BattleCharacter.
-
modifyHealth
public void modifyHealth(int healthChange) Updates the character's current health by the given amount. If the amount causes the character's health to go below 0, set it to 0. If the amount heals the character beyond their max, set it to the max.- Parameters:
healthChange
- the amount by which the BattleCharacter's hp should change.
-
fullHealCharacter
public void fullHealCharacter()Ensure this BattleCharacter is completely healed. (Has their maximum health value. -
modifyMaxHp
public void modifyMaxHp(int maximumChange) Updates the character's maximum health by the given amount. Also modifies the character's current health accordingly.- Parameters:
maximumChange
- the amount by which the BattleCharacter's maximum hp should change.
-
modifyDamage
public void modifyDamage(int damageChange) Updates the character's attack damage by the given amount.- Parameters:
damageChange
- the amount by which the BattleCharacter's damage should change.
-
modifySpeed
public void modifySpeed(int speedChange) Updates the character's speed by the given amount. Only used outside active Battle.- Parameters:
speedChange
- the amount by which the BattleCharacter's speed should change.
-
compareTo
Allow BattleCharacters to be compared with each other based on their speed stat.- Specified by:
compareTo
in interfaceComparable<BattleCharacter>
-