Array.prototype.find = function(searchStr) {
  var returnArray = false;
  for (i=0; i<this.length; i++) {
    if (typeof(searchStr) == 'function') {
      if (searchStr.test(this[i])) {
        if (!returnArray) { returnArray = [] }
        returnArray.push(i);
      }
    } else {
      if (this[i]===searchStr) {
        if (!returnArray) { returnArray = [] }
        returnArray.push(i);
      }
    }
  }
  return returnArray;
}

//Basic dice roller
function rd(sides)
{
	return(Math.floor(Math.random()*sides)+1);
}

//Fills td in tables and p with the given HTML, usually just text
function chtd(td,txt)
{
	document.getElementById(td).innerHTML = txt;
}

//Fills a given field with a given value
function ss(box, roll)
{
	document.chargen.elements[box].value = roll;
}

//Retrieves the value of a given field
function gs(box)
{
	var derp = document.chargen.elements[box].value;
	return derp;
}

//Checks to make sure there's a name and age
function validate(theform)
{
	if (theform.charname.value=='') { alert('You must enter a name!'); return 0; } 
	if (isNaN(theform.age.value)||theform.age.value==''||theform.age.value<1) { alert('You must enter a valid age!'); return 0; }
	return 1;
}

function validate2(theform)
{
	if (theform.charname.value=='') { alert('You must enter a name!'); return 0; } 
	if (isNaN(theform.age.value)||theform.age.value==''||theform.age.value<1) { alert('You must enter a valid age!'); return 0; }
	if (theform.highattb.value=='') { alert('Please select your favored attribute!'); return 0; }
	return 1;
}

