Java
TOPIC 22 – LOOP APPLICATION: BATTLE SIMULATION

 

LESSON WORK

 

 

GROUP WORK

We will create an RPG Battle simulation that will be text-based.  We will make use of OOP concepts.

 

STEP 1

Create the following classes:

            Character class
            Weapon class

As a group, we will decide as to what attributes make up an RPG character and weapon.

Character attributes may include name, hp, hpMax, attack, speed, accuracy, activeWeapon

Weapon attributes may include name, lowDamage, highDamage, enchantmentName, enchantmentDamage.

STEP 2

In a class called BattleGame, you will add the main function.  Inside the main function, you will create two Character objects and two Weapon objects.  Will it be Harry Potter vs Voldemort or maybe Mario vs Luigi?

 

STEP 3

We will now have a game loop that runs as long as both characters are alive.

STEP 4

Inside the loop, we must simulate one round of battle.  This includes figuring out and implementing all the mechanisms that use speed, accuracy and attack as well as any other attributes that have been included.

STEP 5

The game should be almost complete.  After the loop, we need conclusion statements to be outputted based on which character is still alive.  And then that's it.


GOT EXTRA TIME?

Copy this code and simply create different characters.  Play with the values you have given to see how the results change.