/*** VERBS ***/

VERB
  sign,  play,
  rname, shell, eat,
  swim,  feed,  score, dig,
  cut,   plug,  tie,   untie,
  wipe,  shake, xyzzy, jamb,
  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);}


i        = inventory;
plugh    = xyzzy;	clean  = wipe;
shut     = close;	peruse = read;
chuck    = throw;	hurl   = throw;
toss     = throw;	heave  = throw;
discard  = drop;	excavate = dig;
grab     = take;	push   = touch;
pet      = touch;	devour = eat;
consume  = eat;		wade   = swim;
ford     = swim;	shazam = abracadabra;
hocus    = abracadabra;	abra   = abracadabra;
end      = quit;	bye    = quit;
leave    = exit;	climb  = up;

/*** VERB ROUTINES ***/

plug(ACTION) = Proc()
{
    If ($loc($ME) == irm13) {
	If ($loc(cotton) == $ME) {
	    "You stick the cotton into the rhino's ears.\n";
	    $move(cotton, $ALL);
	    rhino.earplg = 1;
	    $exit(1);
	}
    }
    "I don't quite understand what you mean.\n";
}


dig(ACTION) = Proc()
{
    If ($loc(shovel) != $ME) {
	"You don't have something to dig with.\n";
	$exit(1);
    }
    If ($loc($ME) == irm9) {
	If (!cotton.tookbt) {
	    cotton.tookbt = 1;
	    "You find some cotton buried in the sand.\n";
	    $move(cotton, irm9);
	    Return 0;
	}
	"OK\n";
	Return 0;
    }
    If ($loc($ME) == prm17) {
	If (!pendant.dugbt) {
	    pendant.dugbt = 1;
	    "You find an ancient pendant buried in the grave.\n";
	    $move(pendant, prm17);
	    Return 0;
	}
	"You dig some but you don't find anything.\n";
	Return 0;
    }
    "The ground is too hard to dig into.\n";
}


cantdo = Proc()
{
    "I don't believe I can do that.\n";
}


sign(ACTION) = cantdo;
play(ACTION) = cantdo;

arolg = Proc()
{
    "It will probably cost you an arm or a leg to feed that.\n";
    $exit(1);
}


feed(ACTION) = Proc()
{
    If (($loc($ME) == irm8) | ($loc($ME) == irm9)) {
	If (Dobj == crocodiles) {
	    arolg();
	}
    }
    If (($loc($ME) == prm19) & (Dobj == bear)) {
	If (!bear.hitbr) {
	    arolg();
	}
    }
    If (($loc($ME) == prm6) & (Dobj == smilo)) {
	If (!smilo.stond) {
	    arolg();
	}
    }
    If (($loc($ME) == prm22) | ($loc($ME) == prm23)) {
	If (Dobj == tyrannosaurus) {
	    arolg();
	}
    }
    "I don't quite understand what you mean.\n";
}


cut(ACTION) = cantdo;

throw(ACTION) = Proc()
{
    If ($loc(Dobj) != $ME) {
	"You don't have it.\n";
	$exit(1);
    }
    "OK.\n";
    cdrop();
}

eat(ACTION) = Proc() {"I think I just lost my appetite.\n";}

abracadabra(ACTION) = Proc()
{
    If (prehs != $loc($loc($ME))) {
        "That phrase hasn't worked in at least ten thousand years.\n";
	Return 0;
    }
    If ($loc($ME) != prm17) {
	"Nothing happens.\n";
	Return 0;
    }
    If (spear.tooky) {
	If (!spear.abrad) {
	    spear.abrad = 1;
	    "The rubble gets magically cleared away.\n";
	    Return 0;
	}
    }
    "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 ($loc($ME) == irm8) {
	ei8();
	Return 0;
    }
    If ($loc($ME) == irm9) {
	ei8();
	$move($ME, irm8);
	Return 0;
    }
    "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();
    $spec(QUIT);
}


score(ACTION) = Proc()
{
    skore();
    ratng();
}


quit( ACTION ) = Proc()
{
    skore();
    ratng();
    ratnx();
    $spec(QUIT);
}


scale = Proc()
{
    $ME.weight = 0;
    If ($cont($ME)) {
	scads($cont($ME));
    }
}


scads = Proc(obj)
{
    If (obj) {
	$ME.weight = $ME.weight + obj.weight;
	scads($link(obj));
    }
}


TakeAct = Proc() {ctake();}

DropAct = Proc() {cdrop();}


ctake = Proc()
{
    scale();
    If (Dobj.NOTAKE) {
	"That thing is too heavy to carry.\n";
	Skip = TRUE;
	Return 0;
    }
    If ((Dobj.weight + $ME.weight) > 20) {
        "You are carrying too much.  You will have to at least drop "
        "something first.\n";
	Skip = TRUE;
	Return 0;
    }
    $ME.weight = Dobj.weight + $ME.weight;
    If (!Dobj.rarea) {
	Return 0;
    }
    $ME.pscore = $ME.pscore + Dobj.pfound;
    Dobj.pfound = 0;
}


cdrop = Proc()
{
    If ($loc($ME) == prm21) {
	"OK, it falls further down into the crack.\n";
	$move(Dobj, prm22);
	Skip = TRUE;
	Return 0;
    }
    If (!Dobj.rarea) {
	Return 0;
    }
    Else If ((Dobj.rarea == 2) & ($loc($ME) == mrm5)) {
	scord();
    }
    Else If ((Dobj.rarea == 1) & ($loc($ME) == mrm3)) {
	scord();
    }
}
	
scord = Proc()
{
    $ME.pscore = $ME.pscore + Dobj.pplace;
    Dobj.pplace = 0;
}


rname(ACTION) = Proc()
{
    $sdesc($loc($ME))();
    $exit(1);
}


shell(ACTION) = Proc()
{
    $spec(EXEC, "/bin/csh", "-i", 0);
}