//The big one; fills out the everything
function rollstats(theform)
{
	//Rolls each stat, based on a (6)(6) system, e.g. from 11 to 16, 21 to 26, etc.
	var ath1 = rd(6);
	var ath2 = rd(6);
	var ath = Math.floor((ath1+ath2)/3);

	var aff1 = rd(6);
	var aff2 = rd(6);
	var aff = Math.floor((aff1+aff2)/3);

	var ski1 = rd(6);
	var ski2 = rd(6);
	var ski = Math.floor((ski1+ski2)/3);

	var cun1 = rd(6);
	var cun2 = rd(6);
	var cun = Math.floor((cun1+cun2)/3);

	var luck1 = rd(6);
	var luck2 = rd(6);
	var luck = Math.floor((luck1+luck2)/3);

	var will1 = rd(6);
	var will2 = rd(6);
	var will = Math.floor((will1+will2)/3);

	//Chooses two maid types, with stat-affecting bonuses
	var maidtype1 = [];
	var maidtype2 = [];
	maidtype1 = maidtype();
	maidtype2 = maidtype();

	//Modifies the stats; outcome is new(stat)
	var newath = ath + parseInt(maidtype1[3]) + parseInt(maidtype2[3]); if (newath<0) { newath = 0; }
	var newaff = aff + parseInt(maidtype1[4]) + parseInt(maidtype2[4]); if (newaff<0) { newaff = 0; }
	var newski = ski + parseInt(maidtype1[5]) + parseInt(maidtype2[5]); if (newski<0) { newski = 0; }
	var newcun = cun + parseInt(maidtype1[6]) + parseInt(maidtype2[6]); if (newcun<0) { newcun = 0; }
	var newluck = luck + parseInt(maidtype1[7]) + parseInt(maidtype2[7]); if (newluck<0) { newluck = 0; }
	var newwill = will + parseInt(maidtype1[8]) + parseInt(maidtype2[8]); if (newwill<0) { newwill = 0; }

	//Sets each field - original, type one, type two, result
	chtd('athtd','<input type="text" size="1" value="' + ath + '" readonly="readonly" /> + <input type="text" size="2" value="' + parseInt(maidtype1[3]) + '" readonly="readonly" /> + <input type="text" size="2" value="' + parseInt(maidtype2[3]) + '" readonly="readonly" /> = <input type="text" name="ath" size="2" value="' + newath + '" readonly="readonly" />');
	chtd('afftd','<input type="text" size="1" value="' + aff + '" readonly="readonly" /> + <input type="text" size="2" value="' + parseInt(maidtype1[4]) + '" readonly="readonly" /> + <input type="text" size="2" value="' + parseInt(maidtype2[4]) + '" readonly="readonly" /> = <input type="text" name="aff" size="2" value="' + newaff + '" readonly="readonly" />');
	chtd('skitd','<input type="text" size="1" value="' + ski + '" readonly="readonly" /> + <input type="text" size="2" value="' + parseInt(maidtype1[5]) + '" readonly="readonly" /> + <input type="text" size="2" value="' + parseInt(maidtype2[5]) + '" readonly="readonly" /> = <input type="text" name="ski" size="2" value="' + newski + '" readonly="readonly" />');
	chtd('cuntd','<input type="text" size="1" value="' + cun + '" readonly="readonly" /> + <input type="text" size="2" value="' + parseInt(maidtype1[6]) + '" readonly="readonly" /> + <input type="text" size="2" value="' + parseInt(maidtype2[6]) + '" readonly="readonly" /> = <input type="text" name="cun" size="2" value="' + newcun + '" readonly="readonly" />');
	chtd('lucktd','<input type="text" size="1" value="' + luck + '" readonly="readonly" /> + <input type="text" size="2" value="' + parseInt(maidtype1[7]) + '" readonly="readonly" /> + <input type="text" size="2" value="' + parseInt(maidtype2[7]) + '" readonly="readonly" /> = <input type="text" name="luck" size="2" value="' + newluck + '" readonly="readonly" />');
	chtd('willtd','<input type="text" size="1" value="' + will + '" readonly="readonly" /> + <input type="text" size="2" value="' + parseInt(maidtype1[8]) + '" readonly="readonly" /> + <input type="text" size="2" value="' + parseInt(maidtype2[8]) + '" readonly="readonly" /> = <input type="text" name="will" size="2" value="' + newwill + '" readonly="readonly" />');

	//Sets the field to display the maid types
	chtd('mttd',maidtype1[0] + ' &amp; ' + maidtype2[0]);

	//Gets uniform color, rolls if random
	var unicolor;
	if (theform.unicolor.value=='random') { unicolor = color(); } else { unicolor = theform.unicolor.value; }

	//Hair color, rolls if random
	var haircolor;
	if (theform.haircolor.value=='random') { haircolor = color(); } else { haircolor = theform.haircolor.value; }

	//Eye color, rolls if random
	var eyecolor;
	if (theform.eyecolor.value=='random') { eyecolor = color(); } else { eyecolor = theform.eyecolor.value; }

	//Sets the fields
	chtd('unicolortd',unicolor);
	chtd('haircolortd',haircolor);
	chtd('eyecolortd',eyecolor);

	//maiddescstr is the string that holds the description
	//Starts it off with the name, age, etc.
	var maiddescstr = 'Your name is ' + theform.charname.value + '. You are ' + theform.age.value
		+ ' years old. You have <span id="eyecolorspan">' + eyecolor + '</span> eyes and <span id="haircolorspan">' + haircolor + '</span> hair, and wear ';
	if (unicolor=='orange'||unicolor=='indigo') { maiddescstr += 'an'; } else { maiddescstr += 'a'; }
	maiddescstr += ' <span id="uniformcolorspan">' + unicolor + '</span> maid uniform. You are ';
	
	var maidtname1 = maidtype1[0].toLowerCase();
	var maidtname2 = maidtype2[0].toLowerCase();

	//General formatting
	if (maidtname1=='heroine') { maidtname1 = 'heroic'; }
	if (maidtname1=='lolita') { maidtname1 = 'childlike'; }
	if (maidtname2=='heroine') { maidtname2 = 'heroic'; }
	if (maidtname2=='lolita') { maidtname2 = 'childlike'; }

	if (maidtname1==maidtname2) { maiddescstr += 'very ' + maidtname1; }
	else { maiddescstr += maidtname1 + ' and ' + maidtname2; }

	maiddescstr += '; others describe you as ';

	//Grabs a list of words from the descriptions of maid types
	var descwords = maidtype1[2].split(", ").concat(maidtype2[2].split(", "));

	//Grabs three unique words from the pool
	var descword1 = descwords[rd(descwords.length-1)];
	var descword2 = descword1;
	while (descword1==descword2)
	{ descword2 = descwords[rd(descwords.length-1)]; }
	var descword3 = descword2;
	while (descword1==descword3||descword2==descword3)
	{ descword3 = descwords[rd(descwords.length-1)]; }

	var chardesc = descword1 + ', ' + descword2 + ' and ' + descword3 + '. ';
	ss('chardesc',chardesc);

	maiddescstr += chardesc;
	maiddescstr += '<br /><br />';

	//Maid qualities; chosen or between 2-5 random
	var numqual = theform.specqual.value;
	if (numqual==0) { numqual = rd(4)+1; }

	var qual1;
	var qual2;
	var qual3;
	var qual4;
	var qual5;
	var x;
	//This is used for keeping track of already-selected outcomes to prevent dupes, also used to disallow tables
	var alreadychosen = [];
	var isthere;
	var bob;

	//Checks to see if perversion table and trauma table are allowed; adds to alreadychosen to disallow
	if (theform.pervtable.value==0)
	{
		alreadychosen = alreadychosen.concat("Nymphomaniac","Sadist","Masochist","Womanizer","Likes Them Young","Exhibitionist");
	}
	if (theform.traumatable.value==0)
	{
		alreadychosen = alreadychosen.concat("Suicide Attempts","Killed Your Parents","Saw Parent Die","Sibling Hate","Family Breakup","Abusive Parents");
	}

	var sqarr = new Array();

	//Grabs special qualities
	for (x = 0; x < numqual; x++)
	{
		//Gets the type
		qual = specqual(theform.pervtable.value);
		//Checks to see if quality name exists in the list
		bob = qual[0];
		isthere = alreadychosen.find(bob);

		//if it is, typeof returns 'object'; keeps rerolling until the new quality isn't present
		while (typeof(isthere)=="object")
		{ 
			qual = specqual(theform.pervtable.value);
			bob = qual[0];
			isthere = alreadychosen.find(bob);
		}
		
		//Adds the quality to the disallow list
		alreadychosen = alreadychosen.concat(bob);
		//Adds the quality to the output
		sqarr = sqarr.concat(bob);
		//Adds the description text to the maiddesc
		maiddescstr += qual[1] + ' ';
	}

	maiddescstr += '<br /><br />';
	//Pretties up the output formatting
	var maidqual = sqarr.toString();
	maidqual = maidqual.replace(",",", ","g");
	chtd('sq',maidqual);

	//Rolls a root
	maidroot = maidroots();
	maiddescstr += maidroot[1] + ' ';
	chtd('mr',maidroot[0]);

	//Rolls a weapon
	if (theform.maidweapontable.value==1)
	{ 
		weapon = maidweapon(); 
		maiddescstr += 'In combat, ' + weapon[1] + ' ';
		chtd('mw',weapon[0]);
	}
	else
	{
		chtd('mw','None');
	}
	
	//Rolls a stress
	stress = stresstable();
	maiddescstr += 'When you are extremely upset, ' + stress[1] + ' ';
	chtd('se',stress[0]);

	//Here's the tricky shit...
	//First, we put the stats in an array
	var statarr = [newath, newaff, newski, newcun, newluck, newwill];
	//Then, we put the stats in an array and order it highest to lowest
	var orderarr = [newath, newaff, newski, newcun, newluck, newwill];
	orderarr.sort(function(a,b){return b - a});

	//We see what the highest value is
	bob = orderarr[0];
	//We check to see which stat that corresponds to
	var joe = statarr.find(bob);
	var toparr = new Array();

	//Comparing order to stats and returning names
	for (x = 0; x < joe.length; x++)
	{
		switch(joe[x]) {
			case 0: toparr = toparr.concat("Athletics"); break;
			case 1: toparr = toparr.concat("Affection"); break;
			case 2: toparr = toparr.concat("Skill"); break;
			case 3: toparr = toparr.concat("Cunning"); break;
			case 4: toparr = toparr.concat("Luck"); break;
			case 5: toparr = toparr.concat("Will"); break;
		}
	}

	var maidpower = new Array();
	var maidpower2 = new Array();
	var attopt;

	//If only one stat was in that list, it's the highest; get the power from appropriate table
	if (toparr.length==1)
	{
		switch(toparr[0]) {
			case "Athletics": maidpower = athtable(); break;
			case "Affection": maidpower = afftable(); break;
			case "Skill": maidpower = skitable(); break;
			case "Cunning": maidpower = cuntable(); break;
			case "Luck": maidpower = lucktable(); break;
			case "Will": maidpower = willtable(); break;
		}

		chtd('ha',toparr[0]);
		ss('highattb',toparr[0]);
		ss('mpower1b',maidpower[0]);

		//If the stats add up to less than 9, roll two
		if ((newath+newaff+newski+newcun+newluck+newwill)<=9)
		{
			switch(toparr[0]) {
				case "Athletics": maidpower2 = athtable(); break;
				case "Affection": maidpower2 = afftable(); break;
				case "Skill": maidpower2 = skitable(); break;
				case "Cunning": maidpower2 = cuntable(); break;
				case "Luck": maidpower2 = lucktable(); break;
				case "Will": maidpower2 = willtable(); break;
			}

			chtd('mp',maidpower[0] + ', ' + maidpower2[0]);
			ss('mpower2b',maidpower2[0]);
			maiddescstr += '<span id="hadesc">Due to your notable ' + toparr[0] + ', you have the ability ' + maidpower[0] + '. ' + maidpower[1] + '</span><span id="hadesc2"> You also have the power of ' + maidpower2[0] + '; ' + maidpower2[1] + ' </span>';
		}
		else
		{
			chtd('mp',maidpower[0]);
			maiddescstr += '<span id="hadesc">Due to your notable ' + toparr[0] + ', you have the ability ' + maidpower[0] + '. ' + maidpower[1] + '</span><span id="hadesc2"></span>';
		}
	}
	else
	{
		//If there were multiple stats, add a select box and leave it to the user to choose with attopt function

		if ((newath+newaff+newski+newcun+newluck+newwill)<=9) { attopt = '<select name="ao" onchange="attopt(this.form.ao.value,1);"><option value="none">Select One</option>'; }
		else { attopt = '<select name="ao" onchange="attopt(this.form.ao.value,0);"><option value="none">Select One</option>'; }
		for (x = 0; x < toparr.length; x++)
		{
			attopt += '<option value="' + toparr[x] + '">' + toparr[x] + '</option>';
		}

		attopt += '</select>';
		chtd('ha',attopt);
		chtd('mp','');
		ss('mpower1b','');
		ss('mpower2b','');
		ss('highattb','');
		maiddescstr += '<span id="hadesc"></span><span id="hadesc2"></span>';
	}

	//Sets the description
	chtd('maiddesc',maiddescstr);

	//Fills hidden fields
	ss('unicolorb',unicolor);
	ss('haircolorb',haircolor);
	ss('eyecolorb',eyecolor);
	ss('mtype1b',maidtype1[0]);
	ss('mtype2b',maidtype2[0]);
	ss('specqualb',maidqual);
	ss('mrootb',maidroot[0]);
	ss('weaponb',weapon[0]);
	ss('stressb',stress[0]);
}

