Today We Do
- We continued with Monster Inheritance project.
- We added attack menu after user selected a proper monster species.
Homework
- In the attack menu, after user selected “2. Melee attack”, we need to have mechanism where the user can attack monster, which will reduce monster.health. This is very similar to the quiz, where we have bank account and user during withdrawal can reduce the bank account balance.
- On top of this, we also want the monster to attack the player and reduce the “playerHealth” attribute. For now, just reduce’s player health by 10. Next week we will see how to randomize monster attack according to monster.maxAttack.
- Look at expected behavior below where user will attack troll with 10 attack points. Then the troll’s health will be decreased from 50 to 40. And the troll will attack the player which will reduce playerHealth from 100 to 90.
Please select from one of the following
1. Add new monster
2. List all monsters
3. Play the game
Enter your selection (enter "exit" to quit):3
What is your name: Gamas
How much health you want: 100
Gamas has 100 health remaining.
Please select one of the following monsters:
- troll - 50 health
- dragon - 100 health
- Water Golem - 30 health
Enter your selection (Enter 'stop' to end the game): troll
What do you want to do with the troll:
1. Magic attack
2. Melee attack
3. Arrow attack (5 -10 damage)
4. Heal
Enter your selection:2
How much melee attack do you want to do to the troll: 10
You attacked TROLL with 10 attack. The TROLL has 40 health remaining.
TROLL attacked Gamas and did 10 damage
Gamas has 90 health remaining.
Please select one of the following monsters:
- troll - 40 health
- dragon - 100 health
- Water Golem - 30 health
Enter your selection (Enter 'stop' to end the game):