Special Features - jslightham/Zork GitHub Wiki
Combat
About Combat
One of the unique features of this Zork game is the combat in the game. One may instantiate combat with an enemy that is in the room by using the command word "attack" (or any synonyms such as destroy, kill, charge, raid, strike), followed by the name of the enemy, and the weapon they would like to use. Once a player has entered combat, they may only leave by dying or killing the enemy. If the player dies, all of their items will be dropped where they died and the enemy will remain there. If the enemy dies, their predetermined loot will be added to the inventory of the room. The player may also choose to use their turn to eat instead of attacking, which will increase their health but will still count toward a turn for the player. In combat, the player and enemy both take turns attacking one another, with different possible outcomes. For both the player and the enemy, there is a 10% chance that the attacker misses, a 10% chance that the attacker gets a critical hit (1.5 times the damage, and will cause the player to bleed), and an 80% chance of a normal hit.
Bleeding
If a player is hit with a critical hit they will begin to bleed, which will cause a health loss of -2 per turn which if left untreated will kill the player. To solve bleeding, the player may use bandages that can be found throughout the map or crafted from robes.
Death
When a player dies, all items are dropped in the room they died in, their health is reset back to 100%, if they were in combat their enemies health is set back to 100%, they are placed back in the circle room, and if they were bleeding their bleeding is stopped.
Shaving Cream
Additionally, if the player chooses to attack the enemy with shaving cream, the enemy will become blinded and will not be able to attack until they unblind themself in which there is a 40% chance of this happening each turn they have.
How it works
Combat is stored in a combat member variable of the game class, which can either be null meaning no current combat or contain an instance of the combat class. The combat member variable is instantiated with a new combat, each first time that an attack is made by the player and is set back to null at the death of the player or enemy. The combat class stores the enemy and player that are in combat, and takes care of turns for the player and enemy.
Riddles
About Riddles
Riddles are an integral part to many escape rooms, so it was decided that the player should answer riddles in order to advance through the game, in order to make the game more like an escape room. When a player is in a room with a Riddler (usually described as a butler in the room description), they can choose to talk (or speak, or jabber, etc..) with them. A riddle is asked to the player. If the player is unsuccessful in answering the riddle, an unsuccessful completion message is displayed on the screen and the player can either try to answer the riddle again using "talk" or use any of the other commands. If the player successfully answers the riddle, predetermined loot will be transferred into their inventory, or transferred into the room's inventory if the player does not have enough space in their inventory. Every Riddle in the game has a loot that is integral to the player's escape from the castle so the player should put their thinking cap on, should they desire to win the game!
How it works
Riddles are stored in a Riddler object instantiated within the current room class, with specific data about the riddle (the Riddler's message, the question, the answer, and the loot) stored in the rooms.dat file for a specific room. After the riddle is successfully answered and the loot is given out, the Riddler object in the current room is set to null, in order to prevent the player from unfairly getting the same item from the Riddler. The room description is also changed when the Riddler is set to null, showing the player that they cannot interact with the riddler in that specific room anymore.