function attopt(chosen,twopow)
{

	ss('highattb',chosen);
	chtd('ha',chosen);

	var maidpower = new Array();
	var maidpower2 = new Array();

	switch(chosen) {
		case "Athletics": maidpower = athtable(); break;
		case "Affection": maidpower = afftable(); break;
		case "Skill": maidpower = skitable(); break;
		case "Cunning": maidpower = cuntable(); break;
		case "Luck": maidpower = lucktable(); break;
		case "Will": maidpower = willtable(); break;
		case "none": return false; break;
	}

	if (twopow==1)
	{
		switch(chosen) {
			case "Athletics": maidpower2 = athtable(); break;
			case "Affection": maidpower2 = afftable(); break;
			case "Skill": maidpower2 = skitable(); break;
			case "Cunning": maidpower2 = cuntable(); break;
			case "Luck": maidpower2 = lucktable(); break;
			case "Will": maidpower2 = willtable(); break;
			case "none": return false; break;
		}
		chtd('mp',maidpower[0] + ', ' + maidpower2[0]);
		ss('mpower1b',maidpower[0]);
		ss('mpower2b',maidpower2[0]);
		chtd('hadesc','Due to your notable ' + chosen + ', you have the ability ' + maidpower[0] + '. ' + maidpower[1] + '</span><span id="hadesc2"> You also have the power of ' + maidpower2[0] + '; ' + maidpower2[1] + ' </span>');
	}
	else
	{
		chtd('mp',maidpower[0]);
		ss('mpower1b',maidpower[0]);
		chtd('hadesc','Due to your notable ' + chosen + ', you have the ability ' + maidpower[0] + '. ' + maidpower[1] + '</span><span id="hadesc2"></span>');
	}
}

function maidtype()
{
	var roll = rd(6);

	var mtn;
	var meff;
	var mtdesc;

	var athmod = 0;
	var affmod = 0;
	var skimod = 0;
	var cunmod = 0;
	var luckmod = 0;
	var willmod = 0;

	switch(roll) {
		case 1:
			mtn = "Lolita";
			meff = "Luck +1, Athletics -1";
			luckmod = 1;
			athmod = -1;
			mtdesc = "childish, young, innocent, cute, sweet";
			break;
		case 2:
			mtn = "Sexy";
			meff = "Cunning +1, Will -1";
			cunmod = 1;
			willmod = -1;
			mtdesc = "charming, coquettish, curvy, glamorous";
			break;
		case 3:
			mtn = "Pure";
			meff = "Affection +1, Cunning -1";
			affmod = 1;
			cunmod = -1;
			mtdesc = "pure, maidenly, clean, fragile";
			break;
		case 4:
			mtn = "Cool";
			meff = "Skill +1, Affection -1";
			skimod = 1;
			affmod = -1;
			mtdesc = "composed, expressionless, unflappable, doll-like";
			break;
		case 5:
			mtn = "Boyish";
			meff = "Athletics +1, Skill -1";
			athmod = 1;
			skimod = -1;
			mtdesc = "wild, energetic, vigorous, a tomboy";
			break;
		case 6:
			mtn = "Heroine";
			meff = "Will +1, Luck -1";
			willmod = 1;
			luckmod = -1;
			mtdesc = "earnest, single-minded, spirited, indominable";
			break;
	}

	var mtarray = [mtn, meff, mtdesc, athmod, affmod, skimod, cunmod, luckmod, willmod];
	return mtarray;
}

function choosecolor(box,boxval)
{
	if (boxval=='random') {	boxval = color(); }
	switch(box) {
		case 'uniform':
			chtd('unicolortd',boxval);
			chtd('uniformcolorspan',boxval);
			break;
		case 'hair':
			chtd('haircolortd',boxval);
			chtd('haircolorspan',boxval);
			break;
		case 'eyes':
			chtd('eyecolortd',boxval);
			chtd('eyecolorspan',boxval);
			break;
	}
}

function color()
{
	var r1 = (rd(6)*10);
	var r2 = rd(6);
	var roll = r1 + r2;

	var color;

	switch(roll)
	{
		case 11:
			color = 'red'; break;
		case 12:
		case 21:
			color = 'purple'; break;
		case 13:
		case 31:
			color = 'orange'; break;
		case 14:
		case 41:
			color = 'pink'; break;
		case 15:
		case 51:
			color = 'brown'; break;
		case 61:
		case 16:
			color = 'vermillion'; break;
		case 22:
			color = 'blue'; break;
		case 23:
		case 32:
			color = 'green'; break;
		case 24:
		case 42:
			color = 'sky blue'; break;
		case 25:
		case 52:
			color = 'navy'; break;
		case 26:
		case 62:
			color = 'indigo'; break;
		case 33:
			color = 'yellow'; break;
		case 34:
		case 43:
			color = 'cream'; break;
		case 35:
		case 53:
			color = 'beige'; break;
		case 36:
		case 63:
			color = 'gold'; break;
		case 44:
			color = 'white'; break;
		case 45:
		case 54:
			color = 'gray'; break;
		case 46:
		case 64:
			color = 'silver'; break;
		case 55:
			color = 'black'; break;
		case 56:
		case 65:
			color = 'metallic'; break;
		case 66:
			var r3 = rd(2);
			if (r3==1) { color = 'transparent'; }
			if (r3==2) { color = 'rainbow'; }
			break;
	}

	return color;
}

