Java代写 | COSC1284 Programming Techniques Assignment 3



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.

Question 1 (7 points)

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).

o You must implement your own sorting algorithm, don’t simply use one from the Java library or zero marks
will awarded.
 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 (12 points)

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

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



本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail:  微信:itcsdx