American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

7 PM – Intro To Java – Gamas

April 7, 2022 @ 7:00 pm - 8:00 pm

Today We Do
  1. We continued with Monster Inheritance application
  2. We added Play Game menu
  3. We added code to get Monster from the monsterMap.
Homework
  1. Add code to handle Melee Attack. In the Melee attack, the player will attack the selected monster which will reduce the selected monster.health. Use monster.doDamage(int damage) method to reduce monster.health. This is very similar to BankAccount.withdrawal. And the monster will reduce playerHealth. The playerHealth will be reduce according randomly between 0 to monster.maxDamage.
  2. Also add code to handle Magic Attack.
  3. Look at below
  4. 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
    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 4 damage
    
    Gamas has 96 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):dragon
    
    What do you want to do with the dragon:
    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 dragon:
    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 DRAGON with 10 attack. The DRAGON has 90 health remaining.
    DRAGON attacked Gamas and did 10 damage.
    
    Gamas has 86 health remaining.
    Please select one of the following monsters:
    - troll - health remaining: 10
    - dragon - health remaining: 90
    - water golem - health remaining: 30
    Enter your selection (Enter 'stop' to end the game):
    

     

Details

Date:
April 7, 2022
Time:
7:00 pm - 8:00 pm
Event Categories:
,
Verified by MonsterInsights