function specqual(lightdark)
{
	var r1 = rd(6)*10;
	var r2 = rd(6);
	var roll = r1 + r2;

	var subtable = new Array();
	var sqa = new Array();

	switch(roll) {
		case 11:
			qualname = 'Glasses';
			descname = 'You wear glasses; you can\'t use contact lenses, but at least they compliment your maid uniform.';
			break;
		case 12:
			qualname = 'Freckles';
			descname = 'You have a great deal of freckles.';
			break;
		case 13:
			qualname = 'Sickly';
			descname = 'You have an incurable disease, though it does not hinder your ability to perform your duties.';
			break;
		case 14:
			qualname = 'Quiet';
			descname = 'You are exceptionally quiet, with a cool, subtle demeanor.';
			break;
		case 15:
			qualname = 'Easygoing';
			descname = 'You are easygoing, taking things slowly and calmly, at your own pace.';
			break;
		case 16:
			qualname = 'Neat Freak';
			descname = 'You are obsessed with cleanliness, and can\'t let the tiniest bit of dirt go unnoticed.';
			break;
		case 21:
			qualname = 'Brown Skin';
			descname = 'Your skin is a beautiful, deep brown color.';
			break;
		case 22:
			qualname = 'Albino';
			descname = 'You are an albino, giving you a very pale, nearly colorless complexion.';
			break;
		case 23:
			qualname = 'Shy';
			descname = 'You\'re exceptionally shy, and have trouble opening up to new people.';
			break;
		case 24:
			qualnane = 'Actually A Guy';
			descname = 'You are a trap, hiding your true gender under the guise of another.';
			break;
		case 25:
			qualname = 'Overactive Imagination';
			descname = 'You frequently get caught up in your own imaginary world, getting lost in frequent daydreams and having trouble distinguishing fact from your own fiction.';
			break;
		case 26:
			qualname = 'Greedy';
			descname = 'You are very greedy, and will do absolutely anything for the sake of money.';
			break;
		case 31:
			qualname = 'Elf Ears';
			descname = 'You have long, pointed, elfin ears.';
			break;
		case 32:
			qualname = 'Nekomimi';
			descname = 'You are a catgirl, possessing a variety of feline features.';
			break;
		case 33:
			qualname = 'Android/Gynoid';
			descname = 'You are not human, but rather a human-looking robot, with a number of overtly artificial features.';
			break;
		case 34:
			qualname = 'Vampire';
			descname = 'You are a vampire, with long fangs, pale skin, an aversion to light and an insatiable appetite.';
			break;
		case 35:
			qualname = 'Princess';
			descname = 'You are the actually the daughter of a family of even greater standing of the master.';
			break;
		case 36:
			qualname = 'Angel/Devil';
			descname = 'You are a being from a world beyond this mortal coil, charged with judging good and evil.';
			break;
		case 41:
			subtable = uniformtable(); qualname = subtable[0]; descname = subtable[1]; break;
		case 42:
			subtable = symboltable(); qualname = subtable[0]; descname = subtable[1]; break;
		case 43:
			subtable = delinquenttable(); qualname = subtable[0]; descname = subtable[1]; break;
		case 44:
			subtable = accenttable(); qualname = subtable[0]; descname = subtable[1]; break;
		case 45:
			subtable = hairstyletable(); qualname = subtable[0]; descname = subtable[1]; break;
		case 46:
			subtable = accessorytable(); qualname = subtable[0]; descname = subtable[1]; break;
		case 51:
			if (lightdark==3) { lightdark = rd(2); }
			if (lightdark==1) { subtable = relationshiptable(); }
			if (lightdark==2) { subtable = perversiontable(); }
			qualname = subtable[0]; descname = subtable[1];
			break;
		case 52:
			subtable = criminaltable(); qualname = subtable[0]; descname = subtable[1]; break;
		case 53:
			subtable = injurytable(); qualname = subtable[0]; descname = subtable[1];  break;
		case 54:
			subtable = tragiclovetable(); qualname = subtable[0]; descname = subtable[1]; break;
		case 55:
			subtable = darkpasttable(); qualname = subtable[0]; descname = subtable[1]; break;
		case 56:
			subtable = traumatable(); qualname = subtable[0]; descname = subtable[1]; break;
		case 61:
			subtable = secretjobtable(); qualname = subtable[0]; descname = subtable[1]; break;
		case 62:
			subtable = membershiptable(); qualname = subtable[0]; descname = subtable[1]; break;
		case 63:
			subtable = shapeshiftertable(); qualname = subtable[0]; descname = subtable[1]; break;
		case 64:
			subtable = monstertable(); qualname = subtable[0]; descname = subtable[1]; break;
		case 65:
			subtable = magictable(); qualname = subtable[0]; descname = subtable[1]; break;
		case 66:
			subtable = absurdtable(); qualname = subtable[0]; descname = subtable[1]; break;
		}

	sqa = [qualname, descname];
	return sqa;
}

