Overview

GamingMax Corporation is a start-up gaming business and is developing its first game with a working title, called 'Battle Simulation'. The game has a basic AI ogre characters, however you have recently been hired to finish their game. Your task is to implement basic AI hero characters with additional characteristics, provided to you in our skeleton code for a simple command line application.

The skeleton code is made up of four classes:

  • BattleSimulationApp: The driver class of the application.
  • BattleSimulationEngine: The class that manages all game assets and runs the simulation.
  • Entity: The super class for all AI characters.
  • Ogre: The sub class that the specific characteristics of the Ogre.

In addition to the four classes, further classes will be needed to support the game.

Currently, the game is in working order and is in the following state:

  • The game starts with a splash screen.
  • Creates four ogres and adds them to the entity array.
  • The ogres will fight each other because they are alone.
  • Once the ogres are dead, the game will end with the game over screen.

Your task, is to add an interaction menu, create, add and sort hero characters to the simulation, allow the hero and ogre characters to fight within the simulation, either resulting in game over or win and finally that the hero can use items, such as swords, armour and potions.

IMPORTANT

  • There is no GUI implemented.
  • Collection classes such as, HashMaps and collection types are not allowed in this assignment.
  • ArrayList are optional, however, data structures that have been already coded into the skeleton code, must remain as is, i.e. the entries array, must stay as an array.
  • Other classes such as the StringBuilder class are allowed.

Question 1

Implement the method void menu() within the BattleSimulationEngine in the skeleton code, which allows the player to do the following action:

  • Add hero character to the existing entity array.
  • Sort hero characters by their health (see question 2 for more detail about health).
    • You must implement your own sorting algorithm.
  • Print the hero name and health.
  • Run the simulation.
  • Exit simulation.

The menu method is the only method that can create and use the scanner class, therefore the scanner should be local to the menu method.

Question 2

Create a Hero class that extends the Entity class, furthermore you must override the methods that the Entity class is enforcing. These enforcing methods include the following:

  • void attack();
  • void add(Entity[] entities);

Additionally, hero characters' health must be set between a random value of 150 and 500 and therefore underpowered compared to the ogres which have a health of 1000. This health value is set before the simulation starts.

The hero characters must be set to the hero team.

The DAMAGE variable is inherited from the Entity class, thus both the Hero and Ogre class can attack each with the same amount of damage.

The maximum number of hero characters that be created is four and need to be added to the entity array.

Hero characters need to be able to attack and be hurt by the ogres.

After which, the simulation should have the eight entities fighting each other, please note that the hero characters should not attack another hero character, only the ogre characters.

Once the hero characters have zero or less, then that character is dead and set null, no longer able to perform any more actions.

Hint: It is likely that your heroes will be defeated at this point.

Question 3

Create one super class called Item and three additional sub classes called Sword, Armour and Potion.

The Item class must have a name that shared with other sub classes, i.e. to obtain the name of a sword, the name must be located within the Item class, not the Sword class.

Each of the subclasses must do the following:

  • Sword class:
    • Increases the damage output by 200%.
    • Limited to 5 hits, then damage reduces back to 100%.
  • Armour class:
    • The received damage is reduced to 125.
    • Only works 50% of the time, other 50% the character receives the full 100% damage.
  • Potion class
    • Increase the health back to 500.
    • Can be used only when the health is less than 200.
    • Can be only used once.

Apply these subclasses to the hero class and to be use in the simulation.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.