/*
 *
 * Hamlet
 *
 * Things
 *
 * code and data dealing with 'things' in the game,
 * which I'm making a point of NOT calling objects.
 *
 */

var Thing = new Object;
NUM_THNG = 0;
function th(name,fullname,wearable,firstplace,description,uses,pluses)
{
	Thing[++NUM_THNG] = new Object;
	Thing[NUM_THNG].id = NUM_THNG;
	Thing[NUM_THNG].name = name; // short version of name
	Thing[NUM_THNG].fullname = fullname; // full name
	Thing[NUM_THNG].wearable = wearable; // true for clothing
	Thing[NUM_THNG].firstplace = firstplace; // starting place
	Thing[NUM_THNG].description = description;
	Thing[NUM_THNG].uses = uses // general uses
	Thing[NUM_THNG].pluses = pluses; // uses in specific places
	eval(name + ' = Thing[' + NUM_THNG + '];');
}

function pldo(th)
{
	return('does');
}

// called when you attempt to foo something that can't be fooed
function default_use(verb,th)
{
	if(verb=='eat')
		say('I don\'t think the ' + th.name + ' would be very tasty.');
	else if(verb=='talk')
		say('The ' + th.name + ' doesn\'t seem to be very talkative.');
	else if(verb=='smell')
		say('The ' + th.name + ' doesn\'t smell very interesting.');
	else if(verb=='kiss')
		say('I don\'t think you and the ' + th.name + ' are close enough for that.');
	else if(verb=='fight')
		say('You have no animosity towards the ' + th.name + '.');
	else if(verb=='wave')
		say('Waving the ' + th.name + ' about has no useful effect.');
	else if(verb=='wear')
		say('You can\'t wear the ' + th.name + '!');
	else
		say('You can\'t do that with the ' + th.name + '.');
}

th('nothing',
'nothing',
false,
nowhere,
'It is nothing at all. You shouldn\'t be looking at it!',
'',
''
);

th('form',
'an auditions form',
false,
theatre,
'\"Urgently Required: Actress for the part of THISBY in upcoming \
rom-com. Must provide own costume. Replies c/o P. Quince, \
Elsinore Players\' Guild.\"',
'',
''
);

th('carrot',
'a carrot',
false,
nowhere,
'A muddy orange vegetable. It happens to have grown in a \
childishly amusing shape.',
'eat::*eat_carrot()',
''
);
function eat_carrot()
{
	take_away(carrot);
	var txt = 'Okay, you have eaten the carrot. It was quite tasty.';
	if(gs('horse')==1)
		txt += '\nThe horse seems less interested in you now.';
	sgs('horse',0);
	say(txt);
}

th('crown',
'a crown',
true,
nowhere,
'A golden crown with purple velvet trimming, proclaiming \
the wearer to be King of England.',
'',
''
);

th('dagger',
'a dagger',
false,
nowhere,
'Is it a dagger that you see before you? Er... yes. It is six inches \
long and pointy.',
'',
''
);

th('bat',
'a dead bat',
false,
nowhere,
'The slightly bruised corpse of a Greater Danish Fruitbat. It is black and \
leathery, with maroonish blood congealed on its head.',
'eat::Who do you think you are, Ozzy Osbourne?\
/smell::The bat doesn\'t smell very nice at all.\
/kiss::No. You might be arrested.\
/fight::I think you have already proved you can beat the bat in a fight.\
/bury::Let\'s not get over-sentimental about this.\
/smell:Not pleasant.',
''
);

th('body',
'a dead body',
false,
nowhere,
'The body is that of Polonius, the Lord Chamberlain. \
It is dressed in regimental uniform and a ridiculous wig, and has \
several stab wounds in the chest region.',
'eat::Don\'t be disgusting!\
/kiss::No. You might be arrested.\
/fight::I think you have already proved you can beat Polonius in a fight.\
/bury::Good guess, but no.\
/smell::Not pleasant.',
''
);

