/* * Copyright (c) 2021 Ross Cunniff * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /*** VERBS ***/ VerbClass sign {...} VerbClass play {...} VerbClass rname {...} VerbClass shell {...} VerbClass eat {...} VerbClass swim {...} VerbClass feed {...} VerbClass score {...} VerbClass dig {...} VerbClass cut {...} VerbClass plug {...} VerbClass tie {...} VerbClass untie {...} VerbClass wipe {...} VerbClass shake {...} VerbClass xyzzy {...} VerbClass jamb {...} VerbClass echo {...} VerbClass abracadabra {...} ... sign { preact = Preact ... } ... play { preact = Preact ... } ... eat { preact = Preact ... } ... cut { preact = Preact ... } ... feed { preact = Preact ... } ... plug { preact = Preact ... } ... untie { preact = Preact ... } ... wipe { preact = Preact ... } ... shake { preact = Preact ... } ... jamb { preact = Preact ... } ... tie { preact = Preact ... } ... score { preact = proc() {Expect(NO_OBJ, NO_OBJ);} ... } ... dig { preact = proc() {Expect(NO_OBJ, NO_OBJ);} ... } ... swim { preact = proc() {Expect(NO_OBJ, NO_OBJ);} ... } Synonym plugh(xyzzy); Synonym clean(wipe); Synonym shut(close); Synonym peruse(V_read); Synonym chuck(V_throw); Synonym hurl(V_throw); Synonym toss(V_throw); Synonym heave(V_throw); Synonym discard(drop); Synonym excavate(dig); Synonym grab(take); Synonym push(touch); Synonym pet(touch); Synonym devour(eat); Synonym consume(eat); Synonym wade(swim); Synonym ford(swim); Synonym shazam(abracadabra); Synonym hocus(abracadabra); Synonym abra(abracadabra); Synonym end(quit); Synonym bye(quit); Synonym leave(exit); Synonym climb(up); /*** VERB ROUTINES ***/ ... plug { action = proc() { if ($ME.loc == irm13) { if (cotton.loc == $ME) { "You stick the cotton into the rhino's ears.\n"; cotton.move($ALL); rhino.earplg = 1; ExitPhase(PHX_ACTOR); } } "I don't quite understand what you mean.\n"; } } ... dig { action = proc() { if (shovel.loc != $ME) { "You don't have something to dig with.\n"; ExitPhase(PHX_ACTOR); } if ($ME.loc == irm9) { if (!cotton.tookbt) { cotton.tookbt = 1; "You find some cotton buried in the sand.\n"; cotton.move(irm9); return; } "OK\n"; return; } if ($ME.loc == prm17) { if (!pendant.dugbt) { pendant.dugbt = 1; "You find an ancient pendant buried in the grave.\n"; pendant.move(prm17); return; } "You dig some but you don't find anything.\n"; return; } "The ground is too hard to dig into.\n"; } } proc cantdo() { "I don't believe I can do that.\n"; } ... sign { action = cantdo } ... play { action = cantdo } proc arolg() { "It will probably cost you an arm or a leg to feed that.\n"; ExitPhase(PHX_ACTOR); } ... feed { action = proc() { if (($ME.loc == irm8) || ($ME.loc == irm9)) { if (Dobj == crocodiles) { arolg(); } } if (($ME.loc == prm19) && (Dobj == bear)) { if (!bear.hitbr) { arolg(); } } if (($ME.loc == prm6) && (Dobj == smilodon)) { if (!smilodon.stond) { arolg(); } } if (($ME.loc == prm22) || ($ME.loc == prm23)) { if (Dobj == tyrannosaurus) { arolg(); } } "I don't quite understand what you mean.\n"; } } ... cut { action = cantdo } proc throwAction() { if (Dobj.loc != $ME) { "You don't have it.\n"; ExitPhase(PHX_ACTOR); } "OK.\n"; cdrop(); } ... eat { action = proc() {"I think I just lost my appetite.\n";} } ... abracadabra { action = proc() { if (prehs != $ME.loc.loc) { "That phrase hasn't worked in at least ten thousand years.\n"; return; } if ($ME.loc != prm17) { "Nothing happens.\n"; return; } if (spear.tooky) { if (!spear.abrad) { spear.abrad = 1; "The rubble gets magically cleared away.\n"; return; } } "Nothing much happens.\n"; } } ... tie { action = proc() {"It is impossible to tie a knot in that right now. \n";} } ... untie { action = proc() {"I don't quite understand what you mean.\n";} } ... swim { action = proc() { if ($ME.loc == irm8) { ei8(); return; } if ($ME.loc == irm9) { ei8(); $ME.move(irm8); return; } "I don't see enough water here to even wade in.\n"; } } ... wipe { action = proc() {"I don't quite comprehend what you are saying.\n";} } ... shake { action = proc() {"That probably won't accomplish much.\n";} } ... jamb { action = proc() {"I don't quite comprehend what you mean.\n";} } ... xyzzy { action = proc() { "You are transported to a room where you are faced by a wizard who ", "points to you and says, \"Them's fighting words!\" You immediately ", "get attacked by all sorts of denizens of the museum: there is a ", "cobra chewing on your leg, a troglodyte is bashing your brains out ", "with a gold nugget, a crocodile is removing large chunks of flesh ", "from you, a rhinoceros is goring you with his horn, a sabre-tooth ", "cat is busy trying to disembowel you, you are being trampled by a ", "large mammoth, a vampire is sucking you dry, a Tyrannosaurus Rex is ", "sinking his six-inch long fangs into various parts of your anatomy, ", "a large bear is dismembering your body, a gargoyle is bouncing up ", "and down on your head, a burly troll is tearing you limb from limb, ", "several dire wolves are making mince meat out of your torso, and ", "the wizard is about to transport you to the corner of Westwood and ", "Broxton. Oh dear, you seem to have gotten yourself killed, ", "as well.\n"; skore(); ratng(); ratnx(); Quit(); } } ... score { action = proc() { skore(); ratng(); } } proc quitAction() { skore(); ratng(); ratnx(); Quit(); } proc scale() { $ME.weight = 0; if ($ME.cont) { scads($ME.cont); } } proc scads(obj) { forall (obj[i]) { $ME.weight += obj[i].weight; } } proc stdadv::TakeAct() {ctake();} proc stdadv::DropAct() {cdrop();} proc ctake() { scale(); if (Dobj.pNoTake) { "That thing is too heavy to carry.\n"; Skip = true; return; } if ((Dobj.weight + $ME.weight) > 20) { "You are carrying too much. You will have to at least drop ", "something first.\n"; Skip = true; return; } $ME.weight = Dobj.weight + $ME.weight; if (!Dobj.rarea) { return; } $ME.pscore = $ME.pscore + Dobj.pfound; Dobj.pfound = 0; } proc cdrop() { if ($ME.loc == prm21) { "OK, it falls further down into the crack.\n"; Dobj.move(prm22); Skip = true; return; } if (!Dobj.rarea) { return; } else if ((Dobj.rarea == 2) && ($ME.loc == mrm5)) { scord(); } else if ((Dobj.rarea == 1) && ($ME.loc == mrm3)) { scord(); } } proc scord() { $ME.pscore = $ME.pscore + Dobj.pplace; Dobj.pplace = 0; } ... rname { action = proc() { $ME.loc.sdesc(); ExitPhase(PHX_ACTOR); } } ... shell { action = proc() { //spec(EXEC, "/bin/csh", "-i", 0); } } ... echo { action = proc() { echoInput = !echoInput; if (echoInput) "Echo on\n"; else "Echo off\n"; } }