C++ Question

0 comments

Individual Assignment

undefined

Due 4/14

undefined

Riders of Fortune 3.0: You will be enhancing your Riders of Fortune game to have include the following:

undefined

Create Object Classes for your Enemy

undefined

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

undefined

  • Constructor(PlayerXP): The constructor will initiate the HP of the enemy.
    • 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.

    undefined

    Player XPEnemy HP

    undefined

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

    undefined

    Raging Reapers:

    undefined

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

    undefined

    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 player’s HP.

    undefined

    Brute Trolls:

    undefined

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

    undefined

    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 player’s HP.

    undefined

    Winged Demon Knights:

    undefined

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

    undefined

    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 player’s HP.

    undefined

    Specification and Implementation Separation.

    undefined

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

    undefined

    Implement “Mystic Blacksmith” Weapon Stack.

    undefined

    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

    undefined

    When you retrieve the weapon in from the blacksmith, the modifier will be + the number of turns that weapon has been with the blacksmith.

    undefined

    Example:

    undefined

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

    undefined

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

    undefined

    Exception Handling:

    undefined

    You will add the following custom Exception:

    undefined

    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.

    undefined

    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.

    undefined

    Lake of Despair:

    undefined

    If in the menu:

    undefined

    • Travel to another space on the board
    • Dismount and explore the current space
    • Save your game

    undefined

    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.

    undefined

    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.

    undefined

    Extra Credit (10 extra points):

    undefined

    Make it a multi-player game. Allow the user to choose 2 players and then set up the interaction such that player 1 and player 2 take turns in their actions. You will have to track the location of player 1 and player 2 on the map.

    undefined

    If player 1 and player 2 land on the same spot, a battle MUST occur between the two players. The player that emerges victorious will automatically receive an XP of 20.

    About the Author

    Follow me


    {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}