function uniformtable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Tights';
			descname = 'Instead of the usual skirt, you wear tights.';
			break;
		case 2:
			qualname = 'China Dress';
			descname = 'You wear a one-piece Chinese-style cheongsam maid uniform.';
			break;
		case 3:
			qualname = 'Armor';
			descname = 'Your maid uniform is actually a stylized suit of metal armor.';
			break;
		case 4:
			qualname = 'Bondage';
			descname = 'Your maid uniform is a slinky bondage outfit made of rubber and leather.';
			break;
		case 5:
			qualname = 'Miniskirt';
			descname = 'Your maid uniform includes a particular short, tight miniskirt.';
			break;
		case 6:
			qualname = 'Kappougi';
			descname = 'Rather than a Western-style maid uniform, you wear a Japanese-style uniform featuring a kimono and an apron.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function symboltable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Skull Mark';
			descname = 'Your maid outfit prominently features a skull mark.';
			break;
		case 2:
			qualname = 'Bat Symbol';
			descname = 'Your maid outfit prominently features a bat symbol.';
			break;
		case 3:
			qualname = 'Cross';
			descname = 'Your maid outfit prominently features a cross.';
			break;
		case 4:
			qualname = 'Yin-Yang';
			descname = 'Your maid outfit prominently features a yin-yang symbol.';
			break;
		case 5:
			qualname = 'Star';
			descname = 'Your maid outfit prominently features five- or six-pointed stars.';
			break;
		case 6:
			qualname = 'Card Suit';
			descname = 'Your maid outfit prominently features one of the four suits of playing cards.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function delinquenttable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Cigarettes';
			descname = 'You are addicted to nicotine, and always have a cigarette or cigar in your mouth or on your person.';
			break;
		case 2:
			qualname = 'Tattoo';
			descname = 'You have a tattoo somewhere (or all over) on your body.';
			break;
		case 3:
			qualname = 'Sunglasses';
			descname = 'You always wear sunglasses, even at night.';
			break;
		case 4:
			qualname = 'Bad Expression';
			descname = 'You have a perpetually unpleasant facial expression, as if you\'re always angry or upset, making first meetings difficult.';
			break;
		case 5:
			qualname = 'Piercings';
			descname = 'You have piercings somewhere on your body.';
			break;
		case 6:
			qualname = 'Rough Speak';
			descname = 'You talk like a rough-and-tumble gangster.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function accenttable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Southern';
			descname = 'You speak with a heavy but intelligible American Southern accent.';
			break;
		case 2:
			qualname = 'British';
			descname = 'You speak with a distinctly British accent.';
			break;
		case 3:
			qualname = 'Pidgin English';
			descname = 'You speak broken Pidgin English, and have trouble with grammar and word forms.';
			break;
		case 4:
			qualname = 'Meow';
			descname = 'Your speech is interspersed with cat sounds every now and then.';
			break;
		case 5:
			qualname = 'Knight';
			descname = 'You speak in Knightly English, using ancient word forms and antiquated phrases such as "Thou Art."';
			break;
		case 6:
			qualname = 'Foreigner';
			descname = 'You speak with a heavy but easily intelligible foreign, non-Japanese accent.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function hairstyletable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Long Ringlets';
			descname = 'Your hair is done up in large, long ringlets.';
			break;
		case 2:
			qualname = 'Dumplings';
			descname = 'Your hair is long, with "dumplings" on top.';
			break;
		case 3:
			qualname = 'Mesh';
			descname = 'You have a mesh haircut, a short, stylish hairdo that\'s trendy in Japan.';
			break;
		case 4:
			qualname = 'Curly Hair';
			descname = 'Your hair is curly enough to defy gravity, and always takes the same shape.';
			break;
		case 5:
			qualname = 'One Eye Hair';
			descname = 'Your hair hangs down so that conceals one of your eyes.';
			break;
		case 6:
			qualname = 'Antenna Hair';
			descname = 'Your hair has antennae or feelers and a mind of its own.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function accessorytable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Collar';
			descname = 'Your maid outfit includes a collar, like a dog\'s.';
			break;
		case 2:
			qualname = 'Large Ribbon';
			descname = 'You wear a large ribbon in your hair.';
			break;
		case 3:
			qualname = 'Spike';
			descname = 'Your uniform menaces with spikes.';
			break;
		case 4:
			qualname = 'Chains';
			descname = 'Your uniform has jangling chains attached to it.';
			break;
		case 5:
			qualname = 'Black Leather Gloves';
			descname = 'You usually wear black leather gloves with your maid outfit.';
			break;
		case 6:
			qualname = 'Pet';
			descname = 'You have a small animal companion that sits on your shoulder or rests in your hands.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function relationshiptable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Sibling';
			descname = 'You are related by blood to one of the other characters.';
			break;
		case 2:
			qualname = 'Childhood Friends';
			descname = 'You are childhood friends with one of the other characters.';
			break;
		case 3:
			qualname = 'Mentor';
			descname = 'You look up to one of the other characters as your mentor.';
			break;
		case 4:
			qualname = 'Friendly Rival';
			descname = 'You and one of the other characters are constant, but friendly, rivals in some area.';
			break;
		case 5:
			qualname = 'Ex-Lover/Love Rival';
			descname = 'You used to date one of the other characters, or you and one of the other characters are competing for the affections of a third.';
			break;
		case 6:
			qualname = 'Vengeance';
			descname = 'You have been wronged by one of the other characters in some fashion, in a way that you may forgive but will never forget.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function perversiontable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Nymphomaniac';
			descname = 'You are obsessed with the physical act of lovemaking.';
			break;
		case 2:
			qualname = 'Sadist';
			descname = 'You are excited by the infliction of pain and suffering on others.';
			break;
		case 3:
			qualname = 'Masochist';
			descname = 'You are excited by receiving pain and suffering from others.';
			break;
		case 4:
			qualname = 'Womanizer';
			descname = 'You are only romantically attracted to other women, and your interest in them is cranked up to 11.';
			break;
		case 5:
			qualname = 'Likes Them Young';
			descname = 'You are only interested in... "younger" partners.';
			break;
		case 6:
			qualname = 'Exhibitionist';
			descname = 'You enjoy showing off your body, in whatever states of undress you can get away with.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function criminaltable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Killer';
			descname = 'You are a serial murderer.';
			break;
		case 2:
			qualname = 'Pyromaniac';
			descname = 'You are a pyromaniac, and love setting fires... possibly even to the mansion.';
			break;
		case 3:
			qualname = 'Kleptomaniac';
			descname = 'You can\'t seem to keep yourself from stealing things, even if they\'re useless.';
			break;
		case 4:
			qualname = 'Addict';
			descname = 'You are physically and psychologically addicted to a drug of some kind.';
			break;
		case 5:
			qualname = 'Otaku';
			descname = 'You have a tireless obsession with a very specific area of interest; you pursue this interest with little regard for common sense.';
			break;
		case 6:
			qualname = 'Stalker';
			descname = 'You are stalking one of the other players, or even the master himself.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function injurytable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Patchwork';
			descname = 'Your body is covered with stitching scars.';
			break;
		case 2:
			qualname = 'One Eye';
			descname = 'You have only one eye.';
			break;
		case 3:
			qualname = 'Burns';
			descname = 'Your body is covered with painful-looking scars from burns.';
			break;
		case 4:
			qualname = 'Whip Scars';
			descname = 'Your back is covered with painful-looking welts from the whippings you received.';
			break;
		case 5:
			qualname = 'Bandages';
			descname = 'You wear bandages and casts to conceal injuries that will not heal.';
			break;
		case 6:
			qualname = 'Blind';
			descname = 'You were rendered blind a long time ago; like the great Zatoichi, you have learned to live without your sight.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function tragiclovetable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Separations';
			descname = 'For some reason, love just never works out for you; at this point, you\'ve resigned yourself to your fate.';
			break;
		case 2:
			qualname = 'Lover Died';
			descname = 'You had a lover once, but they are gone now; you are afraid to fall in love again.';
			break;
		case 3:
			qualname = 'Killed Your Lover';
			descname = 'You had a lover once, but something terrible happened, and their death was by your hands; you\'ve been afraid to fall in love again ever since.';
			break;
		case 4:
			qualname = 'Former Prostitute';
			descname = 'You used to sell your body, for cheap; a complex remains.';
			break;
		case 5:
			qualname = 'Betrayal';
			descname = 'You were once deeply betrayed by a lover; you\'ve been afraid to love again ever since.';
			break;
		case 6:
			qualname = 'Stalker Damage';
			descname = 'You were once victimized by a stalker, and have never been able to trust or love another since.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function darkpasttable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Former Delinquent';
			descname = 'Although no one would know it looking at you now, you used to be a delinquent; for now, no one else in the mansion knows.';
			break;
		case 2:
			qualname = 'Former Killer';
			descname = 'You used to be an assassin; your skills have not dulled with time.';
			break;
		case 3:
			qualname = 'Amnesiac';
			descname = 'You have lost your memories from when you were very young.';
			break;
		case 4:
			qualname = 'Bad Reputation';
			descname = 'You were involved in some very bad things in the past, making you a legend for all the wrong reasons.';
			break;
		case 5:
			qualname = 'Wanted';
			descname = 'The police want you for questioning about a very serious crime.';
			break;
		case 6:
			qualname = 'Runaway';
			descname = 'You fled your real home without permission.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function traumatable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Suicide Attempts';
			descname = 'In the past, you attempted suicide many times.';
			break;
		case 2:
			qualname = 'Killed Your Parents';
			descname = 'For whatever reason, you are responsible for the death of your parents.';
			break;
		case 3:
			qualname = 'Saw Parent Die';
			descname = 'You witnessed the death of one or both of your parents firsthand.';
			break;
		case 4:
			qualname = 'Sibling Hate';
			descname = 'You and your siblings detest each other.';
			break;
		case 5:
			qualname = 'Family Breakup';
			descname = 'Your family was forced to separate; whether warranted or not, you may blame yourself.';
			break;
		case 6:
			qualname = 'Abusive Parents';
			descname = 'Your parents were highly abusive toward you.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function secretjobtable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Assassin';
			descname = 'On the surface, you are nothing more than a mere maid; beneath, you are secretly a cold-hearted killer for hire.';
			break;
		case 2:
			qualname = 'Hacker';
			descname = 'Aside from being a maid, you are an expert hacker, breaking into computer systems for profit and knowledge.';
			break;
		case 3:
			qualname = 'Scientist';
			descname = 'Along with being a maid, you are a kind of mad scientist.';
			break;
		case 4:
			qualname = 'Doctor/Pharmacist';
			descname = 'In addition to being a maid, you have the skills and education of a medical doctor or pharmacist.';
			break;
		case 5:
			qualname = 'Doujin Artist';
			descname = 'In addition to being a maid, you create doujinshi in your spare time.';
			break;
		case 6:
			qualname = 'Pro Creator';
			descname = 'Along with being a maid, you are professional artist.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function membershiptable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Evil Secret Society';
			descname = 'You are a member of an evil secret society bent on world domination or destruction.';
			break;
		case 2:
			qualname = 'Secret Agency';
			descname = 'You are part of a secret agency under the government as an intelligence agent or spy.';
			break;
		case 3:
			qualname = 'Cult';
			descname = 'You are a member of an eccentric cult.';
			break;
		case 4:
			qualname = 'Political Organization';
			descname = 'You are part of a group organized around a political ideal, possibly one that others might think extreme or even insane.';
			break;
		case 5:
			qualname = 'Shadow Clan';
			descname = 'You are a member of an ancient society, a secret organization that has existed throughout history.';
			break;
		case 6:
			qualname = 'Government Official';
			descname = 'You are actually a government official working under the guise of a maid, such as a nurse, undercover detective or politician\'s secretary.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function shapeshiftertable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Fox';
			descname = 'You are actually a fox in human guise, and can display or hide your tail and ears at will.';
			break;
		case 2:
			qualname = 'Spider';
			descname = 'You are actually a spider, and can turn into a human-sized spider or grow six extra arms at will.';
			break;
		case 3:
			qualname = 'Raven';
			descname = 'You are actually a raven, with black wings that can be displayed or hidden at will.';
			break;
		case 4:
			qualname = 'Bunny';
			descname = 'You are actually a bunny, with bunny ears and a tail.';
			break;
		case 5:
			qualname = 'Tiger/Lion';
			descname = 'You are actually a large predatory cat, and can display or hide the ears, tail, claws and teeth at will.';
			break;
		case 6:
			qualname = 'Snake';
			descname = 'You are actually a snake, and can take on a naga form at will, transforming your lower half to a snake tail.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function monstertable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Mermaid';
			descname = 'You are actually a mermaid, with an affinity for water and ears that sometimes appear to be fins.';
			break;
		case 2:
			qualname = 'Zombie/Mummy';
			descname = 'You are actually an animated corpse, with a bad complexion and conspicuous wounds.';
			break;
		case 3:
			qualname = 'Werewolf';
			descname = 'You are actually a werebeast; whether you want to or not, you change into your wereform during a full moon.';
			break;
		case 4:
			qualname = 'Succubus';
			descname = 'You are actually a succubus, a demon that traps your prey by arousing their desires; you feature a few demonic traits that can be displayed or hidden at will.';
			break;
		case 5:
			qualname = 'Ghost';
			descname = 'You are actually a ghost, with a history tied to the mansion or your master\'s past.';
			break;
		case 6:
			qualname = 'Shinigami';
			descname = 'You are actually a shinigami, a death reaper which carries with you an aura of death.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function magictable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Priestess';
			descname = 'You can use magic grounded in religious ceremony, using various types of religious symbols to do so.';
			break;
		case 2:
			qualname = 'Onmyouji';
			descname = 'You practice Eastern-style magic based on Taoist principles using jufu, special curse charms written in brush ink on strips of paper.';
			break;
		case 3:
			qualname = 'Fortuneteller';
			descname = 'Within certain limits, you have the ability to predict the future using one of the countless methods of divination.';
			break;
		case 4:
			qualname = 'Western Magician';
			descname = 'You are a staff-wielding orthodox magician, using alchemy, Kabbalah or other forms of traditional Western magic.';
			break;
		case 5:
			qualname = 'Devil Summoner';
			descname = 'You know the spells necessary to summon demons, your tools of the trade being magic circles, a black cloak, and ancient books.';
			break;
		case 6:
			qualname = 'Necromancer';
			descname = 'You wield magic that lets you control the bodies and souls of the dead, your tools of the trade including skulls and black clothes.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function absurdtable()
{
	var roll = rd(6);
	var qualname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			qualname = 'Alien';
			descname = 'You are an alien who came to this world from somewhere in outer space.';
			break;
		case 2:
			qualname = 'Cyborg';
			descname = 'You were turned into a cyborg by a secret evil society or government project.';
			break;
		case 3:
			qualname = 'Runaway Ninja';
			descname = 'You ran away from your ninja village.';
			break;
		case 4:
			qualname = 'Magical Girl';
			descname = 'You came from a land of magic in order to train.';
			break;
		case 5:
			qualname = 'Fairy';
			descname = 'You are one of the fae folk.';
			break;
		case 6:
			qualname = 'Mutant';
			descname = 'You have suffered some kind of strange mutation.';
			break;
	}
	arr = [qualname,descname];
	return arr;
}

