American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

5 PM – Intro To Java – Gamas

April 23, 2022 @ 5:00 pm - 6:00 pm

Today We Do
  1. We continued on MonsterInheritance project.
  2. We made sure this project has Monster class which has String species, int health, int maxDamage.
  3. We added Monster.doDamage(int amount) which will reduce Monster.health.
  4. We added attack menu after user selected a monster.
Homework
  1. Add initializeMonster() method and add 3 monsters to monsterMap:
    • dragon, health: 100, maxDamage: 50
    • troll, health: 50, maxDamage: 25
    • water golem, health: 30, maxDamage: 10
  2. Call this initializeMonster() inside MonsterInheritanceMain.run() method before the while loop. This way, it is easier to test this project.
  3. Add “Melee Attack” feature where player attack the selected monster and monster attack the player.
  4. When player attack the selected monster, the selected monster health will be reduced. Use the monster.doDamage(int amount) method. This is similar to withdrawal mechanism in the quiz.
  5. When the monster attack the player, the damage would be between 10 and monster.maxDamage. Look at below for expected behavior
  6. 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 Chang
    How much health you want: 100
    
    Gamas Chang has 100 health remaining.
    Please select one of the following monsters:
    - troll - health remaining: 50
    - dragon - health remaining: 100
    - water golem - health remaining: 30
    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
    4. Heal
    Enter your selection:2
    How much melee damage do you want to do to the TROLL: 20
    You attacked the TROLL with 20 damage and it has 30 healths remaining.
    TROLL attacked Gamas Chang and did 14 damage
    
    Gamas Chang has 86 health remaining.
    Please select one of the following monsters:
    - troll - health remaining: 30
    - dragon - health remaining: 100
    - water golem - health remaining: 30
    Enter your selection (Enter 'stop' to end the game):

Details

Date:
April 23, 2022
Time:
5:00 pm - 6:00 pm
Event Categories:
,
Verified by MonsterInsights