School of Computing & Information Technology
CSCI251/CSCI851 Advanced Programming Spring 2018
Assignment 2 (Worth 10%)
Due 11:55pm Monday 8th October 2018. (Start of Week Eleven)
This assignment is to be implemented using object oriented programming. It involves implementing a simulation of a role playing adventure. In addition to providing code you need to provide a pdf report explaining:
1. You need to submit a UML like class diagram indicating how your classes are related.
2. You need to explain the ranges of your health, skills, and abilities for your adventurers.
3. You need to explain how the results of the battles are determined. You can use diagrams to help todo this, but you don’t have to.
4. You need to describe the spells used for the spellcasters. There should be at least 3 spells of eachtype, offensive and defensive.
These are some general rules about what you should and shouldn’t do.
1. Your assignment should be sensibly organised with the same kind of expectations in this area asassignment one.
2. Your code must compile on Banshee with the compilation instructions you provide in Readme.txt. If it doesn’t you will likely receive zero for the coding part of the assignment.
3. You have to use classes, and should make use of encapsulation.
4. You should make use of inheritance and, if appropriate, polymorphism.
5. You should use appropriate operator overloading.
A role playing adventure.
You need to give consistent and appropriate definitions for a class hierarchy, in accordance with the scenario described below. You also need a simple main function to run the simulation, as well as functions in the classes defined.
The structure of the simulation is such that the party of adventurers will wander around battling monsters and collecting treasure. Encounters are random, as are the treasures found. The general overview is described below, a lot of the details are up to you. You can add additional functionality if you like.
Your code should compile on Banshee according to instructions you provide in a Readme.txt file. Given the successful compilation the program should run with the command line instruction:
./RPA n p
where n is the maximum number of hours the adventure should run for, and p is the probability of an encounter each hour. The value of n should be between 1 and 48 inclusive. The value of p should be between 5 and 95, and represents a percentage.
On running you should construct a party of adventures that consists of one of each adventurer type and 3 other randomly chosen adventurers. The adventurer types are as follows:
1. Warriors : Your basic close range fighter. They can only attack from close range and cannot cast spells.
2. Offensive Mages : Cast spells that damage opponents, potentially multiple opponents at once. They can attack weakly from a distance without magic and are poor at close range combat.
3. Defensive Mages : Cast spells that protect the party against attacks by the opponents. They can attack weakly from a distance without magic and are poor at close range combat.
4. Rogues : These adventurers prefer to attack from a distance. They can fight at close range but are not as good at it as Warriors are.
It is your responsibility to determine the relative abilities of the different types, the abilities relating to close range combat, ranged combat, offensive spellcasting, and defensive spellcasting. You should take into account both the ability to hit something and the amount of damage done in close range or ranged combat, and those abilitities should be randomly generated in some sensible range. You need to provide at least three distinct spells for each of the spellcasting types. Mages should be limited in the amount of magic they can use, and the spells should generally have different costs.
Each adventurer should have a name, randomly generated. Every person has a name and an age, these can be randomly generated, with the age being in a sensible range. Every adventurer has a current health and a maximum health. The current health should initially equal the maximum health but will go down as they get injured in battle. If the health reaches 0 that adventurer dies and won’t take part in the adventure any more. Warriors typically have more health than rogues. Rogues have more health than mages. It’s up to decide what specific values they have.
Each hour you check against the probability of an encounter. If there is no encounter you can report that and move on until there is an encounter. You can have some sense of travel each hour if you want to, but you don’t have to.
Any encounter is with a random, but sensible, number of some random monster or mix of monsters.
You need to define at least five different types of monster. They should have a mix of abilities, of the same type as the adventurers, so close range combat, ranged combat, and spellcasting abilities. You can have one of the monster types being adventurers, but you don’t have to. Monster type details can be described in a data file rather than being hard coded. There should be a text description of the monster.
The details of the battle are up to you but should be broken down into rounds where each participant, monster or adventurer, can carry out one action. That action can be a ranged attack, close range attack, move to close range attack, or cast a spell. Nobody retreats. It isn’t possible to cast a spell or use a ranged attack if somebody is attacking you at close range, you must use a close range attack.
Warriors, or Monsters who have only close range combat, will always move to close range attack. It takes them one round to get there. Each attack is targeted against a specific opponent.
After each battle, an appropriate amount of treasure should be obtained. Coins found are divided among the adventurers. If any adventurer has died, their gold divided among the survivors. There should also be a chance of finding magic potions that can increase an ability of an adventurer, such as their maximum health or damage down.
You need to report what happens in the battle and the overall outcome including detailing the treasure distribution/re-distribution.
After each battle the adventurers who are still alive are fully healed.
At the end of adventure, so at the time specified by the initial command line input, you need to report on the state of the party and list a summary of the battles and the treasure found. You should report on the adventurers who died, detailing when and what killed them.
Notes on submission
Submission is via Moodle.
Your code must compile on Banshee with the instructions you provide. If it doesn’t you will likely be given zero for the programming part of this assignment.
Please submit a single zip file with all your assignment files in it. Do not include subdirectories, that slows down marking!
1. The deadline is 11:55pm Monday 8th October 2018.
2. Late submissions will be marked with a 25% deduction for each day, including days over the weekend.
3. Submissions more than three days late will not be marked, unless an extension has been granted.
4. If you need an extension apply through SOLS, if possible before the assignment deadline.
5. Plagiarism is treated seriously. Students involved will likely receive zero.
c Luke McAven, SCIT-EIS-UOW, 2018.