function maidroots()
{
	var r1 = rd(6)*10;
	var r2 = rd(6);
	var roll = r1 + r2;

	var rootname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 11:
		case 12:
			rootname = 'Debts';
			descname = 'Your family wound up with massive debts, and you found yourself coming to work at the mansion as repayment.';
			break;
		case 13:
		case 14:
			rootname = 'Slave';
			descname = 'You are a slave, and have no choice about your line of work.';
			break;
		case 15:
		case 16:
			rootname = 'Mistress';
			descname = 'Although you appear to be a maid, it would be more accurate to call you the master\'s lover.';
			break;
		case 21:
		case 22:
			rootname = 'Revenge';
			descname = 'The master is your hated enemy, and you are infiltrating his mansion in order to seek revenge.';
			break;
		case 23:
		case 24:
			rootname = 'Orphan';
			descname = 'You are an orphan adopted by the master or his parents.';
			break;
		case 25:
		case 26:
			rootname = 'Illegitimate Child';
			descname = 'You are an illegitimate child; from a legal standpoint you are no different from the master.';
			break;
		case 31:
		case 32:
			rootname = 'Hereditary Maid';
			descname = 'You were born into a family that has served the mansion for generations.';
			break;
		case 33:
		case 34:
			rootname = 'Self Punishment';
			descname = 'In order to punish yourself for your inexperience or sins, you have taken up the job of a maid.';
			break;
		case 35:
		case 36:
			rootname = 'Unrequited Love';
			descname = 'Following your one-sided love of the master, you have come here.';
			break;
		case 41:
		case 42:
			rootname = 'Business';
			descname = 'You are a maid because you need the money, and that\'s about it.';
			break;
		case 43:
		case 44:
			rootname = 'Infiltrator';
			descname = 'You are a member of an organization that opposes the master, and you have been sent to spy on or even possibly assassinate him.';
			break;
		case 45:
		case 46:
			rootname = 'Loyalty';
			descname = 'You feel great loyalty to the master.';
			break;
		case 51:
		case 52:
			rootname = 'Childhood Friend';
			descname = 'As the master\'s childhood friend, you\'ve used your influence to get here.';
			break;
		case 53:
		case 54:
			rootname = 'Admirer of Maids';
			descname = 'You have long admired maids, and through much hard work you\'ve finally become one yourself.';
			break;
		case 55:
		case 56:
			rootname = 'Returning a Favor';
			descname = 'The master did a great service for you, and you have become a maid in order to repay him.';
			break;
		case 61:
		case 62:
			rootname = 'Distant Relative';
			descname = 'Although you are only distantly related to the master, your parents have put you in his care.';
			break;
		case 63:
		case 64:
			rootname = 'Bridal Training';
			descname = 'You became a maid in order to prepare yourself to become an ideal bride some day.';
			break;
		case 65:
		case 66:
			rootname = 'Who Knows?';
			descname = 'You\'re not really quite sure how you wound up becoming a maid.';
			break;
	}
	
	arr = [rootname,descname];
	return arr;
}