th('whisky',
'a flask of whisky',
false,
nowhere,
'A silver hip-flask reeking of cheapest GlenMcGachglach \
scotch whisky.',
'drink::*drink_whisky()\
/eat::I\'m no connoisseur, but I believe whisky is for \
drinking, not eating.\
/smell::Phew! The fumes from the whisky are almost enough to \
knock you senseless.',
''
);
function drink_whisky()
{
	take_away(whisky);
	say('Okay. You down the whisky, pass out for several hours, \
and then wake up with a blinding headache.');
}

th('coins',
'some gold coins',
false,
nowhere,
'A pile of glistening golden doubloons from the reign \
of King Umlautt XIX.',
'',
''
);

th('flute',
'a flute',
false,
queens_bedchamber,
'A wooden flute, about a foot long and quite heavy. It has a \
label reading \"ANCIENT INDIAN MAGIC FLUTE.\"',
'play::*play_flute()',
''
);
function play_flute()
{
	if(heroloc()!=thingloc(rope))
	{
		if(in_inv(rope))
			say('You produce an interesting tooting noise.\n\
The rope you are carrying twitches.')
		else
			say('You produce an interesting tooting noise.');
		return;
	}
	if(heroloc()!=dunsinane)
	{
		say('You produce an interesting tooting noise.\n\
The rope twitches, and starts to climb... then falls back to the floor.');
		return;
	}

	inc_score();
	sgs('strpe',1);
	set_thingloc(rope,nowhere);
	dunsinane.exits='out::outside_dunsinane.up::tower1';
	say('You produce an interesting tooting noise.\n\
The rope twitches, and starts to climb... it latches on to something \
above you and stops firm.');
}

th('handkerchief',
'a handkerchief',
false,
nowhere,
'A white handkerchief patterned with strawberries. Probably \
the most complicated prop in Shakespeare. It is embroidered \
\"To my darling Dessie, with all my love. P.S. I\'m watching \
you, you brazen wench! - O.\"',
'wear::No. You don\'t want to look like a British holidaymaker.',
''
);

th('certificate',
'a medical certificate',
false,
dungeon,
'\"The bearer of this certificate is officially \
completely sane, mentally healthy, in full possession \
of his or her collection of marbles, and in no way \
a mad deranged nutter with a tendency to knife people \
in the face.\n\
\"Signed, S. HRINK M.D., Ph.D., etc.\n\
\"Chairman,\n\
\"Medical Authority of Denmark (M.A.D.)\"',
'',
''
);

th('rope',
'some rope',
false,
nowhere,
'A piece of sturdy cloth rope, precisely as long as it needs \
to be. It has a tag reading \"ANCIENT INDIAN MAGIC ROPE.\"',
'cut::The rope is too thick to cut.',
''
);

th('skull',
'a human skull',
false,
graveyard,
'In an astonishing feat of visual biometrics you recognise the skull as \
that of your old court jester, alias poor Yorick.',
'smell::Yuck! The skull smells horrible.\
/eat::Don\'t be disgusting!\
/kiss::No. You might be arrested.\
/fight::Oh, come on. Respect for the dead and all that.\
/alas::Come to think of it, he was never all that funny.',
''
);

th('pepper',
'a jar of pepper',
false,
nowhere,
'A jar of finest crushed pepper. It smells quite strongly.',
'smell::*sneeze()',
''
);
function sneeze()
{
	var txt = 'You sniff the pepper... AA-CHOOO!';

	if(personloc(desdemona)==heroloc() && gs('hnky')==0)
	{
		inc_score();
		sgs('hnky',1);
		txt += '\n\"Ooh, you poor thing,\" says Desdemona. \
\"Here, have this.\"\n';
		if(give_hero(handkerchief))
			txt += 'She hands you her handkerchief.'
		else
			txt += 'She puts her handkerchief down at your feet.';
	}
	
	say(txt);
}

