COMP2396
|
The Student is poor and can only afford using a BadGun. More...
Public Member Functions | |
Student (String name, int energyLevel, int skillLevel) | |
Constructs a new Student with the specified name, energy level, and skill level. | |
void | hide () |
Hides the student from the next attack. | |
int | hurt (int attackAmount) |
Calculates the amount of hurt taken from an attack. | |
![]() | |
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. | |
int | getEnergyLevel () |
Returns the current energy level of the character. | |
String | getName () |
Returns the name of the character. | |
int | getSkillLevel () |
Returns the skill level of the character. | |
boolean | isLose () |
Determines whether the character has lost the combat. | |
Private Attributes | |
boolean | isHidden = false |
The Student is poor and can only afford using a BadGun.
However, he/she can hide to dodge an attack and receive 0 hurt. It is a subclass of the Character class.
Definition at line 8 of file Student.java.
|
inline |
Constructs a new Student with the specified name, energy level, and skill level.
name | the name of the student |
energyLevel | the initial energy level of the student |
skillLevel | the skill level of the student |
Definition at line 18 of file Student.java.
References assignment2.Character.energyLevel, and assignment2.Character.skillLevel.
|
inline |
Hides the student from the next attack.
When hidden, the student takes no damage.
Definition at line 25 of file Student.java.
References assignment2.Student.isHidden.
Referenced by assignment2.OfficeCombat2.main().
|
inline |
Calculates the amount of hurt taken from an attack.
If the student is hidden, they take no damage. Otherwise, reduces the energy level by the attack amount.
attackAmount | the amount of attack received |
Reimplemented from assignment2.Character.
Definition at line 38 of file Student.java.
References assignment2.Student.isHidden.
Referenced by assignment2.OfficeCombat2.main().
|
private |
Definition at line 9 of file Student.java.
Referenced by assignment2.Student.hide(), and assignment2.Student.hurt().