« All Events
12 PM – Intro To Java – Gamas
April 2, 2022 @ 12:00 pm - 1:00 pm
Homework
- Continue on MonsterInheritance
- Add the ability to heal the player
- Change monster status according to its health. If its health is less than 0, display <Monster Name> has been defeated. For example, – TROLL has been defeated.
- Look at below for expected behavior.
Gamas has 44 health remaining.
Please select one of the following monsters:
- TROLL - Health: 5
- DRAGON - Health: 100
- WATER GOLEM - Health: 50
Enter the monster species
(enter 'exit' to quit or 'heal' to heal the player): heal
HEAL PLAYER
Enter healing point: 30
Now the player has 74 health remaining
Gamas has 74 health remaining.
Please select one of the following monsters:
- TROLL - Health: 5
- DRAGON - Health: 100
- WATER GOLEM - Health: 50
Enter the monster species:
(enter 'exit' to quit OR 'heal' to heal player): troll
What do you want to do with the TROLL:
1. Magic attack
2. Melee attack
3. Arrow attack
4. Heal
Enter your selection:1
What kind of magic attack you want to do to Troll:
1. Fire magic - 10 damage
2. Water magic - 10 damage
3. Earth magic - 12 damage
4. Wind magic - 8 damage
Enter your selection:1
You attacked the Troll and killed it. Congratulation
The Troll attacked the player with 40 attack.
Gamas has 74 health remaining.
Please select one of the following monsters:
- Troll has been defeated
- DRAGON - Health: 100
- WATER GOLEM - Health: 50
Enter the monster species:
(enter 'exit' to quit OR 'heal' to heal player):