Program 5 Dordal Due: April 16, 2004 Last-minute fix: StoneRoom::on_entry() was mistakenly called onentry(), which meant that it did not get invoked. You are to modify the game program presented in class, adding the following features: 1. Add a second Lantern, of class Lantern. The second Lantern can have the same name, LANTERN, or a new name, FLASHLIGHT. Try to implement this in such a way that when the user invokes the command LIGHT FLASHLIGHT (or LIGHT LANTERN) for the second Lantern, you look on the Inventory for the named object and light() it. Note that you will need to downcast from Carryable* to Lantern* to do this. Similarly, in the dark rooms, you will need to check whether either Lantern is on Inventory. An even better approach is to see if there is anything on Inventory that is of type Lantern. 2. If you eat the chocolate, it should go away. Optional: the chocolate should last 2-3 bites. Keep the number of bites left as an attribute of the chocolate itself. 3. Introduce a puzzle room where you cannot *leave* the room until some action occurs. Possibilities are: You have to FIGHT the dragon (with a SWORD?) You have to GIVE the dragon a PRESENT or COOKIE. There is a cave-in and you have to DIG (with SHOVEL?) 4. Introduce a class DarkRoom (intended to apply to the cave area, but possibly to the Hollow Tree as well). In a DarkRoom, the following rules apply: 1. You cannot go from one DarkRoom to another without a light. 2. On entry to a DarkRoom, if you don't have a light you are warned to get one! 3. If you don't *leave* the DarkRoom by the second turn, a "grue" will get you and you die. DarkRoom should keep a counter of the number of times DarkRoom::response() is called, reset to 0 by DarkRoom::onentry(). 4. If you do have a light with you, DarkRoom behaves exactly the same as Room. 5. Note that it is possible to DROP the light, in which case the Dark rules again should be in force. Make all cave passages DarkRooms. (You may need to add some extra cave.) Note that this involves changing the parent structure: the existing StoneRoom will now have DarkRoom rather than Room as a parent. Note also that DarkRoom may have its behavior overridden by, say, StoneRoom; this is probably not a serious difficulty in practice. 5. You are to add one additional puzzle of your own. Your puzzle should, at a minimum, involve the following: one new CarryObj one new verb one new derived room class, with special behavior for at least one verb (new or existing). some kind of state change to the room or to an object (like the stone being moved or valve being turned) You will be graded in part on the inventiveness of your puzzle. Here are a few possibilities. UNLOCK CHEST with a KEY found elsewhere; once the chest is unlocked, something should be inside. Cross a rickety two-move bridge over a bottomless pit; if you carry too much the bridge will break; you can only carry two things at a time. You need to CAST SPELL in the WizardsChamber, but in order to do this you must first find in the game a BELL, BOOK, and CANDLE. (And maybe LIGHT CANDLE? Or maybe, in the simpler direction, just find NEWTEYE and BATWING. If you try to CAST SPELL and don't have the ingredients, the game should tell you what you're missing.) Be sure all verbs you introduce are handled at some primitive level by Room::response(), so that they're not completely unrecognized even if you're not in the "right" room.