th('book',
'a recipe book',
false,
moorland,
'The book is bound in threadbare cloth and is bookmarked at one \
page, which reads:\n\
  Eye of newt and wing of bat,\n\
  Human skull, and then that\'s that!\n\
  Add a pinch of salt to taste,\n\
  Grind into a viscous paste,\n\
  In the bubbling cauldron pour;\n\
  Twenty minutes, Gas Mark Four.',
'',
''
);

th('shovel',
'a shovel',
false,
nowhere,
'A largish shovel with a dirty wooden handle and a \
rusty iron blade.',
'',
''
);

th('scissors',
'a pair of nailscissors',
false,
ophelias_room,
'*describe_scissors()',
'',
''
);
function describe_scissors()
{
	if(gs('shrpscs')==0)
		say('The scissors have a blue plastic handle and blades \
of flimsy metal. They seem to be blunt.')
	else
		say('The scissors have a blue plastic handle and blades \
of flimsy metal. They are very sharp... ow! You cut your finger.');
}

th('postcard',
'a postcard',
false,
ophelias_room,
'The front of the postcard has a picture of the Eiffel Tower wearing \
a beret. The back reads:\n\
  Dear Sis,\n\
    Having a great time here in France, eating loads of\n\
    garlic and listening to dreadful accordion playing. Hope\n\
    you\'re not up to any mischief, you little minx! Look\n\
    forward to seeing you and Dad when I come home.\n\
      Love, Laertes.\n\
      p.s. Stay away from that Hamlet kid. He\'s bad news.',
'',
''
);

th('chalice',
'a golden chalice',
false,
nowhere,
'A beautiful golden cup. It is filled to the brim with a sickly green \
potion, which seems to be smoking slightly.',
'smell::The potion in the chalice smells sweet and faintly bitter.\
/drink::*drink_chalice()',
''
);
function drink_chalice()
{
	die('You down the contents of the chalice... glug glug.\n\
Ooh... you feel a bit queasy... aaargh!', randomDeath());
}

th('salt',
'a packet of salt',
false,
nowhere,
'An economy size packet of everyone\'s favourite edible powdered rock.',
'eat::*take_away(salt);say("If you insist. Yuck! You have eaten the salt.");',
''
);

th('ticket',
'a travel ticket',
false,
nowhere,
'This seems to be an economy class ticket for a Denmark-England \
ferry.',
'',
''
);

th('hairspray',
'a can of hairspray',
true, // not really, but this allows a funny message for "wear hairspray"
tower2,
'An aerosol canister of \"Antonio\'s Ultra-Hold Hairspray, \
All Natural, CFC Free - For All Your Shy Locks! \
(INGREDIENTS: propylene glycol, \
CFCs, formaldehyde, sodium steate, glyceryl monolaurate, \
newts\' eyes, crud.\)"',
'smell::The hairspray smells of cheap, gluey perfume. Yuch!\
/wear::The shaggy unkempt look suits you better.',
''
);

th('chest',
'a treasure chest',
false,
nowhere,
'A heavy oaken treasure chest with brass trimming.',
'open::*open_chest()',
''
);
function open_chest()
{
	if(gs('opnch')==1)
	{
		say('There is nothing else in the chest.');
		return;
	}
	sgs('opnch',1);
	inc_score();
	set_thingloc(coins,heroloc());
	say('Some gold coins spill out of the chest.');
}

th('telegram',
'a telegram',
false,
cell,
'\
TO    MISS J CAPULET  CO  CAPULET MANSION  VERONA\n\
FROM  FR LAWRENCE  VERONA BENEDICTINE CHAPEL\n\
RE    ROMEO\n\
\n\
DEAR JULIET\n\
\n\
GREAT NEWS  STOP  ROMEO NOT DEAD AFTER ALL  STOP  NO \
NEED TO KILL YOURSELF  STOP  ACTUALLY JUST AN ELABORATE \
RUSE TO SET YOU TWO UP  STOP  SURPRISE!\n\
\n\
YRS  L\n\
\n\
PS  HOPE THAT FOOL FRIAR JOHN DIDNT SCREW UP AGAIN  STOP',
'',
''
);

