You will be enhancing assignment 2 to have include the following:

Create Object Classes for your Enemy

You will create a base class called Enemy. This class will have the following configuration

  • Constructor(PlayerXP): The constructor will initiate the HP of the enemy.
Player XP Enemy HP
1 Random value (1-5)
2 Random value (1-10)
3 Random value (1-15) …etc
  • Private Member HP: Health Points. The amount will be based on the player's XP based on the given scale below:
  • getHP(): An accessor function to retrieve the enemy's HP.
  • setHP(): A mutator function to set the HP.
  • Virtual method: attack(Player obj): This method will be implemented in the derived classes and returns a damage against the player.

You will then use your base class to implement subclasses of the following enemies as derived classes:

Raging Reapers:

The Reaper class will have the following implementation of attack (Player Obj):

If the player has an alignment of "Good", the attack will be half the player's current HP. Otherwise the attack will be a random number from 1 to 25% of the players HP. Round up or down to the nearest point as necessary.

Brute Trolls:

The Troll class will have the following implementation of attack (Player Obj):

If the player has an equipped weapon of a "broad sword", Mace or Flail the attack will be equal to the player's HP. Otherwise the attack will be a random number from 1 to 25% of the players HP. Round up or down to the nearest point as necessary.

Winged Demon Knights:

The Knight class will have the following implementation of attack (Player Obj):

If the player is in one of the following spaces "Cathedral" or Well of reflection the attack will be 60% of the player's HP. Otherwise the attack will be a random number from 1 to 25% of the players HP. Round up or down to the nearest point as necessary.

Specification and Implementation Separation.

You will separate your Enemy and Player class into an implementation file (.cpp) and a specification file (.h)

Implement "Mystic Blacksmith" Weapon Stack.

When you land in a space you will have a random chance (1 in 3) to encounter a new space, "The Mystic Blacksmith". The blacksmith has a stack which will allow you to leave multiple weapons in the stack to increase their modifier value. You may choose to leave your weapon with the Blacksmith until you next encounter him

When you retrieve the weapon in from the blacksmith, the modifier will be + the number of turns that weapon has been with the blacksmith. A turn is defined by every time you roll your dice to move.

Example:

On turn 5, you left a Mace with modifier 4. During turn 10, you find the Blacksmith again and retrieve the Mace. The Mace will now have a modifier of 9 (4 plus 5 turn difference).

Use the STL's implementation of a Stack to do this.

Exception Handling:

You will add the following custom Exception:

WeaponsLimit: Limit the Weapons that can be carried to 5. If more than 5 weapons are attempted to be carried, throw the WeaponsLimit exception, which will display a message to the user that they have reached their max.

ItemLimit: Limit the Items that can be carried to 10. If more than 10 items are attempted to be carried, throw the ItemsLimit exception, which will display a message to the user that they have reached their max.

Lake of Despair:

If in the menu:

1) Travel to another space on the board
2) Dismount and explore the current space
3) Save your game

You choose #1, there will be a 1 in 4 chance you will fall into the Lake of Despair. You will create a recursive function called leaveDespair() which will roll the dice. A value of 1,2,4, and 5 will keep you in the Lake of despair and cause you to roll again. A value of 3 and 6 will let you exit.

You will create leaveDespair() to be a recursive function, such that it will call itself if you don't roll a 3 or a 6 and rolls again.

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.