#!/usr/bin/perl ############################################################################### # chapter1.pl # ############################################################################### # Chapter 1 of Artemis Fowl # # =========================================================================== # # This is a Perl game of the first Artemis Fowl book. This first part is # # the first chapter. # # =========================================================================== # # Disclaimer: # # This game is based on the book series Artemis Fowl by Eoin Colfer. No # # profit is being made from this and all is done purely for the sake of # # entertainment. No claim is being made to the ownership of Artemis Fowl. # # The rights to this series and all fictional elements associated with it go # # to Eoin Colfer, Puffin Books, Penguin Books, Hyperion and Miramax Books. # # No infringement of any international copyright law is intended here. # # =========================================================================== # # This work is licensed under the # # Creative Commons Attribution-NonCommercial-NoDerivs2.5 License. # # To view a copy of this license, visit # # http://creativecommons.org/licenses/by-nc-nd/2.5/ # # or send a letter to Creative Commons, 543 Howard Street, # # 5th Floor, San Francisco, California, 94105, USA. # # =========================================================================== # # Version: 0.3alpha # # Released (for alpha testing): December 03, 2005 # # Programed by: Gus (gussiki@gmail.com) # # =========================================================================== # # Other notes: # # This is a very rough version of the game. Later versions will be more # # streamlined, contain other features (such as restarting, saving, loading, # # etc), and will be fully commented. # ############################################################################### use strict; use warnings; # Will be commented out in final release use Text::Wrap qw(wrap $columns $huge); $columns = 80; $huge = "wrap"; sub BEGIN { # This subroutine is only in place for the publicly-available versions # It does not appear in the original old releases print " # =========================================================================== # # Disclaimer: # # This game is based on the book series Artemis Fowl by Eoin Colfer. No # # profit is being made from this and all is done purely for the sake of # # entertainment. No claim is being made to the ownership of Artemis Fowl. # # The rights to this series and all fictional elements associated with it go # # to Eoin Colfer, Puffin Books, Penguin Books, Hyperion and Miramax Books. # # No infringement of any international copyright law is intended here. # # =========================================================================== # ===Please Hit Enter to Continue==="; ; print " # =========================================================================== # # This work is licensed under the # # Creative Commons Attribution-NonCommercial-NoDerivs2.5 License. # # # # To view a copy of this license, visit # # http://creativecommons.org/licenses/by-nc-nd/2.5/ # # or send a letter to Creative Commons, 543 Howard Street, # # 5th Floor, San Francisco, California, 94105, USA. # # =========================================================================== # ===Please Hit Enter to Begin===\n"; ; } ### The actual program starts here. ### begin: # Declare the variables here my ($output, $quit, $text, $invalid, $toothpick, $cup, $choice, $count, $restart, $pebble, $tea, $email); # Define the variables $toothpick = 0; $cup = 0; $count = 0; $pebble = 0; $tea = 0; $email = 0; $invalid = "\nSorry, but that is an invalid option.\n"; ### Subroutines ### # The "quit" subroutine sub quit { quit: $output = "\nAre you sure you want to exit? Y/N > "; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $quit = ; chomp($quit); if ($quit =~ /\b(y|yes\b)/i) { die "\nThanks for playing!\n"; } elsif ($quit =~ /\b(n|no)\b/i) { $output = "You have chosen to continue playing. ===Please Hit Enter to Continue===\n"; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); ; } else { &invalid; goto quit; } } # The "help" subroutine sub help { $output = " === Help Screen === This game is still in its early stages. Because of this, this help file is very limited. The object of this game is to complete this chapter. In this case, you have to be able to obtain a copy of the Book and successfully bring it back to Fowl Manor. In this chapter, you are playing the character of Artemis Fowl II. As such, there is no need for a \"who am I\" command. This game has deviated from the original text of the book for creativity and a greater challenge. If you get stuck, start again and record your steps. Please note that there is no way to save your progress. To obtain this screen again, type \"help\". ===Please Hit Enter to Continue==\n"; $output =~ s/( ){3,}//g; print wrap("", "", $output); ; } # The "choice" subroutine sub choice { $output = "\n\nWhat would you like to do? > "; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $choice = ; chomp($choice); } # The "gameover" subroutine sub gameover { gameover: print "\n\n===Please Hit Enter to Continue===\n"; ; $output = "GGGGGG AA MMM MMM EEEEEE OOOOOO VV VV EEEEEE RRRRR GG AA AA MM M M MM EE OO OO VV VV EE RR RR GG GG AAAAAA MM M M MM EEEEEE OO OO VV VV EEEEEE RRRRR GG GG AA AA MM M MM EE OO OO VV VV EE RR RR GGGGGG AA AA MM MM EEEEEE OOOOOO VV EEEEEE RR RR Would you like to restart? Y/N > "; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $restart = ; chomp($restart); if ($restart =~ /\b(y|yes\b)/i) { goto begin; } elsif ($restart =~ /\b(n|no)\b/i) { die "\nThanks for playing!\n"; } else { print $invalid; goto gameover; } } ### Yay! Now the game actually starts! ### &help; # Print help screen at the begining. ## Prompt 1 # Waiting for Nguyen Xuan ## saigon: $output = "You are in Ho Chi Minh City, Vietnam with your bodyguard Butler. Your mission is to obtain a copy of the Book, a \"Bible\" of the fairies. You are sitting outside a cafe, waiting for your informant Nguyen Xuan."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); if (!$toothpick && !$cup) { print "\nOn the table, there is a toothpick and a cup of tea."; } elsif (!$toothpick) { print "\nOn the table, there is a toothpick."; } elsif (!$cup) { print "\nOn the table, there is a cup of tea."; } else { print "\nThere is nothing on the table."; } until ($count == 7) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\b(examine|look|look at) tea/i) { $output = "\nIt is a cup of tea. It is most definitely not Earl Grey, but it is tolerable."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $count++; } elsif ($choice =~ /\b(examine|look|look at) toothpick\b/i) { $output = "\nA very blunt toothpick. It won't hurt anybody. But it's quite sturdy, for a toothpick."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $count++; } elsif ($choice =~ /\blook\b/i) { goto saigon; } elsif ($choice =~ /^(get|take)/i) { if ($choice =~ /toothpick$/i) { if ($toothpick == 0) { $toothpick = 1; $count++; print "\nYou take the toothpick."; } else { print "\nAre you blind? You already have the toothpick!"; $count++; } } elsif ($choice =~ /(cup|cup of tea|tea)$/i) { if ($cup == 0) { $cup = 1; $count++; print "\nYou take the tea."; } else { print "\nAre you blind? You already have the tea!"; $count++; } } else { print "\nAre you blind? That's not on the table!"; $count++; } } elsif ($choice =~ /\bwait\b/i) { $count++; } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; goto saigon; } else { print $invalid; } } ## Prompt 2 # Mysterious waiter arrives ## print "\nA waiter arrives at your table, and asks: \"More tea, sirs?\""; $count = 0; waiter: until ($count == 5) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\bwait\b/i) { $count++; } elsif ($choice =~ /\b(examine|look|look at) waiter\b/i) { $output = "\nThe waiter is wearing handmade loafers, a silk shirt, and three gold signet rings. His English has a tinge of Oxford about it, and his nails have the soft sheen of the recently manicured."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $count++; } elsif ($choice =~ /\blook\b/i) { print "\nA waiter is asking if you want more tea."; } elsif ($choice =~ /\b(ignore|ignore him|ignore the waiter|no|no tea|no thanks)/i) { $output = "\nThe waiter goes away. You get impatient and call off the mission. You go back to Fowl Manor."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); &gameover; } elsif ($choice =~ /\b(yes|yes please|tea please|more tea|more tea please)/i) { $output = "\nThe waiter goes away for a while. He comes back, and sees Butler's guns. He immediately calls the police. You and Butler are escorted to a police station."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); &gameover; } elsif ($choice =~ /\b(tell waiter to sit down|tell him to sit down|tell him to sit|tell waiter to sit|sit down|sit|say sit|say sit down)\b/i) { goto nguyen; } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; print "\nA waiter is asking if you want more tea."; } else { print $invalid; } } $output = "\nThe waiter goes away. You get impatient and call off the mission. You go back to Fowl Manor."; $output =~ s/( ){3,}//g; print wrap("", "", $output); &gameover; ## Prompt 3 # Nguyen Xuan gives you a Polaroid ## nguyen: $output = "\nThe waiter turns to Butler. He opens his mouth to speak, but you cut him off. You tell him how pathetic his disguise, and exactly how easily you penetrated it. You also fill him in on the weapons status, listing a large number of weapons that Butler is carrying, and also state how dangerous Butler is, even without his weapons. You ask Nguyen Xuan what information he has for you, and whether he has proof. Nguyen pulls out a Polaroid from his wallet and pushes it across the table."; $output =~ s/( ){3,}//g; print wrap("", "", $output); $count = 0; until ($count == 5) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\b(examine|look|look at) polaroid\b/i) { goto explain; } elsif ($choice =~ /\bwait\b/i) { $count++; } elsif ($choice =~ /\blook\b/i) { print "\nThe Polaroid is on the table. Nguyen Xuan looks at you nervously."; } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; print "\nThe Polaroid is on the table. Nguyen Xuan looks at you nervously."; } elsif ($choice =~ /\bexamine /i) { print "\nYou can't examine that!"; $count++; } elsif ($choice =~ /\bexamine\b/i) { print "\nExamine what?"; $count++; } else { print $invalid; } } print "\nNguyen Xuan gets fed up. He picks up the Polaroid and leaves."; &gameover; ## Prompt 4 # What are we waiting for? He tries to run ## explain: $output = "\nIt's a Polaroid. It shows a hand in the midst of shadows. A green hand. Of course, it could be fake. Nguyen explains. He says that the woman is a drunken healer, who works for wine. You notice a lot of sweat on Nguyen's forehead, even though he is used to the climate. He looks around nervously, almost as if he wants to run away."; $output =~ s/( ){3,}//g; print wrap("", "", $output); $count = 0; until ($count == 3) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\bwait\b/i) { $count++; } elsif ($choice =~ /\blook\b/i) { $output = "\nNguyen Xuan is sweating, even though he is used to the climate. He looks around nervously."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; $output = "\nNguyen Xuan is sweating, even though he is used to the climate. He looks around nervously."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } else { print $invalid; } } ## Prompt 5 # H runs away ## print "\nSuddenly, Nguyen Xuan gets out of his chair and runs away."; $count = 0; until ($count == 8) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\bwait\b/i) { $output = "\nNguyen Xuan is gone. You do not know where the healer is. The mission is now worthless. You leave for the airport."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); &gameover; } elsif ($choice =~ /\blook\b/i) { print "\nNguyen Xuan is running away. You may still be able to stop him."; } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; print "\nNguyen Xuan is running away. You may still be able to stop him."; } elsif ($choice =~ /(stop|halt|stop him|stop him butler|butler|come back|stay)/i) { last; # Break out of the loop } else { $output = "\nNguyen Xuan is gone. You do not know where the healer is. The mission is now worthless. You leave for the airport."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); &gameover; } } ## Prompt 6 # Butler stops him and we go into the Jeep ## $output = "\nQuick as a flash, Butler lashes out and pulls in the protesting informant. \"Our business is not concluded yet, Mister Xuan,\" you say. \"You will now take us to the healer.\" The three of you go to the rented vehicle and go to Tu Do Street, where the healer lives.\n"; $output =~ s/( ){3,}//g; print wrap("", "", $output); if (!$pebble) { $output = "\nEventually the streets grow too narrow for the car. Your party gets out and decide to walk the rest of the way. There is a pebble on the ground. You start to get thirsty from the heat."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($pebble) { $output = "\nEventually the streets grow too narrow for the car. Your party gets out and decide to walk the rest of the way. You start to get thirsty from the heat."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } $count = 0; until ($count == 10) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\bwait\b/i) { $output = "\nYou stop walking and stand still in the alley. \nButler calls to you: \"Master Artemis, are you coming?\""; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $count++; } elsif ($choice =~ /(walk|keep walking|follow)/) { print "\nYou continue walking.\n"; if ($count == 3) { $output = "\nA pickpocket tries to steal Butler's wallet. Butler breaks the pickpocket's fingers without looking.\n"; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($count == 5) { $output = "\nNguyen Xuan looks around, as if he wants to run away. One glance from Butler makes him cower and abandon the idea.\n"; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($count == 8) { print "\nYou can see a fire escape at the end of the alley."; } if (!$pebble && !$tea) { $output = "\nThere is a pebble on the ground. You start to get thirsty from the heat."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($pebble && $tea) { } elsif (!$pebble && $tea) { print "\nThere is a pebble on the ground."; } elsif ($pebble && !$tea) { print "\nYou start to get thirsty from the heat."; } $count++; } elsif ($choice =~ /\b(examine|look|look at) pebble\b/i) { $output = "\nIt's a pebble. Small and hard. Might be a good way to get somebody's attention..."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $count++; } elsif ($choice =~ /\blook\b/i) { if (!$pebble && !$tea) { $output = "\nYou are in a narrow, but crowded alley. There is a pebble on the ground. You start to get thirsty from the heat."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($pebble && $tea) { print "\nYou are in a narrow, but crowded alley."; } elsif (!$pebble && $tea) { $output = "\nYou are in a narrow, but crowded alley. There is a pebble on the ground."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($pebble && !$tea) { $output = "\nYou are in a narrow, but crowded alley. You start to get thirsty from the heat."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } } elsif ($choice =~ /\bexamine /i) { print "\nYou can't examine that!"; $count++; } elsif ($choice =~ /\bexamine\b/i) { print "\nExamine what?"; $count++; } elsif ($choice =~ /\b(get|take) pebble\b/i) { print "\nYou take the pebble."; $pebble = 1; $count++; } elsif ($choice =~ /\bdrink tea\b/i) { if (!$cup) { print "\nYou don't have any tea to drink, but you wish you did."; } elsif ($cup) { $output = "\nYou are very thirsty, and don't care if it's not Earl Grey. You drink the tea, and your thirst is quenched."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $tea = 1; } } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; if (!$pebble) { $output = "\nYou are in a narrow, but crowded alley. There is a pebble on the ground. You start to get thirsty from the heat."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($pebble) { $output = "\nYou are in a narrow, but crowded alley. You start to get thirsty from the heat."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } } else { print $invalid; } } if (!$tea) { $output = "\nBy now, you are severly dehydrated. The heat beats down on you, and you feel faint. \"Butler,\" you call out weakly. Butler identifies your condition. He gives you his water bottle, and rushes you to the hospital."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); &gameover; } ## Prompt 7 # How to attract the healer's attention? ## $output = "\nNguyen points to the shadows under a fire escape. \"She's in there. She doesn't come out,\" he says."; $output =~ s/( ){3,}//g; print wrap("", "", $output); $count = 0; until ($count == 5) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\bwait\b/i) { $count++; } elsif ($choice =~ /\b(examine|look|look at) pebble\b/i) { $output = "\nIt's a pebble. Small and hard. Might be a good way to get somebody's attention..."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $count++; } elsif ($choice =~ /\blook\b/i) { $output = "\nThe healer is somewhere under the fire escape. You need to get her attention..."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; $output = "\nThe helear is somewhere under the fire escape. You need to get her attention..."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($choice =~ /\b(get healer's attention|get attention)\b/i) { print "\nHow are you going to do that?"; $count++; } elsif ($choice =~ /\buse pebble\b/i) { if (!$pebble) { print "\nYou do not have a pebble!"; } elsif ($pebble) { print "\nHow are you going to use it?"; } $count++; } elsif ($choice =~ /\b(throw pebble|toss pebble)\b/i) { if (!$pebble) { print "\nYou do not have a pebble!"; } elsif ($pebble) { goto sprite; } } else { print $invalid; } } $output = "\nNothing happens. Nguyen Xuan quietly walks away. You get impatient and call off the mission. You go back to Fowl Manor."; $output =~ s/( ){3,}//g; print wrap("", "", $output); &gameover; ## Prompt 8 # Ah! Toss a pebble! How to see? ## sprite: $output = "\nYou toss the pebble into the shadows. It makes a loud clanging noise. A voice drawls out: \"Wine.\" It's too dark to see anything."; $output =~ s/( ){3,}//g; print wrap("", "", $output); $count = 0; until ($count == 5) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\bwait\b/i) { $count++; } elsif ($choice =~ /\b(examine|look|look at) darkness\b/i) { print "\nIt's darkness. There's no light. Never seen darkness before?"; $count++; } elsif ($choice =~ /\blook\b/i) { $output = "\nThe helear is somewhere under the fire escape. It's too dark to see her. Some night-vision goggles would come in handy..."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; $output = "\nThe helear is somewhere under the fire escape. It's too dark to see her. Some night-vision goggles would come in handy..."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($choice =~ /\b(butler|((night-vision|night vision) goggles|goggles)|hand me the ((night-vision|night vision) goggles|goggles)|hand me the ((night-vision|night vision) goggles|goggles) butler|butler hand me the ((night-vision|night vision) goggles|goggles))\b/i) { goto goggles; } else { print $invalid; } } $output = "\nNothing happens. Nguyen Xuan quietly walks away. You get impatient and call off the mission. You go back to Fowl Manor."; $output =~ s/( ){3,}//g; print wrap("", "", $output); &gameover; ## Prompt 9 # Now we need to offer the ho- wine ## goggles: $output = "\nButler hands a pair of night-vision goggles to you. You put them on and set into the shadows. After adjusting the goggles, you see a small figure wrapped in a filthy shawl. Her skin is green, like everything else you see. \"Wine first, then talk,\" the healer mutters to you."; $output =~ s/( ){3,}//g; print wrap("", "", $output); $count = 0; until ($count == 5) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\bwait\b/i) { $count++; } elsif ($choice =~ /\b(examine|look|look at) healerb/i) { $output = "\nIt's a healer. She's abnormally small. And she's demanding wine from you."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $count++; } elsif ($choice =~ /\blook\b/i) { print "\nThe healer wants wine from you."; } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; print "\nThe healer wants wine from you."; } elsif ($choice =~ /\b(butler|wine|hand me the wine|hand me the wine butler|butler hand me the wine)\b/i) { goto wine; } else { print $invalid; } } $output = "\nNothing happens. Nguyen Xuan quietly walks away. You get impatient and call off the mission. You go back to Fowl Manor."; $output =~ s/( ){3,}//g; print wrap("", "", $output); &gameover; ## Prompt 10 # Butler gives you the hol- whiskey ## wine: print "\nButler hands you a bottle of a half pint of Irish whiskey."; $count = 0; until ($count == 5) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\bwait\b/i) { $count++; } elsif ($choice =~ /\b(examine|look|look at) (wine|whiskey|irish whiskey)\b/i) { print "\nIt's a pint of Irish whiskey. Really."; $count++; } elsif ($choice =~ /\b(examine|look|look at) holy water\b/i) { print "\nWhat holy water?"; $count++; } elsif ($choice =~ /\b(examine|look|look at) healer\b/i) { $output = "\nIt's a healer. She's abnormally small. And she's demanding wine from you."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $count++; } elsif ($choice =~ /\blook\b/i) { $output = "\nThe healer wants wine from you. You have half a pint of Irish whiskey in your hands."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; $output = "\nThe healer wants wine from you. You have half a pint of Irish whiskey in your hands."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($choice =~ /\b(offer|dangle|show|give|wave) (wine|whiskey|bottle|holy water)\b/i) { goto offerwine; } else { print $invalid; } } $output = "\nNothing happens. Nguyen Xuan quietly walks away. You get impatient and call off the mission. You go back to Fowl Manor."; $output =~ s/( ){3,}//g; print wrap("", "", $output); &gameover; ## Prompt 11 # Remove your goggles quick! ## offerwine: $output = "\nYou hold the bottle just beyond the shadows, and tell the healer to get it."; $output =~ s/( ){3,}//g; print wrap("", "", $output); $count = 0; until ($count == 8) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\bwait\b/i) { $output = "\nThe healer's hand darts out and takes the whiskey. You have no idea whether the healer is a fairy or not, and you have just blown your chances. Fed up, you go back to the airport."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); &gameover; } elsif ($choice =~ /\blook\b/i) { print "\nYou're offering the wine to the healer."; } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; print "\nYou're offering the wine to the healer."; } elsif ($choice =~ /\b(remove|take off) ((night-vision|night vision) goggles|goggles)\b/i) { last; # Break out of loop } else { $output = "\nThe healer's hand darts out and takes the whiskey. You have no idea whether the healer is a fairy or not, and you have just blown your chances. Fed up, you go back to the airport."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); &gameover; } } ## Prompt 12 # Pay Nguyen. He deserves it ## $output = "\nYou quickly whip your goggles off. Just in time to see the healer's green hand grab the whiskey. You tell Butler to pay Nguyen. After ensuring that Nguyen will remain silent, Butler hands over \$20,000 USD in cash. Nguyen skips away happily. You turn to the healer. She asks you what you want healed, and you subtly turn the conversation to books. Her Book, in fact, for she is a fairy. A sprite, to be specific. \"You know about the Book? Then you know about my magic,\" the fairy says.\n"; $output =~ s/( ){3,}//g; print wrap("", "", $output); $count = 0; until ($count == 5) { if ($count == 0) { print "\"Do you doubt me? Just let me enslave your will. It will be trivial.\""; } elsif ($count == 1) { $output = "\nThe fairy continues. \"Do you want to become pig droppings? I can do it easily...\""; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($count == 2) { $output = "\nYou wonder when the fairy will stop. \"Listen to me!\" she says. \"You do not know what you are dealing with, human!\""; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($count == 3) { print "\n\"You are a fool,\" the healer says, \"to meddle with magic.\""; } elsif ($count == 4) { $output = "\n\"I will kill you!\" the fairy roars, spraying her alcohol-laced spit everywhere."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\bwait\b/i) { $count++; } elsif ($choice =~ /\blook\b/i) { $count++ } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; } elsif ($choice =~ /\b(leave|walk away)\b/i) { $output = "\nYou are easily threatened by the healer, and run away. You go back to Fowl Manor."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); &gameover; } else { print $invalid; } } ## Prompt 13 # Let's make a deal! ## $output = "\nYou know the threats are empty. You tell the sprite how pathetic she is, how the alcohol is killing her. She has no magic. You offer to save her, but she has to give you the Book. Almost casually, you mention how the healer has just drank half a pint of holy water. You offer her a chance to live, and a way to regain her magic. But only if she lends you the book for thirty minutes. You will counteract the holy water with some water drawn from the hill of Tara. You will then give her a shot of human technology. A \"virus\" which will flush out all the alcohol from the sprite, and restore her health. The sprite accepts."; $output =~ s/( ){3,}//g; print wrap("", "", $output); $count = 0; until ($count == 3) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\bwait\b/i) { $count++; } elsif ($choice =~ /\b(examine|look|look at) (healer|sprite|fairy)\b/i) { $output = "\nIt's a healer. She's abnormally small. And she's waiting for you to counteract the holy water you tricked her into drinking."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $count++; } elsif ($choice =~ /\blook\b/i) { $output = "\nThe healer has made a deal with you. You'll counteract the holy water you gave her, she'll show you the Book, and you'll return her magic."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; $output = "\nThe healer has made a deal with you. You'll counteract the holy water you gave her, she'll show you the Book, and you'll return her magic."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($choice =~ /\b((give|offer) (vial|antidote|tara water|injection)|heal (fairy|sprite|healer)|butler|butler the (vial|antidote|tara water|injection)|(vial|antidote|tara water|injection)|the (vial|antidote|tara water|injection) butler)\b/i) { goto vial; } else { print $invalid; } } $output = "\nToo late. The sprite falls over. The pain from the holy water must have been too much. Your chance of getting the Book has been blown. You go back to the airport."; $output =~ s/( ){3,}//g; print wrap("", "", $output); &gameover; ## Prompt 14 # Don't steal the Book! ## vial: $output = "\nButler loads the vial into a syringe gun. He shoots it into the sprite's arm. The sprite is instantly relieved. After searching through her robes, she holds out a gold book the size of a matchbox. She comments how it's written in the old tongue, and how you won't understand it."; $output =~ s/( ){3,}//g; print wrap("", "", $output); $count = 0; until ($count == 3) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\bwait\b/i) { $count++; } elsif ($choice =~ /\b(examine|look|look at) (healer|sprite|fairy)\b/i) { $output = "\nIt's a healer. She's abnormally small. And she's holding out the Book for you to take."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $count++; } elsif ($choice =~ /\blook\b/i) { print "\nThe sprite is holding out the Book for you to take."; } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; print "\nThe sprite is holding out the Book for you to take."; } elsif ($choice =~ /\b(examine|look|look at) book\b/i) { $output = "\nIt's gold. It's small. It's in the sprite's hand. And time is running out."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $count++; } elsif ($choice =~ /\btake book\b/i) { goto camera; } else { print $invalid; } } $output = "\n\"You're not going to take it?\" the sprite asks. \"Very well.\" She puts her Book away. Your chance is gone."; $output =~ s/( ){3,}//g; print wrap("", "", $output); &gameover; ## Prompt 15 # You can't take the Book away, so you'll have to improvise ## camera: print "\nYou take the Book and hand it to Butler."; $count = 0; until ($count == 20) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\bwait\b/i) { $count++; } elsif ($choice =~ /\b(examine|look|look at) book\b/i) { $output = "\nIt's gold. It's small. It's in Butler's hand. And time is running out."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $count++; } elsif ($choice =~ /\blook\b/i) { print "\nButler (looking somewhat confused) is holding the Book."; } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; print "\nButler (looking somewhat confused) is holding the Book."; } elsif ($choice =~ /\b(photograph book|take pictures of book|butler)\b/i) { goto takepictures; } elsif ($choice =~ /\b(leave|walk away)\b/i) { $output = "\nUnfortunately, you are not allowed to do that. You were only allowed to look at the Book for half an hour. The Book combusts, burning Butler's hand. You have failed to obtain a copy of the Book."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); &gameover; } else { print $invalid; } } $output = "\n\"Time's up,\" the sprite says. You reluctantly hand the Book back to her. Your chance is gone."; $output =~ s/( ){3,}//g; print wrap("", "", $output); &gameover; ## Prompt 16 # Oh no, the camera doesn't work! ## takepictures: $output = "\n\"Sir,\" Butler says to you. \"There's a problem with the camera. I've just installed new batteries, and the camera needs to be reset. I need something small, something thin to press the button. A pen, or a pencil.\""; $output =~ s/( ){3,}//g; print wrap("", "", $output); until ($count == 20) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\bwait\b/i) { $count++; } elsif ($choice =~ /\b(examine|look|look at) book\b/i) { $output = "\nIt's gold. It's small. It's in Butler's hand. And time is running out."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $count++; } elsif ($choice =~ /\b(examine|look|look at) camera\b/i) { print "\nIt needs to be reset. The button cannot be pressed without a pen."; $count++; } elsif ($choice =~ /\blook\b/i) { $output = "\nButler (looking somewhat confused) is holding the Book. He needs something small and thin to reset the camera."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; $output = "\nButler (looking somewhat confused) is holding the Book. He needs something small and thin to reset the camera."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($choice =~ /\buse pen\b/i) { $output = "\nThat would be great, if you had a pen. Do you have a pen? No? I didn't think so."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $count++; } elsif ($choice =~ /\b((use|offer|give|produce|reveal|show) toothpick|(use|offer|give|produce|reveal|show) toothpick to butler)\b/i) { if (!$toothpick) { print "\nThat would be a great idea, if you had a toothpick."; $count++; } elsif ($toothpick) { goto toothpick; } } elsif ($choice =~ /\b(leave|walk away)\b/i) { $output = "\nUnfortunately, you are not allowed to do that. You were only allowed to look at the Book for half an hour. The Book combusts, burning Butler's hand. You have failed to obtain a copy of the Book."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); &gameover; } else { print $invalid; } } $output = "\n\"Time's up,\" the sprite says. You reluctantly hand the Book back to her. Your chance is gone."; $output =~ s/( ){3,}//g; print wrap("", "", $output); &gameover; ## Prompt 17 # It works now ## toothpick: $output = "\nYou give the toothpick to Butler. He resets the camera. Butler photographs each page of the Book. The entire contents of the Book is now stored on a chip."; $output =~ s/( ){3,}//g; print wrap("", "", $output); until ($count == 20) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\bwait\b/i) { $count++; } elsif ($choice =~ /\b(examine|look|look at) book\b/i) { $output = "\nIt's gold. It's small. It's in Butler's hand. You have its contents on the camera chip. And time is running out."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); $count++; } elsif ($choice =~ /\blook\b/i) { $output = "\nButler (looking somewhat confused) is holding the Book. He has just taken pictures of every page of the Book."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; $output = "\nButler (looking somewhat confused) is holding the Book. He has just taken pictures of every page of the Book."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($choice =~ /\b(leave|walk away)\b/i) { $output = "\nUnfortunately, you are not allowed to do that. You were only allowed to look at the Book for half an hour. The Book combusts, burning Butler's hand. You have failed to obtain a copy of the Book."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); &gameover; } elsif ($choice =~ /\b((email|upload|send|backup|load|save) (book|pictures|chip|photos|photographs)|server|fowl manor|(email|upload|send|backup|load|save) (book|pictures|chip|photos|photographs) to (server|fowl manor))\b/i) { $email = 1; last; # Break out of loop } elsif ($choice =~ /\breturn book\b/i) { last; # Break out of loop } else { print $invalid; } } ## Prompt 18 # Did you email the files? ## if ($email) { $output = "\nIn case airport security erases the Book, you instruct Butler to use your mobile phone to email the files to Fowl Manor. Butler carries out your instructions, and hands the Book back to the sprite.\n"; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif (!$email) { print "\nButler returns the Book back to the sprite.\n"; } $output = "\nThe sprite asks for the second potion, the one which would restore her magic. Butler loads the second vial, and shoots it into the sprite's carotid artery. The sprite collapses. You decide to leave before the sprite's body expels all the alcohol in her system."; $output =~ s/( ){3,}//g; print wrap("", "", $output); $count = 0; until ($count == 3) { &choice; if ($choice =~ /\bhelp\b/i) { &help; } elsif ($choice =~ /\bwait\b/i) { $count++; } elsif ($choice =~ /\blook\b/i) { $output = "\nThe sprite is on the ground. You should leave before all the alcohol is violently expelled from the sprite."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($choice =~ /\b(quit|exit)\b/i) { &quit; $output = "\nThe sprite is on the ground. You should leave before all the alcohol is violently expelled from the sprite."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); } elsif ($choice =~ /\b(leave|walk away|go to the airport)\b/i) { last; # Break out of loop } else { print $invalid; } } $output = "\nYou go to the airport. On the way to the airport, you explain to Butler how it was necessary to give the second injection to the sprite. You had mixed an amnesiac into it, just in case the sprite plans to alert the fairies."; $output =~ s/( ){3,}//g; print wrap("", "", $output); if (!$email) { $output = "\nYou pass through the airport. You decide to start decoding the Book, and retrieve the camera chip. Unfortunately, the data has been wiped by the airport security. All your hard work and planning, foiled by a few metal detectors."; $output =~ s/( ){3,}//g; $output =~ s/\t//g; print wrap("", "", $output); &gameover; } ## Final Screen ## $output = "\nYou have succeded! You are now in Fowl Manor, and a copy of the Book is sitting on the hard drive of a computer. ===Please Hit Enter to Continue===\n"; $output =~ s/( ){3,}//g; print wrap("", "", $output); ; $output = "\nCongratulations. You have beaten the level. The adventure continues... ===Please Hit Enter to Exit===\n"; $output =~ s/( ){3,}//g; print wrap("", "", $output); ;