!% -D ! ! Effect of gold, experience, armor ! Effect of 'talk to skeleton' ! Western wall collapsing ! ! HLA Adventure version 3.20, by Paul Allen Panks (dunric@yahoo.com). ! Ported to Inform by ~Roger Pepitone~ (rogerpepitone@yahoo.com). ! Version 0.3, July 2005. ! ! ----------------------------------------------------------------------------- Constant Story "HLA Inform"; Constant Headline "^A Classic Quest^"; Replace DrawStatusLine; Replace PrintShortName; Replace BuySub; Replace ScoreSub; Global UseColors = true; Attribute wielded; ! ----------------------------------------------------------------------------- Include "Parser"; Object LibraryMessages with before [; Answer, Ask: !print "You address ", (the) noun, ".^"; "", (CCyan) "Your voice echoes emptily."; Miscellany: if (lm_n == 39) "The game often tries to create atmosphere by mentioning items 'visible' in rooms. However, the only objects with which you can actually interact are those listed at the end, after the possible exits."; Prompt: print "^", (CRed) ">"; rtrue; ]; Include "VerbLib"; ! ----------------------------------------------------------------------------- Constant ColorBlack = 2; Constant ColorRed = 3; Constant ColorGreen = 4; Constant ColorYellow = 5; Constant ColorBlue = 6; Constant ColorMagenta = 7; Constant ColorCyan = 8; Constant ColorWhite = 9; ! [ Suppress x; ! if (x > 0) { ! print (CRed) "", (CGreen) "", (CCyan) ""; ! Pause(); ! Suppress(0); ! } ! ]; [ SetColor fg bg; if (UseColors == false) { fg = ColorWhite; bg = ColorBlack; } else if (bg == 0) bg = ColorBlue; @set_colour fg bg; ]; [ CRed str; SetColor(ColorRed); print (string) str; ]; [ CGreen str; SetColor(ColorGreen); print (string) str; ]; [ CYellow str; SetColor(ColorYellow); print (string) str; ]; ! [ CBlue str; SetColor(ColorBlue); print (string) str; ]; [ CMagenta str; SetColor(ColorMagenta); print (string) str; ]; [ CCyan str; SetColor(ColorCyan); print (string) str; ]; [ CWhite str; SetColor(ColorWhite); print (string) str; ]; [ Pause x; @read_char 1->x; if (x == 'y') UseColors = true; else if (x == 'n') UseColors = false; ]; [ PauseClear; Pause(); @erase_window 0; new_line; new_line; ]; ! ----------------------------------------------------------------------------- [ DrawStatusLine; @split_window 2; @buffer_mode 0; @set_window 1; SetColor(ColorWhite, ColorRed); spaces(HDR_SCREENWCHARS->0); print "^"; SetColor(ColorWhite, ColorMagenta); spaces(HDR_SCREENWCHARS->0); @set_window 1; SetColor(ColorWhite, ColorRed); print "HLA Adventure - Version 3.20a : hp: ", player.hit_points, " g: ", player.gold, " exp: ", player.experience, " food: ", player.food, "^"; SetColor(ColorWhite, ColorMagenta); print "http://members.tripod.com/@@126panks/hlaadv.html^"; @set_cursor 1 1; style roman; @set_window 0; font on; SetColor(ColorWhite); @buffer_mode 1; ]; [ PrintShortName o i; i = indef_mode; indef_mode = NULL; if (o ofclass HLAroom) { style roman; SetColor(ColorCyan); } PSN__(o); indef_mode = i; ]; ! ----------------------------------------------------------------------------- Constant QUESTNAME 20; Constant QUESTDESC 30; Constant QUESTREWARD 15; Class Quest with short_name "Unnamed quest", description "Undescribed quest", number -1, daemon [; if (self.condition()) { self.won(); self.completed = true; StopDaemon(self); SetColor(ColorGreen); " *** ", (string) self.short_name, " completed! ***"; } ], describe [ width nl; nl = NumberLength(self.number); spaces(width - nl); print self.number; print ". "; PadTo(self, short_name, QUESTNAME-width-2); PadTo(self, description, QUESTDESC); PadTo(self, reward, QUESTREWARD); if (self.completed) "Yes"; "No"; ], condition [; rfalse; ], ! Under what condition is quest completed won [; rfalse; ], ! Changes to make when player wins reward "???", completed false; Array printed_text buffer 128; [ PadTo obj prop spcs ct pr; @output_stream 3 printed_text; if (obj ofclass String) obj.print(); else obj.prop(); @output_stream -3; for (ct = 2 : ct < 2 + printed_text-->0 : ct++) { if (printed_text->ct ~= 13) { print (char) printed_text->ct; ++pr; } } spaces(spcs - pr); ]; [ NumberLength x rv; while (x > 0) { x = x / 10; rv++; } return rv; ]; ! ----------------------------------------------------------------------------- Class HLAroom with description [ exits; SetColor(ColorWhite); self.room_description(); print (CWhite) "Exits: ", (CYellow) "<"; if (self.list_of_exits) self.list_of_exits(); else { if (self.n_to) { exits++; print "north"; } if (self.s_to) { if (exits++) print ","; print "south"; } if (self.e_to) { if (exits++) print ","; print "east"; } if (self.w_to) { if (exits++) print ","; print "west"; } if (self.u_to) { if (exits++) print ","; print "up"; } if (self.d_to) { if (exits++) print ","; print "down"; } if (self.in_to) { if (exits++) print ","; print "in"; } if (self.out_to) { if (exits++) print ","; print "out"; } if (exits == 0) print "none"; } print ">^", (CWhite) ""; ], list_of_exits nothing, has light; Class HLAnoun with article "", invent [; SetColor(ColorWhite); ], describe [; switch (self.otype) { 1: SetColor(ColorWhite); 2: SetColor(ColorRed); 3: SetColor(ColorGreen); 4: SetColor(ColorCyan); 5: SetColor(ColorYellow); } print_ret (name) self; ], otype -1; Class Portal class HLAnoun with name 'portal', description "This is a portal between dimensions. Where it leads is unknown.", door_dir in_to, door_to "You bounce out as you try to enter. [BUG]", otype -1, has scenery door open; Class Armor class HLAnoun, with invent [; if (self has worn) switch (inventory_stage) { 1: SetColor(ColorGreen); 2: print (CMagenta) " (worn)"; } ], has clothing; Class Weapon class HLAnoun, with invent [; if (self has wielded) switch (inventory_stage) { 1: SetColor(ColorCyan); 2: print (CRed) " (wielded)"; } ], is_heavy false, weapon_strength 1; Class NPC class HLAnoun, with life [ wpn x; Attack: wpn = fists; objectloop (x in player) if (x has wielded) wpn = x; player.damage_caused = wpn.weapon_strength; if (self.hit_points == -1) self.hit_points = random(500) + 100; if (self == wannabee_64) { self.hit_points = self.hit_points + 100; player.hit_points = player.hit_points + 100; } while (player.hit_points > 0 && self.hit_points > 0) { print "Monster [", (name) self, "]: ", self.hit_points, "^"; print "Your Hit Points (HP): ", player.hit_points, "^^"; if (player.hit_points > 0 && player.hit_points < 36) { print (CYellow) "You cast heal...^", "Your wounds are healed somewhat.^"; player.hit_points = player.hit_points + random(25); ! BY WHAT AMOUNT? } !x = random (25) + 1; print (CMagenta) ">^"; objectloop (x in location && x provides is_friendly && x.is_friendly) x.help_attack(self); print (CMagenta) ">^", (CWhite) "You attack:^"; !#Ifdef DEBUG; !if (true) { ! print (CWhite) "...and kill ", (the) self, " immediately!^"; ! break; !} !#Endif; ! DEBUG x = random(25); switch (x) { 1 to 5: print (CWhite) "You missed...^"; 6 to 10: self.hit_points = self.hit_points - 5 * player.damage_caused; print (CCyan) "You struck a solid blow.^", (CWhite) ""; 11 to 12: if (wpn provides special) wpn.special(self); else if (shroud_54 has worn) shroud_54.special(self); else if (flute_56 in player) flute_56.special(self); else { self.hit_points = self.hit_points - 9 * player.damage_caused; print (CMagenta) "You hit ", (ItOrThem) self, " very hard!!^", (CWhite) ""; } default: print (CWhite) "", (The) self, " dodged your attack.^"; } ! Monster's turn print (CMagenta) ">^", (CYellow) "^"; Pause(); ! business with 'if (s=65) add(100,eax) mov (eax, mh)' ???? if (self.hit_points < 0) break; print (CMagenta) ">^", (CWhite) "The battle continues...^>^", (The) self, " attacks:^>^"; x = random(25); switch (x) { 1 to 5: print "Hooray! ", (The) self, " missed you...^"; 6 to 10: player.hit_points = player.hit_points - 26; print (CWhite) "Alas, ", (the) self, " struck a solid blow!^"; 11 to 13: self.special(); default: ! ??? mov(21,ebx); mov(i,ecx), if (lo[ebx*4]=205) then... GUESS if (shield_20 has worn) player.hit_points = player.hit_points + x; if (armor_19 has worn && x > 15) { player.hit_points = player.hit_points + 50; print (CYellow) "Your ARMOR glows and you feel warm!^"; } if (cloak_23 has worn && x > 20) { player.damage_caused++; print (CWhite) "Your CLOAK seems to confuse ", (ItOrThem) self, "!^"; } } } if (player.hit_points < 1) { deadflag = 1; rtrue; } give self ~animate; remove self; if (self == dragon_37) "", (CCyan) "The dragon has fallen!"; print (CCyan) "", (The) self, " has died.^", (CYellow) "You killed ", (ItOrThem) self, " dead.^", (CWhite) "You are rewarded with experience and gold.^"; player.hit_points = player.hit_points + 100; player.gold = player.gold + x; ! ??? player.experience = player.experience + x + 100; ! ??? for (x = child(self) : x : x = child(self)) { print (CCyan) "You found ", (name) x, " on ", (ItOrThem) self, "!^"; move x to location; } rtrue; Ask, Tell, Order: <>; ], special [; print (CCyan) "", (The) self, " hit you VERY HARD!!^", "You have sustained a vicious blow!!!^"; player.hit_points = player.hit_points - 75; ], is_friendly false, hit_points -1, has animate; Weapon fists; ! ----------------------------------------------------------------------------- [ Initialise x y; lookmode = 2; ChangePlayer(HLAPlayer); location = VILLAGE_010; objectloop (x in board_40) { x.number = ++y; StartDaemon(x); } SetColor(ColorYellow, ColorBlue); @erase_window 0; print (CYellow) "^^ PLOT INTRODUCTION^^", (CWhite) " A long time ago, when mystics, warriors and villagers ^ with smelly socks roamed the land, things were great. ^ You could slay dragons, beat up no-good thieves, and ^ even go on adventures with your drinking buddies. To ^ add to it all, there was a princess to chase after and ^ a king to swear allegiance to. All in all, life was ^ grand. ^ ^ Until one day, that is...An evil dragon has taken refuge ^ in a nearby cave. As the King's chief dragon hunter, it is ^ up to you to slay the dragon dead. Good luck! ^ ^", (CCyan) " Press any key to begin!^ (as long as it's enter :) ^"; PauseClear(); print (CWhite) "HLA Adventure^By: Paul Panks^", (CMagenta) "Version 3.20^^", (CWhite) "Fixed by Frank Kotler and Jon Ripley^^", (CMagenta) "You can learn more about this project by visiting:^", (CGreen) "http://members.tripod.com/@@126panks/hlaadv.html^^", (CWhite) "This project was ported cross-platform on May 15, 2003.^Originally written for Win32 and Linux SuSe Professional.^^", (CCyan) "Bug-fixed by: Frank Kotler, Randall Hyde, Sevag Krikorian and others.^^", (CWhite) "Ported (v. 0.2) to Inform by ~Roger Pepitone~ (rogerpepitone@@64yahoo.com), June 2005.^", (CYellow) "(Note: Some items may reset each game -- e.g. food, shroud, etc.)^^", (CGreen) "Press any key to begin playing!^(as long as it's enter :)^"; PauseClear(); return 2; ]; [ GameWon; if (random(100) < 50) print "Congratulations!!!^^", (CWhite) "The dead dragon lay at your feet. The king was right, it WAS a dragon after all (and not some guy in a clown suit). Ugh, clowns! ^^ As your accountant arrives to shake you down, you struggle to remove your sword from the beast's belly. With blood splattered everywhere, you feel relieved of your duties. You'll soon retire on a nice bounty and marry the princess after all. The king warned her about you, but alas, you've got bigger fish to fry. You have a castle to take over, a wife to knock up, and kids to blame for your drinking problem. But over a few tankards of beer, much will disappear as the room returns to spinning once more. ^^ Where is Merlin when you need his advice? (Drunk as usual, sheesh!) ^^ Guy with sword 1, evil dragon 0. Time for another drink..."; else print (CWhite) "You stand over the crumpled body of the menacing dragon, your sword bathed in blood. It is a lonely sight to behold a once great dragon reduced to so little. In a way, you feel sorry for it, if only for a moment. Besides, with the sun now over the horizon, the taverns will be opening once again. Why waste spilled dragon on the greatness that is free beer?...^^"; "", (CYellow) "^^"; ]; ! ----------------------------------------------------------------------------- Include ">HLA-objs.inf"; Include "Grammar"; ! ----------------------------------------------------------------------------- [ ListSub; SetColor(ColorRed); "You are not in the village shop!"; ]; Verb 'list' * -> List; ! ----------------------------------------------------------------------------- [ NounScope x; if (scope_stage == 1) rfalse; if (scope_stage == 2) { objectloop (x ofclass HLAnoun) PlaceInScope(x); rtrue; } "You've never heard of such an object."; ]; [ BuySub; SetColor(ColorRed); "You are not in the village shop!"; ]; [ SellSub; SetColor(ColorRed); "You are not in the village shop!"; ]; Extend 'buy' replace * scope=NounScope -> Buy; Verb 'sell' * scope=NounScope -> Sell; ! ----------------------------------------------------------------------------- [ WieldSub x; SetColor(ColorRed); if (noun notin player) "You're not holding that."; if (~~noun ofclass Weapon) "You can't wield that."; if (noun has wielded) "You're already wielding that."; objectloop (x in player && x has wielded) "You're already wielding ", (the) x, "."; ! Heavy weapons are 11-20, 67, 69, or maybe just 11-20 if (noun provides is_metal && noun.is_metal && flute_56 in player) "The magic of the flute prevents wielding much."; give noun wielded; SetColor(ColorWhite); if (AfterRoutines() == 0) "Wielded."; ]; [ UnwieldSub x; SetColor(ColorRed); if (noun == nothing) objectloop (x in player) if (x has wielded) noun = x; if (noun == nothing) "You're not wielding anything."; if (noun hasnt wielded) "You're not wielding that."; give noun ~wielded; SetColor(ColorWhite); if (AfterRoutines() == 0) "Unwielded."; ]; Verb 'wield' * held -> Wield; Verb 'unwield' * held -> Unwield * -> Unwield; ! ----------------------------------------------------------------------------- [ UseSub; SetColor(ColorRed); "You can't use that here."; ]; Verb 'use' 'play' * held -> Use; ! ----------------------------------------------------------------------------- [ TalkToSub; <>; ]; Verb 'talk' * 'to' creature -> TalkTo * 'to' noun -> TalkTo; Verb 'welcome' 't' * creature -> TalkTo * noun -> TalkTo; ! ----------------------------------------------------------------------------- [ HelpSub; print (CWhite) "HLA Adventure is a text adventure. You play by entering in commands as follows (for example):^^", (CYellow) "GET SWORD (or TAKE SWORD)^ DROP SWORD (or PUT SWORD)^ EXAMINE SWORD (or EXA SWORD)^ WIELD SWORD^ UNWIELD SWORD^ WEAR ARMOR (or DON ARMOR)^ REMOVE ARMOR (or DOFF ARMOR)^ EAT FOOD^ USE ROPE^ PLAY FLUTE^^", (CGreen) "(Press any key...)^"; Pause(); print (CYellow) "KILL PALADIN (or SLAY PALADIN)^ GO NORTH (or N)^ INVENTORY (or INV or I)^ LOOK^ SCORE (or ?)^ ENTER PORTAL^ HELP^ CREDITS^ SAVE (or STORE)^ QUIT^^", (CWhite) "Unfortunately, you can sometimes confuse the parser by accidentally entering in verbs or nouns it does not recognize. Some additional verbs you might try include:^^", (CYellow) "TALK (or 'TALK TO') and 'SAY'.^"; rtrue; ]; [ CreditsSub; print (CCyan) "HLA Adventure credits:^", (CGreen) "Sevag Krikorian, programmer, aoaprogramming^ Randy Hyde, HLA author, aoaprogramming^ Jon Ripley, programmer, www^ Frank Kotler, programmer, aoaprogramming^ Beth Stone, developer, alt.lang.asm^ Ryan McLaughlin, developer/beta-test, cousin^ ~Roger Pepitone~, programmer, Inform port^^", (CWhite) "~The Road Not Taken~ by Robert Frost^^ Two roads diverged in a yellow wood^ And sorry I could not travel both^ And be one traveler, long I stood^ And looked down one as far as I could^ To where it bent in the undergrowth^ ^ Then took the other as just as fair^ And having perhaps the better claim^ Because it was grassy and wanted wear^ Though as for that, the passing there^ Had worn them really about the same^^", (CYellow) "(Press any key...)^"; Pause(); print (CWhite) "And both that morning equally lay^ In leaves no step had trodden black^ Oh, I kept the first for another day!^ Yet, knowing how way leads onto way^ I doubted if I should ever come back^ ^ I shall be telling this with a sigh^ Somewhere ages and ages hence^ Two roads diverged in a wood^ And I took the one less traveled by^ And that has made all the difference^"; ]; Verb 'help' 'hint' 'hints' * -> Help; Verb 'credits' 'about' 'info' * -> Credits; ! ----------------------------------------------------------------------------- [ ScoreSub; if (deadflag == 0) print (CWhite) "You have the following attributes:^", (CCyan) "Hit Points: ", player.hit_points, " Experience: ", player.experience, "^Gold: ", player.gold, " Food: ", player.food, "^"; ]; Verb '?' = 'score'; ! ----------------------------------------------------------------------------- Verb 'slay' = 'attack'; Verb 'exa' = 'examine'; Extend 'put' replace * held -> Drop; Extend 'blow' replace * held -> Use; ! -----------------------------------------------------------------------------