function stresstable()
{
	var r1 = rd(6)*10;
	var r2 = rd(6);
	var roll = r1 + r2;

	while (roll>=65) 
	{ 
		r1 = rd(6)*10;
		r2 = rd(6);
		roll = r1 + r2;
	}

	var stressname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 11:
		case 12:
			stressname = 'Alcohol/Drugs';
			descname = 'you drink alcohol or take drugs until you can\'t remember anymore.';
			break;
		case 13:
		case 14:
			stressname = 'Stealing';
			descname = 'you steal valuables from the mansion or from other maids.';
			break;
		case 15:
		case 16:
			stressname = 'Violence';
			descname = 'you unleash violence on the other maids and the master.';
			break;
		case 21:
		case 22:
			stressname = 'Gambling';
			descname = 'you use every penny you have for gambling.';
			break;
		case 23:
		case 24:
			stressname = 'Racing';
			descname = 'you get into whatever vehicle is handy and go for a joyride at at least twice the speed limit.';
			break;
		case 25:
		case 26:
			stressname = 'Teasing';
			descname = 'you start persistently tormeting the other maids.';
			break;
		case 31:
		case 32:
			stressname = 'Mischief';
			descname = 'you play troublesome tricks on the master and the other maids.';
			break;
		case 33:
		case 34:
			stressname = 'Running Away';
			descname = 'you run away from the mansion.';
			break;
		case 35:
		case 36:
			stressname = 'Complaining';
			descname = 'you start incessantly complaining to the master and the other maids.';
			break;
		case 41:
		case 42:
			stressname = 'Seclusion';
			descname = 'you go into your room and won\'t come out, not even for food.';
			break;
		case 43:
		case 44:
			stressname = 'Crying';
			descname = 'you start crying.';
			break;
		case 45:
		case 46:
			stressname = 'Rampage';
			descname = 'you use anything you can lay your hands on to run around destroying things around the mansion.';
			break;
		case 51:
		case 52:
			stressname = 'Shopping';
			descname = 'you go on a mad shopping spree.';
			break;
		case 53:
		case 54:
			stressname = 'Sleep';
			descname = 'you spend all day sleeping.';
			break;
		case 55:
		case 56:
			stressname = 'Binge';
			descname = 'you gorge yourself on food.';
			break;
		case 61:
		case 62:
			stressname = 'Prayer';
			descname = 'you escape through religion, relentlessly praying to heaven for protection and strength.';
			break;
		case 63:
		case 64:
			stressname = 'Spoiled Child';
			descname = 'you act like a spoiled child, making demands from the master.';
			break;
	}

	arr = [stressname,descname];
	return arr;
}

function maidweapon()
{
	var r1 = rd(6)*10;
	var r2 = rd(6);
	var roll = r1 + r2;

	var weaponname;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 11:
			weaponname = 'Mop/Broom';
			descname = 'you fight with a broom or mop, the basic fighting style of a maid.';
			break;
		case 12:
			weaponname = 'Stun Gun';
			descname = 'you keep a stun gun ready to attack enemies.';
			break;
		case 13:
			weaponname = 'Kitchen Knife';
			descname = 'you wield an ordinary kitchen knife.';
			break;
		case 14:
			weaponname = 'Frying Pan';
			descname = 'you hit things with a frying pan.';
			break;
		case 15:
			weaponname = 'Vase/Bottle/Pot';
			descname = 'you grab something suitable from around the mansion and wave it around or throw it.';
			break;
		case 16:
			weaponname = 'Hand-to-Hand';
			descname = 'you fight with your bare hands, using striking attacks or submission moves.';
			break;
		case 21:
			weaponname = 'Revolver';
			descname = 'you fight with a revolver.';
			break;
		case 22:
			weaponname = 'Machinegun';
			descname = 'you wield a machinegun.';
			break;
		case 23:
			weaponname = 'Rifle';
			descname = 'you wield a rifle.';
			break;
		case 24:
			weaponname = 'Bomb/Grenade';
			descname = 'you use bombs, grenades, or plastic explosives.';
			break;
		case 25:
			weaponname = 'Bazooka';
			descname = 'you pull out a big-ass bazooka.';
			break;
		case 26:
			weaponname = 'Ray Gun';
			descname = 'you pack a working ray gun that looks like a prop out of a 50s sci-fi B movie.';
			break;
		case 31:
			weaponname = 'Metal Pipe/Nail Bat';
			descname = 'you wield a crude weapon like a metal pipe or bat with nails in it.';
			break;
		case 32:
			weaponname = 'Hammer';
			descname = 'you wield a hammer, either a claw hammer, a warhammer or a squeaky toy hammer.';
			break;
		case 33:
			weaponname = 'Scythe';
			descname = 'you wield a scythe worthy of the grim reaper.';
			break;
		case 34:
			weaponname = 'Kung Fu Weapon';
			descname = 'you wield a kung fu weapon, such as nunchucks, three-section staff, tonfa, sai, tai chi sword, and so forth.';
			break;
		case 35:
			weaponname = 'Chainsaw';
			descname = 'you fight with a chainsaw.';
			break;
		case 36:
			weaponname = 'Wooden Sword/Staff';
			descname = 'you wield a bokken (Japanese wooden sword) or staff.';
			break;
		case 41:
			weaponname = 'Axe/Hatchet';
			descname = 'you wield a tomahawk, battleaxe, halberd or the like.';
			break;
		case 42:
			weaponname = 'Moringstar';
			descname = 'you wield a spiked mace or flail.';
			break;
		case 43:
			weaponname = 'Western Sword';
			descname = 'you wield a traditional western sword, such as a longsword, rapier, flamberge, two-handed sword or the like.';
			break;
		case 44:
			weaponname = 'Whip';
			descname = 'you wield a whip, a cat-\'o-nine-tails, metal whip or the like.';
			break;
		case 45:
			weaponname = 'Spear/Lance';
			descname = 'you wield a spear, javelin or the like.';
			break;
		case 46:
			weaponname = 'Exotic Weapon';
			descname = 'you wield an unorthodox weapon such as a boomerang, qatar, African throwing iron or the like.';
			break;
		case 51:
			weaponname = 'Knife/Scalpel';
			descname = 'you attack with a knife or scalpel.';
			break;
		case 52:
			weaponname = 'Chain/Rope';
			descname = 'you attack with a chain or rope.';
			break;
		case 53:
			weaponname = 'Claws';
			descname = 'you attack with claws, such as a bagh nakh, cestus, or the like.';
			break;
		case 54:
			weaponname = 'Katana';
			descname = 'you wield a katana, kusarigama or other traditional Japanese weapon.';
			break;
		case 55:
			weaponname = 'Shuriken/Kunai';
			descname = 'you have a seemingly unlimited supply of shuriken or kunai at your disposal.';
			break;
		case 56:
			weaponname = 'Halberd/Pole Arm';
			descname = 'you attack with a halberd, bardiche, or other kind of pole arm.';
			break;
		case 61:
			weaponname = 'Summoning';
			descname = 'you are able to summon some kind of special being to attack your enemies.';
			break;
		case 62:
			weaponname = 'Magic';
			descname = 'you use magic to attack your foes.';
			break;
		case 63:
			weaponname = 'Psychic Powers';
			descname = 'you have some kind of psychic ability or superpower you use to attack.';
			break;
		case 64:
			weaponname = 'Book';
			descname = 'you wield a book as a blunt instrument, possibly tearing out pages.';
			break;
		case 65:
			weaponname = 'Internal Weapons';
			descname = 'you have some kind of weapons installed in your body which you use to attack.';
			break;
		case 66:
			weaponname = 'Religious Symbol';
			descname = 'you use a cross, prayer wheel, paper charm, or other seemingly harmless religious symbol to attack.';
			break;
	}

	arr = [weaponname,descname];
	return arr;
}






