20 this.characterName = name;
58 public int hurt(
int attackAmount) {
59 this.energyLevel -= attackAmount;
81 return this.energyLevel <= 0;
The Character class represents any game character with a name, skill level, and energy level.
int hurt(int attackAmount)
Reduces the energy level of the character by the specified attack amount.
boolean isLose()
Determines whether the character has lost the combat.
int getSkillLevel()
Returns the skill level of the character.
int getEnergyLevel()
Returns the current energy level of the character.
Character(String name, int energyLevel, int skillLevel)
Constructs a new Character with the specified name, energy level, and skill level.
int attack(Weapon w1)
Calculates the total attack amount generated by the character.
String getName()
Returns the name of the character.
final String characterName
The Weapon class represents any game weapon with a name and power level.
int shoot()
Simulates shooting the weapon and returns the power generated.