function athtable()
{
	var roll = rd(6);

	var powername;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			powername = 'Super Evasion';
			descname = 'In exchange for 1d6 Stress, you can completely avoid a single attack.';
			break;
		case 2:
			powername = 'Iron Wall';
			descname = 'You can use your Athletics attribute to defend up to two other characters.';
			break;
		case 3:
			powername = 'Trespass';
			descname = 'You can take 1d6 Stress to intrude on a battle, love scene, etc. You can also butt in after the action has ended, and this can even work when someone is using World for Two.';
			break;
		case 4:
			powername = 'Weapon from Nowhere';
			descname = 'You can pull your weapon seemingly from nowhere, and get in a surprise attack. If you make a surprise attack, you get to make an attack roll without the target getting to make an opposed roll.';
			break;
		case 5:
			powername = 'Giant Weapon';
			descname = 'You can attack with a giant weapon. (+1 to Athletics for attacking)';
			break;
		case 6:
			powername = 'Ultimate Retort';
			descname = 'You can blow off any opponent completely by delivering a good retort (GM decides). You can make it impossible to defend against this by taking 2 Stress. (This must be roleplayed.)';
			break;
	}

	arr = [powername,descname];
	return arr;
}

function afftable()
{
	var roll = rd(6);

	var powername;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			powername = 'Maiden\'s Tears';
			descname = 'By taking 2d6 Stress, you can make a request that can\'t be refused. (This must be roleplayed.)';
			break;
		case 2:
			powername = 'World for Two';
			descname = 'By taking 1d6 Stress, you can create a "world" for you and one other person, where for 5 minutes no one else can intrude.';
			break;
		case 3:
			powername = 'Power of Friendship';
			descname = 'You can take 1d6 Stress in order to remove 2d6 Stress from someone else.';
			break;
		case 4:
			powername = 'Cooked With Love';
			descname = 'When someone eats food you\'ve prepared, they lose 1d6 Stress.';
			break;
		case 5:
			powername = 'Windows of the Soul';
			descname = 'You understand the master\'s feelings better than anyone, and can offer careful help. (Add 2 to Favor gained.)';
			break;
		case 6:
			powername = 'Passionate Gaze';
			descname = 'With just a glance, you can ingratiate yourself with the master, taking 1d6 Stress to gain 1d3 Favor.';
			break;
	}

	arr = [powername,descname];
	return arr;
}

function skitable()
{
	var roll = rd(6);

	var powername;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			powername = 'Lock Picking';
			descname = 'You can enter any room whenever you feel like. This works even when someone is using World for Two.';
			break;
		case 2:
			powername = 'Stalking';
			descname = 'When you\'re following someone, there\'s no chance for them to detect you. Don\'t even bother rolling dice.';
			break;
		case 3:
			powername = 'Lie Detector';
			descname = 'By taking 1 Stress, you can make other players or the master admit if they\'ve lied.';
			break;
		case 4:
			powername = 'Ultimate Menu';
			descname = 'Add +1 to your Skill for the purposes of cooking.';
			break;
		case 5:
			powername = 'Instant Cleaning';
			descname = 'Add +1 to your Skill for the purposes of cleaning.';
			break;
		case 6:
			powername = '4-D Dress';
			descname = 'You can produce anything in the mansion from within your maid uniform.';
			break;
	}

	arr = [powername,descname];
	return arr;
}

function cuntable()
{
	var roll = rd(6);

	var powername;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			powername = 'Punishment';
			descname = 'When other maids make mistakes, you can gain the right to punish them, without them having a chance to make an opposed roll.';
			break;
		case 2:
			powername = 'Instant Restraint';
			descname = 'If you win a roll of Cunning vs. Athletics, you can restrain someone from doing something indecent.';
			break;
		case 3:
			powername = 'Coercion';
			descname = 'If you win a roll of Cunning vs. Athletics, you can completely damage or tear off someone\'s clothes, even "accidentally."';
			break;
		case 4:
			powername = 'Trap';
			descname = 'Even if you aren\'t there at the time, you can have a trap prepared in advance during a battle.';
			break;
		case 5:
			powername = 'Fake Crying';
			descname = 'You can use fake crying to use your Cunning for what would normally be an Affection roll. (This must be roleplayed.)';
			break;
		case 6:
			powername = 'Mockery';
			descname = 'When someone is taking Stress points, you can mock them and cause them to gain an additional 2 Stress points. (This must be roleplayed.)';
			break;
	}

	arr = [powername,descname];
	return arr;
}

function lucktable()
{
	var roll = rd(6);

	var powername;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			powername = 'Karma';
			descname = 'You can use your Luck to dodge an attack, and if you roll a 10 or higher you cause twice as much Stress to the opponent.';
			break;
		case 2:
			powername = 'Saw It';
			descname = 'You can declare that you\'ve seen something happening in the mansion; you can decide the timing too.';
			break;
		case 3:
			powername = 'Teleport';
			descname = 'You can go just about anywhere in the mansion instantly.';
			break;
		case 4:
			powername = 'Escape';
			descname = 'You can completely flee from a battle without taking any Stress.';
			break;
		case 5:
			powername = 'Foreboding';
			descname = 'You can tell when something dangerous is coming.';
			break;
		case 6:
			powername = 'Chance Meeting';
			descname = 'By taking 2 points of Stress, you can have an NPC that\'s just showing up for the first time be an acquaintance from some time before.';
			break;
	}

	arr = [powername,descname];
	return arr;
}

function willtable()
{
	var roll = rd(6);

	var powername;
	var descname;
	var arr = new Array();

	switch(roll) {
		case 1:
			powername = 'Immune to Pain';
			descname = 'During a battle, even if you\'re sent flying, you don\'t take any Stress. Outside of battle, however, you can still take Stress points as usual.';
			break;
		case 2:
			powername = 'Crisis Adrenaline';
			descname = 'You can spend 1d6 points of Favor to add an Athletics roll to your Stress. You cannot use this to deliberately avoid the natural removal of Stress points.';
			break;
		case 3:
			powername = 'Persistence';
			descname = 'Whenever you take Stress, automatically reduce the amount by 1 point.';
			break;
		case 4:
			powername = 'Tenacity';
			descname = 'Even after being defeated in battle, you can take 2 Stress to get to your feet.';
			break;
		case 5:
			powername = 'Hard Work';
			descname = 'Your relentless hard work pays off in the form of a +3 bonus to the end result (not the attribute or die rolls) of Skill rolls.';
			break;
		case 6:
			powername = 'Absolute Maid';
			descname = 'You are the very epitome of a maid, and you take no penalties when not in uniform.';
			break;
	}

	arr = [powername,descname];
	return arr;
}