code:
package classes.Scenes
{
	import classes.*;
	import classes.Items.*
	import classes.GlobalFlags.kFLAGS;
	import classes.GlobalFlags.kGAMECLASS;
	import classes.MainViewManager;
	import flash.utils.describeType;
	import flash.utils.*

	public class DebugMenu extends BaseContent
	{
		public var flagNames:XML = describeType(kFLAGS);
		private var lastMenu:Function = null;

		public var setArrays:Boolean = false;

		//Set up equipment arrays
		public var weaponArray:Array = [];
		public var shieldArray:Array = [];
		public var armourArray:Array = [];
		public var undergarmentArray:Array = [];
		public var accessoryArray:Array = [];

		//Set up item arrays
		public var transformativeArray:Array = [];
		public var consumableArray:Array = [];
		public var dyeArray:Array = [];
		public var materialArray:Array = [];
		public var rareArray:Array = [];

		public function DebugMenu()
		{
		}

		public function accessDebugMenu():void {
			//buildArray();
			if (!getGame().inCombat) {
				hideMenus();
				mainView.nameBox.visible = false;
				mainView.nameBox.text = "";
				mainView.nameBox.maxChars = 16;
				mainView.nameBox.restrict = null;
				mainView.nameBox.width = 140;
				outputText("Welcome to the super secret debug menu!", true);
				menu();
				addButton(0, "Spawn Items", itemSpawnMenu, null, null, null, "Spawn any items of your choice, including items usually not obtainable through gameplay.");
				addButton(1, "Change Stats", statChangeMenu, null, null, null, "Change your core stats.");
				addButton(2, "Flag Editor", flagEditor, null, null, null, "Edit any flag. \n\nCaution: This might screw up your save!");
				addButton(3, "Reset NPC", resetNPCMenu, null, null, null, "Choose a NPC to reset.");
				//addButton(5, "Event Trigger", eventTriggerMenu);
				//addButton(6, "MeaninglessCorr", toggleMeaninglessCorruption, null, null, null, "Toggles the Meaningless Corruption flag. If enabled, all corruption requirements are disabled for scenes.");
				if (player.isPregnant()) addButton(4, "Abort Preg", abortPregnancy);
				addButton(7, "HACK STUFFZ", styleHackMenu, null, null, null, "H4X0RZ");
				addButton(14, "Exit", playerMenu);
			}
			if (getGame().inCombat) {
				clearOutput();
				outputText("You raise the wand but nothing happens. Seems like it only works when you're not in the middle of a battle.");
				doNext(playerMenu);
			}
		}

		//Spawn items menu
		private function itemSpawnMenu():void {
			setItemArrays();
			clearOutput();
			outputText("Select a category.");
			menu();
			addButton(0, "Transformatives", displayItemPage, transformativeArray, 1);
			addButton(1, "Consumables", displayItemPage, consumableArray, 1);
			addButton(2, "Dyes", displayItemPage, dyeArray, 1);
			addButton(3, "Materials", displayItemPage, materialArray, 1);
			addButton(4, "Rare Items", displayItemPage, rareArray, 1);
			addButton(5, "Weapons", displayItemPage, weaponArray, 1);
			addButton(6, "Shields", displayItemPage, shieldArray, 1);
			addButton(7, "Armours", displayItemPage, armourArray, 1);
			addButton(8, "Undergarments", displayItemPage, undergarmentArray, 1);
			addButton(9, "Accessories", displayItemPage, accessoryArray, 1);
			addButton(14, "Back", accessDebugMenu);
		}

		private function displayItemPage(array:Array, page:int):void {
			clearOutput();
			outputText("What item would you like to spawn? ");
			menu();
			var buttonPos:int = 0; //Button positions 4 and 9 are reserved for next and previous.
			for (var i:int = 0; i < 12; i++) {
				if (array[((page-1) * 12) + i] != undefined) {
					if (array[((page-1) * 12) + i] != null) addButton(buttonPos, array[((page-1) * 12) + i].shortName, inventory.takeItem, array[((page-1) * 12) + i], createCallBackFunction2(displayItemPage, array, page));
				}
				buttonPos++;
				if (buttonPos == 4 || buttonPos == 9) buttonPos++;
			}
			if (!isNextPageEmpty(array, page)) addButton(4, "Next", displayItemPage, array, page+1);
			if (!isPreviousPageEmpty(array, page)) addButton(9, "Previous", displayItemPage, array, page-1);
			addButton(14, "Back", itemSpawnMenu);
		}

		private function isPreviousPageEmpty(array:Array, page:int):Boolean {
			var isEmpty:Boolean = true;
			for (var i:int = 0; i < 12; i++) {
				if (array[((page-2) * 12) + i] != undefined) {
					isEmpty = false;
				}
			}
			return isEmpty;
		}

		private function isNextPageEmpty(array:Array, page:int):Boolean {
			var isEmpty:Boolean = true;
			for (var i:int = 0; i < 12; i++) {
				if (array[((page) * 12) + i] != undefined) {
					isEmpty = false;
				}
			}
			return isEmpty;
		}

		private function setItemArrays():void {
			if (setArrays) return; //Already set, cancel.
			//Build arrays here
			//------------
			// Transformatives
			//------------
			//Page 1
			transformativeArray.push(consumables.B_GOSSR);
			transformativeArray.push(consumables.BEEHONY);
			transformativeArray.push(consumables.BLACKPP);
			transformativeArray.push(consumables.BOARTRU);
			transformativeArray.push(consumables.BULBYPP);
			transformativeArray.push(consumables.CANINEP);
			transformativeArray.push(consumables.DBLPEPP);
			transformativeArray.push(consumables.DRAKHRT);
			transformativeArray.push(consumables.DRYTENT);
			transformativeArray.push(consumables.ECTOPLS);
			transformativeArray.push(consumables.EQUINUM);
			transformativeArray.push(consumables.FOXBERY);
			//Page 2
			transformativeArray.push(consumables.FOXJEWL);
			transformativeArray.push(consumables.FRRTFRT);
			transformativeArray.push(consumables.GLDRIND);
			transformativeArray.push(consumables.GLDSEED);
			transformativeArray.push(consumables.GOB_ALE);
			transformativeArray.push(consumables.HUMMUS_);
			transformativeArray.push(consumables.IMPFOOD);
			transformativeArray.push(consumables.INCUBID);
			transformativeArray.push(consumables.KANGAFT);
			transformativeArray.push(consumables.KNOTTYP);
			transformativeArray.push(consumables.LABOVA_);
			transformativeArray.push(consumables.LARGEPP);
			//Page 3
			transformativeArray.push(consumables.MAGSEED);
			transformativeArray.push(consumables.MGHTYVG);
			transformativeArray.push(consumables.MOUSECO);
			transformativeArray.push(consumables.MINOBLO);
			transformativeArray.push(consumables.MYSTJWL);
			transformativeArray.push(consumables.P_LBOVA);
			transformativeArray.push(consumables.PIGTRUF);
			transformativeArray.push(consumables.PRFRUIT);
			transformativeArray.push(consumables.PROBOVA);
			transformativeArray.push(consumables.P_DRAFT);
			transformativeArray.push(consumables.P_S_MLK);
			transformativeArray.push(consumables.PSDELIT);
			//Page 4
			transformativeArray.push(consumables.PURHONY);
			transformativeArray.push(consumables.SATYR_W);
			transformativeArray.push(consumables.SDELITE);
			transformativeArray.push(consumables.S_DREAM);
			transformativeArray.push(consumables.SUCMILK);
			transformativeArray.push(consumables.REPTLUM);
			transformativeArray.push(consumables.RINGFIG);
			transformativeArray.push(consumables.RIZZART);
			transformativeArray.push(consumables.S_GOSSR);
			transformativeArray.push(consumables.SALAMFW);
			transformativeArray.push(consumables.SHARK_T);
			transformativeArray.push(consumables.SNAKOIL);
			//Page 5
			transformativeArray.push(consumables.SPHONEY);
			transformativeArray.push(consumables.TAURICO);
			transformativeArray.push(consumables.TRAPOIL);
			transformativeArray.push(consumables.TSCROLL);
			transformativeArray.push(consumables.TSTOOTH);
			transformativeArray.push(consumables.VIXVIGR);
			transformativeArray.push(consumables.W_FRUIT);
			transformativeArray.push(consumables.WETCLTH);

			//------------
			// Consumables
			//------------
			//Page 1
			consumableArray.push(consumables.AKBALSL);
			consumableArray.push(consumables.C__MINT);
			consumableArray.push(consumables.CERUL_P);
			consumableArray.push(consumables.COAL___);
			consumableArray.push(consumables.DEBIMBO);
			consumableArray.push(consumables.EXTSERM);
			consumableArray.push(consumables.F_DRAFT);
			consumableArray.push(consumables.GROPLUS);
			consumableArray.push(consumables.H_PILL);
			consumableArray.push(consumables.HRBCNT);
			consumableArray.push(consumables.ICICLE_);
			consumableArray.push(consumables.KITGIFT);
			//Page 2
			consumableArray.push(consumables.L_DRAFT);
			consumableArray.push(consumables.LACTAID);
			consumableArray.push(consumables.LUSTSTK);
			consumableArray.push(consumables.MILKPTN);
			consumableArray.push(consumables.NUMBOIL);
			consumableArray.push(consumables.NUMBROX);
			consumableArray.push(consumables.OVIELIX);
			consumableArray.push(consumables.PEPPWHT);
			consumableArray.push(consumables.PPHILTR);
			consumableArray.push(consumables.PRNPKR);
			consumableArray.push(consumables.PROMEAD);
			consumableArray.push(consumables.REDUCTO);
			//Page 3
			consumableArray.push(consumables.SENSDRF);
			consumableArray.push(consumables.SMART_T);
			consumableArray.push(consumables.VITAL_T);
			consumableArray.push(consumables.B__BOOK);
			consumableArray.push(consumables.W__BOOK);
			consumableArray.push(consumables.BC_BEER);
			consumableArray.push(consumables.BHMTCUM);
			consumableArray.push(consumables.BIMBOCH);
			consumableArray.push(consumables.C_BREAD);
			consumableArray.push(consumables.CCUPCAK);
			consumableArray.push(consumables.FISHFIL);
			consumableArray.push(consumables.FR_BEER);
			//Page 4
			consumableArray.push(consumables.GODMEAD);
			consumableArray.push(consumables.H_BISCU);
			consumableArray.push(consumables.IZYMILK);
			consumableArray.push(consumables.M__MILK);
			consumableArray.push(consumables.MINOCUM);
			consumableArray.push(consumables.P_BREAD);
			consumableArray.push(consumables.P_WHSKY);
			consumableArray.push(consumables.PURPEAC);
			consumableArray.push(consumables.SHEEPMK);
			consumableArray.push(consumables.S_WATER);
			consumableArray.push(consumables.NPNKEGG);
			consumableArray.push(consumables.DRGNEGG);
			//Page 5
			consumableArray.push(consumables.W_PDDNG);
			consumableArray.push(consumables.TRAILMX);
			consumableArray.push(consumables.URTACUM);
			consumableArray.push(null);
			consumableArray.push(null);
			consumableArray.push(null);
			consumableArray.push(null);
			consumableArray.push(null);
			consumableArray.push(null);
			consumableArray.push(null);
			consumableArray.push(null);
			consumableArray.push(null);
			//Page 6
			consumableArray.push(consumables.BLACKEG);
			consumableArray.push(consumables.L_BLKEG);
			consumableArray.push(consumables.BLUEEGG);
			consumableArray.push(consumables.L_BLUEG);
			consumableArray.push(consumables.BROWNEG);
			consumableArray.push(consumables.L_BRNEG);
			consumableArray.push(consumables.PINKEGG);
			consumableArray.push(consumables.L_PNKEG);
			consumableArray.push(consumables.PURPLEG);
			consumableArray.push(consumables.L_PRPEG);
			consumableArray.push(consumables.WHITEEG);
			consumableArray.push(consumables.L_WHTEG);

			//------------
			// Dyes
			//------------
			//Page 1
			dyeArray.push(consumables.AUBURND);
			dyeArray.push(consumables.BLACK_D);
			dyeArray.push(consumables.BLOND_D);
			dyeArray.push(consumables.BLUEDYE);
			dyeArray.push(consumables.BROWN_D);
			dyeArray.push(consumables.GRAYDYE);
			dyeArray.push(consumables.GREEN_D);
			dyeArray.push(consumables.ORANGDY);
			dyeArray.push(consumables.PINKDYE);
			dyeArray.push(consumables.PURPDYE);
			dyeArray.push(consumables.RAINDYE);
			dyeArray.push(consumables.RED_DYE);
			//Page 2
			dyeArray.push(consumables.WHITEDY);

			//------------
			// Materials
			//------------
			//Page 1, which is the only page for material so far. :(
			materialArray.push(useables.GREENGL);
			materialArray.push(useables.B_CHITN);
			materialArray.push(useables.T_SSILK);
			materialArray.push(useables.D_SCALE);
			materialArray.push(useables.IMPSKLL);
			materialArray.push(useables.LETHITE);
			materialArray.push(null);
			materialArray.push(null);
			materialArray.push(null);
			materialArray.push(null);
			materialArray.push(null);
			materialArray.push(useables.CONDOM);
			//------------
			// Rare Items
			//------------
			//Page 1, again the only page available.
			rareArray.push(consumables.BIMBOLQ);
			rareArray.push(consumables.BROBREW);
			rareArray.push(consumables.HUMMUS2);
			rareArray.push(consumables.P_PEARL);

			rareArray.push(useables.DBGWAND);
			rareArray.push(useables.GLDSTAT);

			//------------
			// Weapons
			//------------
			//Page 1
			weaponArray.push(weapons.B_SCARB);
			weaponArray.push(weapons.B_SWORD);
			weaponArray.push(weapons.BLUNDER);
			weaponArray.push(weapons.CLAYMOR);
			weaponArray.push(weapons.CROSSBW);
			weaponArray.push(weapons.E_STAFF);
			weaponArray.push(weapons.FLAIL);
			weaponArray.push(weapons.FLINTLK);
			weaponArray.push(weapons.URTAHLB);
			weaponArray.push(weapons.H_GAUNT);
			weaponArray.push(weapons.JRAPIER);
			weaponArray.push(weapons.KATANA);
			//Page 2
			weaponArray.push(weapons.L__AXE);
			weaponArray.push(weapons.L_DAGGR);
			weaponArray.push(weapons.L_HAMMR);
			weaponArray.push(weapons.L_STAFF);
			weaponArray.push(weapons.L_WHIP);
			weaponArray.push(weapons.MACE);
			weaponArray.push(weapons.PIPE);
			weaponArray.push(weapons.PTCHFRK);
			weaponArray.push(weapons.RIDINGC);
			weaponArray.push(weapons.RRAPIER);
			weaponArray.push(weapons.S_BLADE);
			weaponArray.push(weapons.S_GAUNT);
			//Page 3
			weaponArray.push(weapons.SCARBLD);
			weaponArray.push(weapons.SCIMITR);
			weaponArray.push(weapons.SPEAR);
			weaponArray.push(weapons.SUCWHIP);
			weaponArray.push(weapons.W_STAFF);
			weaponArray.push(weapons.WARHAMR);
			weaponArray.push(weapons.WHIP);

			//------------
			// Shields
			//------------
			//Page 1, poor shield category is so lonely. :(
			shieldArray.push(shields.BUCKLER);
			shieldArray.push(shields.DRGNSHL);
			shieldArray.push(shields.GREATSH);
			shieldArray.push(shields.KITE_SH);
			shieldArray.push(shields.TOWERSH);

			//------------
			// Armours
			//------------
			//Page 1
			armourArray.push(armors.ADVCLTH);
			armourArray.push(armors.B_DRESS);
			armourArray.push(armors.BEEARMR);
			armourArray.push(armors.BIMBOSK);
			armourArray.push(armors.BONSTRP);
			armourArray.push(armors.C_CLOTH);
			armourArray.push(armors.CHBIKNI);
			armourArray.push(armors.CLSSYCL);
			armourArray.push(armors.DBARMOR);
			armourArray.push(armors.FULLCHN);
			armourArray.push(armors.FULLPLT);
			armourArray.push(armors.GELARMR);
			//Page 2
			armourArray.push(armors.GOOARMR);
			armourArray.push(armors.I_CORST);
			armourArray.push(armors.I_ROBES);
			armourArray.push(armors.INDECST);
			armourArray.push(armors.KIMONO);
			armourArray.push(armors.LEATHRA);
			armourArray.push(armors.URTALTA);
			armourArray.push(armors.LMARMOR);
			armourArray.push(armors.LTHCARM);
			armourArray.push(armors.LTHRPNT);
			armourArray.push(armors.LTHRROB);
			armourArray.push(armors.M_ROBES);
			//Page 3
			armourArray.push(armors.TBARMOR);
			armourArray.push(armors.NURSECL);
			armourArray.push(armors.OVERALL);
			armourArray.push(armors.R_BDYST);
			armourArray.push(armors.RBBRCLT);
			armourArray.push(armors.S_SWMWR);
			armourArray.push(armors.SAMUARM);
			armourArray.push(armors.SCALEML);
			armourArray.push(armors.SEDUCTA);
			armourArray.push(armors.SEDUCTU);
			armourArray.push(armors.SS_ROBE);
			armourArray.push(armors.SSARMOR);
			//Page 4
			armourArray.push(armors.T_BSUIT);
			armourArray.push(armors.TUBETOP);
			armourArray.push(armors.W_ROBES);

			//------------
			// Undergarments
			//------------
			//Page 1
			undergarmentArray.push(undergarments.C_BRA);
			undergarmentArray.push(undergarments.C_LOIN);
			undergarmentArray.push(undergarments.C_PANTY);
			undergarmentArray.push(undergarments.DS_BRA);
			undergarmentArray.push(undergarments.DS_LOIN);
			undergarmentArray.push(undergarments.DSTHONG);
			undergarmentArray.push(undergarments.FUNDOSH);
			undergarmentArray.push(undergarments.FURLOIN);
			undergarmentArray.push(undergarments.GARTERS);
			undergarmentArray.push(undergarments.LTX_BRA);
			undergarmentArray.push(undergarments.LTXSHRT);
			undergarmentArray.push(undergarments.LTXTHNG);
			undergarmentArray.push(undergarments.SS_BRA);
			//Page 2
			undergarmentArray.push(undergarments.SS_LOIN);
			undergarmentArray.push(undergarments.SSPANTY);

			//------------
			// Accessories
			//------------
			//Page 1
			accessoryArray.push(jewelries.CRIMRNG);
			accessoryArray.push(jewelries.FERTRNG);
			accessoryArray.push(jewelries.ICE_RNG);
			accessoryArray.push(jewelries.LIFERNG);
			accessoryArray.push(jewelries.MYSTRNG);
			accessoryArray.push(jewelries.POWRRNG);
			accessoryArray.push(jewelries.PURERNG);
			accessoryArray.push(jewelries.DIAMRNG);
			accessoryArray.push(jewelries.GOLDRNG);
			accessoryArray.push(jewelries.LTHCRNG);
			accessoryArray.push(jewelries.PLATRNG);
			accessoryArray.push(jewelries.SILVRNG);
			setArrays = true;
		}

		private function statChangeMenu():void {
			outputText("Which attribute would you like to alter?", true);
			menu();
			addButton(0, "Strength", statChangeAttributeMenu, "str")
			addButton(1, "Toughness", statChangeAttributeMenu, "tou")
			addButton(2, "Speed", statChangeAttributeMenu, "spe")
			addButton(3, "Intelligence", statChangeAttributeMenu, "int")
			addButton(5, "Libido", statChangeAttributeMenu, "lib")
			addButton(6, "Sensitivity", statChangeAttributeMenu, "sen")
			addButton(7, "Corruption", statChangeAttributeMenu, "cor")
			addButton(14, "Back", accessDebugMenu);
		}

		private function statChangeAttributeMenu(stats:String = ""):void {
			var attribute:* = stats;
			outputText("Increment or decrement by how much?", true);
			addButton(0, "Add 1", statChangeApply, stats, 1);
			addButton(1, "Add 5", statChangeApply, stats, 5);
			addButton(2, "Add 10", statChangeApply, stats, 10);
			addButton(3, "Add 25", statChangeApply, stats, 25);
			addButton(4, "Add 50", statChangeApply, stats, 50);
			addButton(5, "Subtract 1", statChangeApply, stats, -1);
			addButton(6, "Subtract 5", statChangeApply, stats, -5);
			addButton(7, "Subtract 10", statChangeApply, stats, -10);
			addButton(8, "Subtract 25", statChangeApply, stats, -25);
			addButton(9, "Subtract 50", statChangeApply, stats, -50);
			addButton(14, "Back", statChangeMenu);
		}

		private function statChangeApply(stats:String = "", increment:Number = 0):void {
			dynStats(stats, increment);
			statScreenRefresh();
			statChangeAttributeMenu(stats);
		}

		private function styleHackMenu():void {
			menu()
			outputText("TEST STUFFZ", true);
			addButton(0, "ASPLODE", styleHackMenu);
			addButton(1, "Scorpion Tail", changeScorpionTail);
			addButton(2, "Be Manticore", getManticoreKit, null, null, null, "Gain everything needed to become a Manticore-morph.");
			addButton(3, "Be Dragonne", getDragonneKit, null, null, null, "Gain everything needed to become a Dragonne-morph.");
			addButton(4, "Debug Prison", debugPrison);
			addButton(5, "Tooltips Ahoy", kGAMECLASS.doNothing, null, null, null, "Ahoy! I'm a tooltip! I will show up a lot in future updates!", "Tooltip 2.0");
			addButton(6, "Lights Out", startLightsOut, testVictoryFunc, testFailureFunc, null, "Test the lights out puzzle, fresh off TiTS!");
			addButton(7, "Isabella Birth", kGAMECLASS.isabellaFollowerScene.isabellaGivesBirth, null, null, null, "Test Isabella giving birth for debugging purposes.", "Trigger Isabella Giving Birth");
			addButton(14, "Back", accessDebugMenu);
		}

		private function changeScorpionTail():void {
			clearOutput();
			outputText("Your tail is now that of a scorpion's. Currently, scorpion tail has no use but it will eventually be useful for stinging.");
			player.tailType = TAIL_TYPE_SCORPION;
			player.tailVenom = 100;
			player.tailRecharge = 5;
			doNext(styleHackMenu);
		}

		private function getManticoreKit():void {
			clearOutput();
			outputText("You are now a Manticore!");
			//Cat TF
			player.faceType = FACE_CAT;
			player.earType = EARS_CAT;
			player.lowerBody = LOWER_BODY_TYPE_CAT;
			player.legCount = 2;
			player.skinType = SKIN_TYPE_FUR;
			player.skinDesc = "fur";
			//Draconic TF
			player.hornType = HORNS_DRACONIC_X2;
			player.horns = 4;
			player.wingType = WING_TYPE_BAT_LIKE_LARGE;
			//Scorpion TF
			player.tailType = TAIL_TYPE_SCORPION;
			player.tailVenom = 100;
			player.tailRecharge = 5;
			doNext(styleHackMenu);
		}

		private function getDragonneKit():void {
			clearOutput();
			outputText("You are now a Dragonne!");
			//Cat TF
			player.faceType = FACE_CAT;
			player.earType = EARS_CAT;
			player.tailType = TAIL_TYPE_CAT;
			player.lowerBody = LOWER_BODY_TYPE_CAT;
			player.legCount = 2;
			//Draconic TF
			player.skinType = SKIN_TYPE_SCALES;
			player.skinDesc = "scales";
			player.tongueType = TONGUE_DRACONIC;
			player.hornType = HORNS_DRACONIC_X2;
			player.horns = 4;
			player.wingType = WING_TYPE_DRACONIC_LARGE;
			doNext(styleHackMenu);
		}

		private function debugPrison():void {
			clearOutput();
			doNext(styleHackMenu);
			//Stored equipment
			outputText("Stored equipment:");
			outputText("\nStored armour: ");
			if (flags[kFLAGS.PRISON_STORAGE_ARMOR] != 0) {
				outputText("" + ItemType.lookupItem(flags[kFLAGS.PRISON_STORAGE_ARMOR]));
			}
			else outputText("None");
			outputText("\nStored weapon: ");
			if (flags[kFLAGS.PRISON_STORAGE_WEAPON] != 0) {
				outputText("" + ItemType.lookupItem(flags[kFLAGS.PRISON_STORAGE_WEAPON]));
			}
			else outputText("None");
			outputText("\nStored shield: ");
			if (flags[kFLAGS.PRISON_STORAGE_SHIELD] != 0) {
				outputText("" + ItemType.lookupItem(flags[kFLAGS.PRISON_STORAGE_SHIELD]));
			}
			else outputText("None");
			//Stored items
			outputText("\n\nStored items:");
			for (var i:int = 0; i < 10; i++) {
				if (player.prisonItemSlots[i*2] != null && player.prisonItemSlots[i*2] != undefined) {
					outputText("\n" + player.prisonItemSlots[i*2]);
					outputText(" x" + player.prisonItemSlots[(i*2) +1]);
				}
			}
			flushOutputTextToGUI();
		}

		private function eventTriggerMenu():void {
			menu();
			addButton(0, "Anemone", kGAMECLASS.anemoneScene.anemoneKidBirthPtII);
			//addButton(0, "Marae Purify", kGAMECLASS.highMountains.minervaScene.minervaPurification.purificationByMarae);
			//addButton(1, "Jojo Purify", kGAMECLASS.highMountains.minervaScene.minervaPurification.purificationByJojoPart1);
			//addButton(2, "Rathazul Purify", kGAMECLASS.highMountains.minervaScene.minervaPurification.purificationByRathazul);

			addButton(14, "Back", accessDebugMenu);
		}

		private function toggleMeaninglessCorruption():void {
			clearOutput();
			if (flags[kFLAGS.MEANINGLESS_CORRUPTION] == 0) {
				flags[kFLAGS.MEANINGLESS_CORRUPTION] = 1;
				outputText("Set MEANINGLESS_CORRUPTION flag to 1.");
			}
			else {
				flags[kFLAGS.MEANINGLESS_CORRUPTION] = 0;
				outputText("Set MEANINGLESS_CORRUPTION flag to 0.");
			}
		}

		private function resetNPCMenu():void {
			clearOutput();
			outputText("Which NPC would you like to reset?");
			menu();
			if (flags[kFLAGS.URTA_COMFORTABLE_WITH_OWN_BODY] < 0 || flags[kFLAGS.URTA_QUEST_STATUS] == -1) addButton(0, "Urta", resetUrta);
			if (flags[kFLAGS.JOJO_STATUS] >= 5 || flags[kFLAGS.JOJO_DEAD_OR_GONE] > 0) addButton(1, "Jojo", resetJojo);
			if (flags[kFLAGS.EGG_BROKEN] > 0) addButton(2, "Ember", resetEmber);
			if (flags[kFLAGS.SHEILA_DISABLED] > 0 || flags[kFLAGS.SHEILA_DEMON] > 0 || flags[kFLAGS.SHEILA_CITE] < 0 || flags[kFLAGS.SHEILA_CITE] >= 6) addButton(6, "Sheila", resetSheila);

			addButton(14, "Back", accessDebugMenu);
		}

		private function resetUrta():void {
			clearOutput();
			outputText("Did you do something wrong and get Urta heartbroken or did you fail Urta's quest? You can reset if you want to.");
			doYesNo(reallyResetUrta, resetNPCMenu);
		}
		private function reallyResetUrta():void {
			clearOutput();
			if (flags[kFLAGS.URTA_QUEST_STATUS] == -1) {
				outputText("Somehow, you have a feeling that Urta somehow went back to Tel'Adre.  ");
				flags[kFLAGS.URTA_QUEST_STATUS] = 0;
			}
			if (flags[kFLAGS.URTA_COMFORTABLE_WITH_OWN_BODY] < 0) {
				outputText("You have a feeling that Urta finally got over with her depression and went back to normal.  ");
				flags[kFLAGS.URTA_COMFORTABLE_WITH_OWN_BODY] = 0;
			}
			doNext(resetNPCMenu);
		}

		private function resetSheila():void {
			clearOutput();
			outputText("Did you do something wrong with Sheila? Turned her into demon? Lost the opportunity to get her lethicite? No problem, you can just reset her!");
			doYesNo(reallyResetSheila, resetNPCMenu);
		}
		private function reallyResetSheila():void {
			clearOutput();
			if (flags[kFLAGS.SHEILA_DISABLED] > 0) {
				outputText("You can finally encounter Sheila again!  ");
				flags[kFLAGS.SHEILA_DISABLED] = 0;
			}
			if (flags[kFLAGS.SHEILA_DEMON] > 0) {
				outputText("Sheila is no longer a demon; she is now back to normal.  ");
				flags[kFLAGS.SHEILA_DEMON] = 0;
				flags[kFLAGS.SHEILA_CORRUPTION] = 30;
			}
			if (flags[kFLAGS.SHEILA_CITE] < 0) {
				outputText("Any lost Lethicite opportunity is now regained.  ");
				flags[kFLAGS.SHEILA_CITE] = 0;
			}
			doNext(resetNPCMenu);
		}

		private function resetJojo():void {
			clearOutput();
			outputText("Did you do something wrong with Jojo? Corrupted him? Accidentally removed him from the game? No problem!");
			doYesNo(reallyResetJojo, resetNPCMenu);
		}
		private function reallyResetJojo():void {
			clearOutput();
			if (flags[kFLAGS.JOJO_STATUS] > 1) {
				outputText("Jojo is no longer corrupted!  ");
				flags[kFLAGS.JOJO_STATUS] = 0;
			}
			if (flags[kFLAGS.JOJO_DEAD_OR_GONE] > 0) {
				outputText("Jojo has respawned.  ");
				flags[kFLAGS.JOJO_DEAD_OR_GONE] = 0;
			}
			doNext(resetNPCMenu);
		}

		private function resetEmber():void {
			clearOutput();
			outputText("Did you destroy the egg containing Ember? Want to restore the egg so you can take it?");
			doYesNo(reallyResetEmber, resetNPCMenu);
		}
		private function reallyResetEmber():void {
			clearOutput();
			if (flags[kFLAGS.EGG_BROKEN] > 0) {
				outputText("Egg is now restored. Go find it in swamp! And try not to destroy it next time.  ");
				flags[kFLAGS.EGG_BROKEN] = 0;
			}
			doNext(resetNPCMenu);
		}

		private function abortPregnancy():void {
			clearOutput();
			outputText("You feel as if something's dissolving inside your womb. Liquid flows out of your [vagina] and your womb feels empty now. You are no longer pregnant!");
			player.knockUpForce();
			doNext(accessDebugMenu);
		}

		//[Flag Editor]
		private function flagEditor():void {
			clearOutput();
			menu();
			outputText("This is the Flag Editor.  You can edit flags from here.  For flags reference, look at kFLAGS.as class file.  Please input any number from 0 to 2999.");
			outputText("\n\nWARNING: This might screw up your save file so backup your saves before using this!");
			mainView.nameBox.visible = true;
			mainView.nameBox.width = 165;
			mainView.nameBox.text = "";
			mainView.nameBox.maxChars = 4;
			mainView.nameBox.restrict = "0-9";
			addButton(0, "OK", editFlag);
			addButton(4, "Done", accessDebugMenu);
			mainView.nameBox.x = mainView.mainText.x + 5;
			mainView.nameBox.y = mainView.mainText.y + 3 + mainView.mainText.textHeight;
		}

		private function editFlag():void {
			var flagId:int = int(mainView.nameBox.text);
			clearOutput();
			menu();
			if (flagId < 0 || flagId >= 3000) {
				mainView.nameBox.visible = false;
				outputText("That flag does not exist!");
				doNext(flagEditor);
				return;
			}
			mainView.nameBox.visible = true;
			mainView.nameBox.x = mainView.mainText.x + 5;
			mainView.nameBox.y = mainView.mainText.y + 3 + mainView.mainText.textHeight;
			mainView.nameBox.maxChars = 127;
			mainView.nameBox.restrict = null;
			mainView.nameBox.text = flags[flagId];
			addButton(0, "Save", saveFlag, flagId);
			addButton(1, "Discard", flagEditor);
		}

		private function saveFlag(flagId:int = 0):void {
			var temp:* = Number(mainView.nameBox.text);
			if (temp is Number || temp is int) flags[flagId] = temp;
			else flags[flagId] = mainView.nameBox.text;
			flagEditor();
		}

		//------------
		// LIGHTS OUT
		//------------
		public var lightsOutVictoryFunction:Function;
		public var lightsOutFailureFunction:Function;

		public var lightsArray:Array;

		public function startLightsOut(victoryFunction:Function = null, failureFunction:Function = null):void
		{
			clearOutput();
			outputText("Test puzzle!");
			outputText("\n\nThis is the same type used in Stellar Tether bomb puzzle in TiTS.");

			if (victoryFunction == null) victoryFunction = accessDebugMenu;
			lightsOutVictoryFunction = victoryFunction;
			if (failureFunction == null) failureFunction = accessDebugMenu;
			lightsOutFailureFunction = failureFunction;

			menu();
			lightsArray = new Array();

			for (var i:int = 0; i < 15; i++)
			{
				lightsArray[i] = false;

				addButton(i, " ", toggleLight, i);
			}

			var onBts:Array = [1, 5, 6, 9, 10, 11, 12, 13];

			for (i = 0; i < onBts.length; i++)
			{
				lightsArray[onBts[i]] = true;

				addButton(onBts[i], "XXXXXXXX", toggleLight, onBts[i]);
			}
		}

		public function testVictoryFunc():void
		{
			clearOutput();
			outputText("A winner is you! A horsecock for your butt as tribute!");
			menu();
			addButton(0, "Next", accessDebugMenu);
		}

		public function testFailureFunc():void
		{
			clearOutput();
			outputText("You failed. Try again?");
			menu();
			addButton(0, "Yes", startLightsOut, testVictoryFunc, testFailureFunc);
			addButton(1, "No", accessDebugMenu);
		}

		public function toggleSlot(slot:int):void
		{
			lightsArray[slot] = !lightsArray[slot]

			if (lightsArray[slot])
			{
				//userInterface.setButtonPurple(slot);
				mainView.setButtonText(slot, "XXXXXXXX");
			}
			else
			{
				//userInterface.setButtonBlue(slot);
				mainView.setButtonText(slot, "");
			}
		}

		public function toggleLight(slot:int):void
		{
			toggleSlot(slot);
			toggleNearby(slot);

			var allOff:Boolean = true;
			var allOn:Boolean = true;

			for (var i:int = 0; i < 15; i++)
			{
				if (lightsArray[i] == 1) allOff = false;
				if (lightsArray[i] == 0) allOn = false;

			}
			if (allOn)
			{
				lightsOutFailureFunction();
			}
			if (allOff)
			{
				lightsOutVictoryFunction();
			}
		}

		public function toggleNearby(slot:int):void
		{
			var pX:int = slot % 5;
			var pY:int = slot / 5;

			if (pX > 0) toggleSlot(slot - 1);
			if (pX < 4) toggleSlot(slot + 1);
			if (pY > 0) toggleSlot(slot - 5);
			if (pY < 2) toggleSlot(slot + 5);
		}
	}

}


code:
//Anzu's Palace
package classes.Scenes.Dungeons
{
	import classes.*;
	import classes.GlobalFlags.kFLAGS;
	import classes.GlobalFlags.kGAMECLASS;
	import classes.BaseContent;
	import classes.Scenes.Dungeons.AnzuPalace.AnzuScene;
	import classes.Scenes.Dungeons.DungeonAbstractContent;
	import classes.Scenes.Dungeons.DungeonCore;

	public class AnzuPalace extends DungeonAbstractContent
	{
		/*
		//Floor 1
		public static const DUNGEON_ANZU_OUTSIDE = 39;
		public static const DUNGEON_ANZU_HALL_FLOOR1 = 40;
		public static const DUNGEON_ANZU_LIVING_ROOM = 41;
		public static const DUNGEON_ANZU_BATHROOM = 42;
		public static const DUNGEON_ANZU_DINING_ROOM = 43;
		public static const DUNGEON_ANZU_KITCHEN = 44;
		//Floor 2
		public static const DUNGEON_ANZU_HALL_FLOOR2 = 45;
		public static const DUNGEON_ANZU_BEDROOM = 46;
		public static const DUNGEON_ANZU_LIBRARY = 47;
		public static const DUNGEON_ANZU_MULTIUSE_ROOM = 48;
		//Floor 3
		public static const DUNGEON_ANZU_HALL_FLOOR3 = 49;
		public static const DUNGEON_ANZU_PALACE_VAULTS = 50;
		public static const DUNGEON_ANZU_ALCHEMY_ROOM = 51;
		//Roof
		public static const DUNGEON_ANZU_ROOF = 52;
		//Basement
		public static const DUNGEON_ANZU_BASEMENT = 53;
		public static const DUNGEON_ANZU_ARMORY = 54;
		*/
		public var anzuScene:AnzuScene = new AnzuScene();
		private var anzuLocationTimes:Array = []; //First is 12am. Uses room IDs.
		private var anzuLocationInitialized:Boolean = false;

		public function AnzuPalace() {
			if (!anzuLocationInitialized) {
				anzuLocationInitialized = true;
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_BEDROOM);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_BEDROOM);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_BEDROOM);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_BEDROOM);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_BEDROOM);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_BEDROOM);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_BEDROOM);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_KITCHEN);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_DINING_ROOM);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_LIVING_ROOM);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_LIVING_ROOM);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_LIVING_ROOM);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_KITCHEN);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_DINING_ROOM);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_LIBRARY);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_LIBRARY);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_LIBRARY);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_ROOF);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_LIVING_ROOM);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_KITCHEN);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_DINING_ROOM);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_BATHROOM);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_BEDROOM);
				anzuLocationTimes.push(DungeonCore.DUNGEON_ANZU_BEDROOM);
			}
		}

		public function enterDungeon():void {
			clearOutput();
			if ((flags[kFLAGS.ANZU_RELATIONSHIP_LEVEL] < 2 && flags[kFLAGS.ANZU_AFFECTION] >= 25) || (flags[kFLAGS.ANZU_RELATIONSHIP_LEVEL] < 3 && flags[kFLAGS.ANZU_AFFECTION] >= 50) || (flags[kFLAGS.ANZU_RELATIONSHIP_LEVEL] < 4 && flags[kFLAGS.ANZU_AFFECTION] >= 75)) {
				anzuScene.anzuTransition();
				return;
			}
			outputText(images.showImage("dungeon-entrance-palace"));
			kGAMECLASS.inDungeon = true;
			outputText("You make your way through the frigid climates and your memory takes you back to Anzu's palace.");
			doNext(roomEntrance);
		}

		private function exitDungeon():void {
			kGAMECLASS.inDungeon = false;
			outputText("You leave the palace behind and take off through the glacial rift back towards camp.", true);
			doNext(camp.returnToCampUseOneHour);
		}

		internal function setAnzuButton():void {
			if (kGAMECLASS.dungeonLoc == anzuLocationTimes[model.time.hours] && kGAMECLASS.dungeonLoc >= 39 && kGAMECLASS.dungeonLoc < 55) {
				addButton(0, "Anzu", anzuScene.anzuMenus, null, null, null, "Interact with Anzu the avian deity.");
			}
		}

		//ROOMS
		//Floor 1
		public function roomEntrance():void {
			kGAMECLASS.dungeonLoc = DungeonCore.DUNGEON_ANZU_OUTSIDE;
			outputText("Palace Grounds\n", true);
			outputText("The outsides of the palace look way different from how it was before Anzu’s arrival. Mostly covered in snow, but visible, instead of the original shape of a Norse castle made of stone, with the majolica tiles in a vibrant teal, and ornaments in gold covering the walls, and the new shape, looks more like a palace from ancient times. During the night, the lights from the inside contrast against the darkness of the Rift.");
			outputText("\n\nThe gate, in turquoise tiles, leads to a huge door made of solid iron which serves as the palace principal entrance. The area around the palace is mostly covered in snow and pines, except a small path made of stones, that lead to the bottom of the hill.");
			/*
			 * The exterior part of the Palaces exudes and otherworldly beauty. Now free of snow thanks to the more templated climate on this part of the Rift, you can appreciate better his magnificent architecture.
			 * The door, of double, reflects on itself the whiteness of silver.
			 * */
			dungeons.setDungeonButtons(roomFoyer, null, null, null);
			addButton(11, "Leave", exitDungeon);
		}
		public function roomFoyer():void {
			kGAMECLASS.dungeonLoc = DungeonCore.DUNGEON_ANZU_HALL_FLOOR1;
			outputText("Hall, Floor 1\n", true);
			outputText("You’re standing inside the first floor of Anzu’s Palace. A long hall, marked with a beautiful red rug and flanked with two rows of columns in golden marble, connecting all the rooms in this floor. Immediately near the start of the hall, to the west, is the living room.");
			outputText("\n\nTo the east you can see a dining room, with two wooden tables and chairs. Connected to the dining room from the north is the kitchen. Near the end of the hall, a door leads to the baths.");
			outputText("\n\nThe hall has a staircase located not far from the entrance, leading to the second floor, and another at the end, leading to the basement.");
			dungeons.setDungeonButtons(null, roomEntrance, roomLivingRoom, roomDiningRoom);
			addButton(5, "Upstairs", roomHallFloor2);
			addButton(7, "Downstairs", roomBasement);
		}
		public function roomLivingRoom():void {
			kGAMECLASS.dungeonLoc = DungeonCore.DUNGEON_ANZU_LIVING_ROOM;
			outputText("Living Room\n", true);
			outputText("Like most of the house, the living room is richly decorated. Golden columns with ornamented chapiters surround the area, with very colorful patterned decorations in silk hanging from them. The walls are decorated with mosaics in the shape of flowers and stars, made of semiprecious stones. The floor is made of mosaics and covered with some rugs.");
			outputText("\n\nAncient looking statues made of alabaster and beautiful vases containing violets decorate the area. The entire room is illuminated by a lamp hanging from the ceiling, with an almost white flame, bright enough to enlighten all the room. In the center, a big fireplace brings warmth to the place.");
			outputText("\n\nComfortable armchairs, with soft cushions, covered in red velvet provide a good place to rest. On the left part of the room, are several shelves containing books about the story of Mittani and other similar things.");
			outputText("\n\nTo the east is the hall which connects the rest of the rooms in this floor. In a corner, on the end of the room, leading to the north, a door leads to the baths.");
			dungeons.setDungeonButtons(roomBathroom, null, null, roomFoyer);
		}
		public function roomBathroom():void {
			kGAMECLASS.dungeonLoc = DungeonCore.DUNGEON_ANZU_BATHROOM;
			outputText("Bathroom\n", true);
			outputText("A central round pool, with almost thirty feet of diameter, dominates the center of the room. The warm water of the pool is so clear that you can see the light blue colored tiles of its bottom. Several columns in a light golden marble surround the pool, and give the room a cozy feeling. They’re eleven in total, now that you can count them well.");
			outputText("\n\nThe rest of the room is covered with light brown tiles on the floor and the lower part of the walls, and a pattern of golden tiles and gold inlaids on the upper walls, separated by a band of mosaics displaying fish in exotic colors, sea serpents and aquatic monsters of a kind that you can’t recognize.");
			outputText("\n\nSome lamps around the room keep the bath well illuminated, and a door to the south leads back to living room.");
			dungeons.setDungeonButtons(null, roomLivingRoom, null, null);
		}
		public function roomDiningRoom():void {
			kGAMECLASS.dungeonLoc = DungeonCore.DUNGEON_ANZU_DINING_ROOM;
			outputText("Dining Room\n", true);
			outputText("Two polished wooden tables, pretty large, occupy the center of the room. Surrounding them, between forty and fifty chairs give enough sitting room for a small army. Anzu must feel quite lonely when dining.");
			outputText("\n\nDecorating the corners are vases with violets, whose smell perfumes the air. The columns in golden marble and the colorful decorations in silk hanging from them complete the room atmosphere.");
			outputText("\n\nTo the north, there is a door that leads to the kitchen. Another, leading to the west, goes back to the principal hall.");
			dungeons.setDungeonButtons(roomKitchen, null, roomFoyer, null);
		}
		public function roomKitchen():void {
			kGAMECLASS.dungeonLoc = DungeonCore.DUNGEON_ANZU_KITCHEN;
			outputText("Kitchen\n", true);
			outputText("A big oven made of iron dominates the kitchen. To the sides many drawers contain a wide variety of cooking utensils. Knives, spoons, forks, dishes, glasses, all stored in their respective place. A place for cleaning the utensils and a stove have a place too on opposite sides of the kitchen.");
			outputText("\n\nIn the back of the room, a wooden door leads to the place where Anzu stores food. Inside are grains, bread, cheese, several crates containing wine, and in some containers, wrapped inside snow and ice, are big pieces of meat.");
			outputText("\n\nThe constant heat from the oven and the stove makes this room as warm as the bedroom or the living room.");
			dungeons.setDungeonButtons(null, roomDiningRoom, null, null);
		}
		//Floor 2
		public function roomHallFloor2():void {
			kGAMECLASS.dungeonLoc = DungeonCore.DUNGEON_ANZU_HALL_FLOOR2;
			outputText("Hall, Floor 2\n", true);
			outputText("The second floor is in U-shaped, with two different rooms on each side and one at the end. The remaining space is occupied by the staircases which go to the third floor and to the first floor, with the hall connecting the three rooms. This hall is decorated too with a red rug and golden columns.");
			outputText("\n\nThe room in the west is Anzu’s bedroom. A calm and peaceful sensation emanates from the door that leads to it.");
			outputText("\n\nThe room located at the end of the floor is the palace’s library and study. Judging by its size,  looks like Anzu brought with him half of books of Mittani.");
			outputText("\n\nAnzu has stated that the third room is not currently in use...");
			dungeons.setDungeonButtons(roomLibrary, null, roomBedroom, roomMultiuse);
			addButton(5, "Upstairs", roomHallFloor3);
			addButton(7, "Downstairs", roomFoyer);
		}
		public function roomBedroom():void {
			kGAMECLASS.dungeonLoc = DungeonCore.DUNGEON_ANZU_BEDROOM;
			outputText("Bedroom\n", true);
			outputText("The golden columns decorate this room too. More silken colorful decorations cover them, with the mosaics doing the same to the bedroom walls. In a similar fashion of the living room, vases with violets and alabaster statues complete the room ornaments, with some armchairs giving place of rest.");
			outputText("\n\nAnzu’s bed is huge, even for Marethian standards. Soft cushions and linen sheets cover the mattress. The bed itself releases an aromatic smell. You have the temptation of climb in and sleep on it all day.");
			outputText("\n\nAnother fireplace, smaller than the one in the living room, warms the place atmosphere.");
			dungeons.setDungeonButtons(null, null, null, roomHallFloor2);
		}
		public function roomLibrary():void {
			kGAMECLASS.dungeonLoc = DungeonCore.DUNGEON_ANZU_LIBRARY;
			outputText("Library\n", true);
			outputText("Many bookshelves filled with at least one thousand books occupy most of the walls. The ambience inside is quiet and peaceful. Some armchairs give a comfortable place to read. This books must’ve been the only friendly company of your avian friend in many years. ");
			outputText("\n\nOn the end of the place, is Anzu’s private study. A desk, a chair, some bookcases next to it. Nothing extraordinary.");
			outputText("\n\nTo the south is the exit to the hall, that connects all rooms in the third floor.");
			dungeons.setDungeonButtons(null, roomHallFloor2, null, null);
		}
		public function roomMultiuse():void {
			kGAMECLASS.dungeonLoc = DungeonCore.DUNGEON_ANZU_MULTIUSE_ROOM;
			outputText("Multi-use Room\n", true);
			outputText("This room used to be the bedroom of most of the Valkyries that used to live there. Since he has his own bedroom now, Anzu has little use for this room, and given his word, it remains empty. Actually, you could peek inside if you want...");
			outputText("\n\nYeah, empty. There is nothing else to do there that look the corners.");
			outputText("\n\nTo the south is the exit to the hall, that connects all rooms in the third floor.");
			dungeons.setDungeonButtons(null, null, roomHallFloor2, null);
		}
		//Floor 3
		public function roomHallFloor3():void {
			kGAMECLASS.dungeonLoc = DungeonCore.DUNGEON_ANZU_HALL_FLOOR3;
			outputText("Hall, Floor 3\n", true);
			outputText("This floor has a disposition similar to the second, with the only difference being only two rooms and a huge window which gives a great view of the snow covered hills and the forest across the Rift. The usual staircase leads down to the second floor and up to the roof.");
			outputText("\n\nTo the left is the treasure room, the place when probably half of Mareth treasures are stored.");
			dungeons.setDungeonButtons(null, null, roomVault, roomAlchemyRoom);
			addButton(5, "Upstairs", roomRoof);
			addButton(7, "Downstairs", roomHallFloor2);
		}
		public function roomVault():void {
			kGAMECLASS.dungeonLoc = DungeonCore.DUNGEON_ANZU_PALACE_VAULTS;
			outputText("Vault\n", true);
			outputText("As expected from a treasure room, it's filled to the brim with boxes of golden coins and jewels. Diamonds, rubies, amethysts, sapphires, alexandrites, name a jewel and you probably could find here in insane quantities.");
			outputText("\n\nGold objects, like plates, coins, goblets, chains, rings and utensils are stored in crates. Rugs and carpets are folded in many heaps in one corner. Bottles with aromatic oils are stored in shelves in another side of the room.");
			outputText("\n\nThe sources of the wealth in the palace’s vault is a mix of things which Anzu brought with him from Mittani and the loot which the avian took from the valkyries and other monsters which wandered in the Rift.");
			outputText("\n\nTo the east is a door leading back to the hall.");
			dungeons.setDungeonButtons(null, null, null, roomHallFloor3);
		}
		public function roomAlchemyRoom():void {
			kGAMECLASS.dungeonLoc = DungeonCore.DUNGEON_ANZU_ALCHEMY_ROOM;
			outputText("Alchemy Room\n", true);
			outputText("In the north of the room is a kind of desk, with many alchemical devices. Currently, are some metals made liquid, in an attempt to made an alloy. This is probably the place where Anzu creates electrum. A bookshelf containing books of alchemy is located close.");
			outputText("\n\nThe center of the room has what looks like a scale map from Mareth, the transmutation table, and the drawers containing ingredients are in the south of the room. Many concoctions and liquid metals are saved in shelves next to it.");
			outputText("\n\nOn the right side of the room is the combination . A sort of drawings in the floor in a concentric shape, which Anzu uses to make energy flow inside living or organic things to combinate, extract or infuse energy on them");
			outputText("\n\nA door that leads back to the hall is on the west.");
			dungeons.setDungeonButtons(null, null, roomHallFloor3, null);
		}
		//Roof
		public function roomRoof():void {
			kGAMECLASS.dungeonLoc = DungeonCore.DUNGEON_ANZU_ROOF;
			outputText("Roof\n", true);
			outputText("The view here is amazing! This places offers a magnificent sight of the sky above and the hills and forest around.");
			outputText("\n\nThe forest and the snow covered hills extend as far as the eye can see. The fresh air, though cold, bring you a peace which takes you away from the corruption and the horrors of this land for a moment.");
			dungeons.setDungeonButtons(null, null, null, null);
			addButton(7, "Downstairs", roomHallFloor3);
		}
		//Basement
		public function roomBasement():void {
			kGAMECLASS.dungeonLoc = DungeonCore.DUNGEON_ANZU_BASEMENT;
			outputText("Basement\n", true);
			outputText("A chariot dominates most of the open area of the basement. It's made of strong and sturdy wood, with a soft mattress and covered in silk. It doesn’t look like it’s designed to be pulled in a normal way, and judging by its nature and origin, probably moves by a magical force.");
			outputText("\n\nSome feet behind the chariot, a door leads to Anzu’s armory. Inside is a collection of swords, knives, spears, and blades big enough to equip a small army. ");
			dungeons.setDungeonButtons(null, null, roomArmory, null);
			addButton(5, "Upstairs", roomFoyer);
		}
		public function roomArmory():void {
			kGAMECLASS.dungeonLoc = DungeonCore.DUNGEON_ANZU_ARMORY;
			outputText("Armory\n", true);
			outputText("This room contains a collection of swords, knives, spears, and blades big enough to equip a small army. At the end is an ornate armor probably once worn by the elite valkyries. You don't think Anzu would like you taking it without his permission.");
			outputText("\n\nThere is a door leading back to the main basement room.");
			dungeons.setDungeonButtons(null, null, null, roomBasement);
		}
	}

}

license: unknown


code:
package classes.Scenes.Dungeons.D3
{
	import classes.BaseContent;
	import classes.Items.Consumables.SimpleConsumable;
	import classes.room;
	import classes.GlobalFlags.kFLAGS;
	import classes.GlobalFlags.kGAMECLASS;
	import classes.GlobalFlags.kACHIEVEMENTS;
	import classes.Scenes.Dungeons.Factory.IncubusMechanic;
	import classes.StatusEffects;
	import classes.PerkLib;
	import classes.CockTypesEnum;
	import classes.PregnancyStore;

	/**
	 * ...
	 * @author Gedan
	 */
	public class D3 extends BaseContent
	{
		public var rooms:Object = { };
		public var _currentRoom:String; // I don't think we'll need to save/load this, as we're not gonna allow saving in the dungeon, and it'll be overwritten by calling enterD3();

		public var jeanClaude:JeanClaudeScenes = new JeanClaudeScenes();
		public var doppleganger:DopplegangerScenes = new DopplegangerScenes();
		public var incubusMechanic:IncubusMechanicScenes = new IncubusMechanicScenes();
		public var livingStatue:LivingStatueScenes = new LivingStatueScenes();
		public var succubusGardener:SuccubusGardenerScenes = new SuccubusGardenerScenes();
		public var hermCentaur:HermCentaurScenes = new HermCentaurScenes();
		public var driderIncubus:DriderIncubusScenes = new DriderIncubusScenes();
		public var minotaurKing:MinotaurKingScenes = new MinotaurKingScenes();
		public var lethice:LethiceScenes = new LethiceScenes();

		public function D3()
		{
			configureRooms();
		}

		private function configureRooms():void
		{
			var tRoom:room;

			// Entrance
			tRoom = new room();
			tRoom.RoomName = "entrance";
			tRoom.EastExit = "tunnel1";
			tRoom.RoomFunction = entranceRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// Tunnel 1
			tRoom = new room();
			tRoom.RoomName = "tunnel1";
			tRoom.NorthExit = "antechamber";
			tRoom.WestExit = "entrance";
			tRoom.RoomFunction = tunnel1RoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// Antechamber
			tRoom = new room();
			tRoom.RoomName = "antechamber";
			tRoom.NorthExit = "magpiehalls";
			tRoom.EastExit = "roomofmirrors";
			tRoom.SouthExit = "tunnel1";
			tRoom.RoomFunction = antechamberRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// Room of Mirrors
			tRoom = new room();
			tRoom.RoomName = "roomofmirrors";
			tRoom.WestExit = "antechamber";
			tRoom.RoomFunction = roomofmirrorsRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// Magpie Hall S
			tRoom = new room();
			tRoom.RoomName = "magpiehalls";
			tRoom.NorthExit = "tunnel2";
			tRoom.SouthExit = "antechamber";
			tRoom.RoomFunction = magpiehallsRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// Magpie Hall N
			tRoom = new room();
			tRoom.RoomName = "magpiehalln";
			tRoom.NorthExit = "tunnel2";
			tRoom.SouthExit = "antechamber";
			tRoom.RoomFunction = magpiehallnRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// Tunnel 2
			tRoom = new room();
			tRoom.RoomName = "tunnel2";
			tRoom.EastExit = "edgeofkeep";
			tRoom.SouthExit = "magpiehalln";
			tRoom.RoomFunction = tunnel2RoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// Edge of Keep
			tRoom = new room();
			tRoom.RoomName = "edgeofkeep";
			tRoom.NorthExit = "northentry";
			tRoom.WestExit = "tunnel2";
			tRoom.RoomFunction = edgeofkeepRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// North Entry
			tRoom = new room();
			tRoom.RoomName = "northentry";
			tRoom.NorthExit = "southcourtyard";
			tRoom.SouthExit = "edgeofkeep";
			tRoom.RoomFunction = northentryRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// South Courtyard
			tRoom = new room();
			tRoom.RoomName = "southcourtyard";
			tRoom.SouthExit = "northentry";
			tRoom.EastExit = "southeastcourtyard";
			tRoom.WestExit = "southwestcourtyard";
			tRoom.RoomFunction = southcourtyardRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// South West Courtyard
			tRoom = new room();
			tRoom.RoomName = "southwestcourtyard";
			tRoom.EastExit = "southcourtyard";
			tRoom.NorthExit = "southwestwalk";
			tRoom.RoomFunction = southwestcourtyardRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// South West Walk
			tRoom = new room();
			tRoom.RoomName = "southwestwalk";
			tRoom.NorthExit = "westwalk";
			tRoom.SouthExit = "southwestcourtyard";
			tRoom.RoomFunction = southwestwalkRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// West Walk
			tRoom = new room();
			tRoom.RoomName = "westwalk";
			tRoom.NorthExit = "northwestwalk";
			tRoom.EastExit = "courtyardsquare";
			tRoom.SouthExit = "southwestwalk";
			tRoom.RoomFunction = westwalkRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// North West Walk
			tRoom = new room();
			tRoom.RoomName = "northwestwalk";
			tRoom.NorthExit = "northwestcourtyard";
			tRoom.SouthExit = "westwalk";
			tRoom.RoomFunction = northwestwalkRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// North West Courtyard
			tRoom = new room();
			tRoom.RoomName = "northwestcourtyard";
			tRoom.EastExit = "northcourtyard";
			tRoom.SouthExit = "northwestwalk";
			tRoom.RoomFunction = northwestcourtyardRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// North Courtyard
			tRoom = new room();
			tRoom.RoomName = "northcourtyard";
			tRoom.EastExit = "northeastcourtyard";
			tRoom.WestExit = "northwestcourtyard";
			tRoom.NorthExit = "throneroom";
			tRoom.NorthExitCondition = unlockedThroneRoom;
			tRoom.RoomFunction = northcourtyardRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// North East Courtyard
			tRoom = new room();
			tRoom.RoomName = "northeastcourtyard";
			tRoom.SouthExit = "northeastwalk";
			tRoom.WestExit = "northcourtyard";
			tRoom.RoomFunction = northeastcourtyardRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// North East Walk
			tRoom = new room();
			tRoom.RoomName = "northeastwalk";
			tRoom.NorthExit = "northeastcourtyard";
			tRoom.SouthExit = "eastwalk";
			tRoom.RoomFunction = northeastwalkRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// East Walk
			tRoom = new room();
			tRoom.RoomName = "eastwalk";
			tRoom.NorthExit = "northeastwalk";
			tRoom.SouthExit = "southeastwalk";
			tRoom.WestExit = "courtyardsquare";
			tRoom.RoomFunction = eastwalkRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// South East Walk
			tRoom = new room();
			tRoom.RoomName = "southeastwalk";
			tRoom.NorthExit = "eastwalk";
			tRoom.SouthExit = "southeastcourtyard";
			tRoom.RoomFunction = southeastwalkRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// South East Courtyard
			tRoom = new room();
			tRoom.RoomName = "southeastcourtyard";
			tRoom.NorthExit = "southeastwalk";
			tRoom.SouthExit = "greatlift";
			tRoom.WestExit = "southcourtyard";
			tRoom.RoomFunction = southeastcourtyardRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// Courtyard Square
			tRoom = new room();
			tRoom.RoomName = "courtyardsquare";
			tRoom.EastExit = "eastwalk";
			tRoom.WestExit = "westwalk";
			tRoom.RoomFunction = courtyardsquareRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			// Great Lift
			tRoom = new room();
			tRoom.RoomName = "greatlift";
			tRoom.NorthExit = "southeastcourtyard";
			tRoom.RoomFunction = greatliftRoomFunc;
			rooms[tRoom.RoomName] = tRoom;

			//FINAL ROOM: Throne Room
			tRoom = new room();
			tRoom.RoomName = "throneroom";
			tRoom.SouthExit = "northcourtyard";
			tRoom.RoomFunction = throneRoomFunc;
			rooms[tRoom.RoomName] = tRoom;
		}

		// Entrance/Exit

		public function discoverD3():Boolean
		{
			if (flags[kFLAGS.D3_DISCOVERED] == 0 && player.hasKeyItem("Zetaz's Map") >= 0 && rand(5) == 0)
			{
				flags[kFLAGS.D3_DISCOVERED] = 1;

				clearOutput();
				outputText("During your exploration, you come across a familiar looking patch of ground. In fact... you pull out Zetaz’s map, your eyes widening as they realize what you’ve just found: Lethice’s Keep. You follow a concealed trail past several harpy nests directly to an almost invisible cave entrance. You never would’ve found it without the map.");
				outputText("\n\nYou’ve discovered a hidden entrance to Lethice’s lair. It can be accessed from the Dungeons submenu in the future.");
				outputText("\n\nDo you step inside, or wait until you’re better prepared?");

				menu();
				addButton(0, "Enter", enterD3);
				addButton(1, "Leave", camp.returnToCampUseOneHour);

				return true;
			}
			return false;
		}

		public function enterD3():void
		{
			kGAMECLASS.dungeons.setDungeonButtons(); //Ensures the top buttons are visible.
			menu(); //Clear bottom buttons
			inRoomedDungeon = true;
			inRoomedDungeonResume = resumeFromFight;
			move("entrance");
		}

		public function exitD3():void
		{
			inRoomedDungeon = false;
			inRoomedDungeonResume = null;
			camp.returnToCampUseOneHour();
		}

		public function resumeFromFight():void
		{
			move(_currentRoom);
		}

		private function generateRoomMenu(tRoom:room):void
		{
			statScreenRefresh();
			hideUpDown();
			spriteSelect(-1);
			kGAMECLASS.dungeons.setTopButtons();
			if (tRoom.NorthExit != null && tRoom.NorthExit.length > 0)
			{
				if (tRoom.NorthExitCondition == null || tRoom.NorthExitCondition())
				{
					addButton(6, "North", move, tRoom.NorthExit, 1/12);
				}
			}

			if (tRoom.EastExit != null && tRoom.EastExit.length > 0)
			{
				if (tRoom.EastExitCondition == null || tRoom.EastExitCondition())
				{
					addButton(12, "East", move, tRoom.EastExit, 1/12);
				}
			}

			if (tRoom.SouthExit != null && tRoom.SouthExit.length > 0)
			{
				if (tRoom.SouthExitCondition == null || tRoom.SouthExitCondition())
				{
					addButton(11, "South", move, tRoom.SouthExit, 1/12);
				}
			}

			if (tRoom.WestExit != null && tRoom.WestExit.length > 0)
			{
				if (tRoom.WestExitCondition == null || tRoom.WestExitCondition())
				{
					addButton(10, "West", move, tRoom.WestExit, 1/12);
				}
			}

			if (tRoom.RoomName == "entrance")
			{
				addButton(10, "Exit", exitD3);
			}

			addButton(13, "Inventory", inventory.inventoryMenu);
			addButton(14, "Map", kGAMECLASS.dungeons.map.displayMap);
			if (player.lust >= 30) addButton(8, "Masturbate", getGame().masturbation.masturbateGo);
		}

		public function move(roomName:String, timeToPass:Number = 0):void
		{
			trace("Entering room", roomName);
			cheatTime(timeToPass);
			clearOutput();

			if (rooms[roomName] == undefined)
			{
				clearOutput();
				outputText("Error: Couldn't find the room indexed as: " + roomName);
				menu();
				return;
			}

			var tRoom:room = rooms[roomName];

			if (tRoom.RoomFunction == null)
			{
				outputText("Error: Room entry function for room indexed as '" + roomName + "' was not set.");
				return;
			}

			menu();

			if (!tRoom.RoomFunction())
			{
				generateRoomMenu(tRoom);
			}

			_currentRoom = roomName;
		}

		private function entranceRoomFunc():Boolean
		{
			outputText("Entrance Room\n");
			outputText("The inside of this cave is damp and dark, but it bears signs of frequent use. The map you got from Zetaz matches the curves of this winding passage exactly. There can be no doubt that this is the place, even though his map ends a short distance into the tunnel. Either he knew it would be a linear path or was so familiar with the territory that he didn’t think it was worth writing down. You can go east, deeper into the mountain towards Lethice’s fortress, or leave to the west.");
			return false;
		}

		private function tunnel1RoomFunc():Boolean
		{
			outputText("Tunnel 1\n");
			outputText("Winding back and forth, the tunnel gradually arcs west and north from here, sloping steeply upward in the latter direction. The upward sloping side must lead to Lethice’s fortress, supposedly at the top of the mountain. You’ll have to be careful down here. You doubt that such an entrance would be completely unguarded. As a matter of fact... you think you can see signs of worked stone to the north. You’re getting close to something.");
			return false;
		}

		private function antechamberRoomFunc():Boolean
		{
			outputText("Antechamber\n");
			outputText("You are standing in a large, gloomy lobby, lit by the drear yellow pulse of gas lamps. The walls, floor and distant ceiling are uniformly built from a dark, aged stone which serves to make the vault-like space shadowy and oppressive, despite its size. The floor has been polished a dull bronze by years of use and the distant sound of activity permeates the air; it has the atmosphere of a place which is thronged with people during rush hour but is for now as deserted as a school corridor during class hours. Something to be grateful for perhaps, but you should get a move on.");

			outputText("\n\nAhead is a large archway. Through it you can see some sort of dark screen set into a wall. On the right is a much smaller metal door, which looks like it might be a storage room.");
			return false;
		}

		private function roomofmirrorsRoomFunc():Boolean
		{
			outputText("Room of Mirrors\n");
			outputText("The metal door opens soundlessly onto a fairly large, unlit room, shabby and grey with disuse. It is cluttered with a great quantity of mirrors. Round hand mirrors are stacked on shelves, square wall mirrors are leant against walls, a large,");
			if (flags[kFLAGS.D3_MIRRORS_SHATTERED] == 1) outputText(" now shattered,");
			outputText(" ornate standing mirror dominates the center of the room, and a number of broken, jagged specimens are stacked near the back. They reflect the dull trappings of this place back at you emptily. You guess as self-centred a race as the demons probably has quite a large use for these.");

			if (player.hasKeyItem("Laybans") >= 0)
			{
				outputText("\n\nThe place feels hollow and creepy, even after the ad hoc exorcism you performed here. There is no reason to linger.");
			}
			else
			{
				outputText("\n\nNear the back, next to the broken stack is a white stand, displaying what appear to be a number of dark shades.");
				if (flags[kFLAGS.D3_ENTERED_MAGPIEHALL] == 1) outputText("  Your spirits rise. They look like they may very well be made of the same material as the screen in the basilisk hall.");
				if (player.inte >= 70 || player.sens >= 70) outputText("  Disquiet edges down your spine. Something about this place doesn’t feel right. The room seems faded at the corners, as if it’s not quite there.");

				addButton(2, "Glasses", doppleganger.getDemGlasses);
			}

			return false;
		}

		private function magpiehallsRoomFunc():Boolean
		{
			outputText("Magpie Hall\n");
			if (flags[kFLAGS.D3_JEAN_CLAUDE_DEFEATED] == 0)
			{
				if (flags[kFLAGS.D3_ENTERED_MAGPIEHALL] == 0)
				{
					flags[kFLAGS.D3_ENTERED_MAGPIEHALL] = 1;
					outputText("You creep through the archway. The sound of movement and bustle is closer here; it seems to be coming from directly below you. Ahead is the screen, a large window made from tinted glass. Cautiously you peer through it. You have entered a vast hall, near the very top of it; this seems to be some sort of observation booth set high in the stone wall. It’s designed in the grand, classical tradition, fluted balustrades flanking the walls, each decorated at the top by a carved magpie in flight. Below is - well. You blink, trying to take it all in.");

					outputText("\n\nMany feet below the hall swarms with activity: tall, thin, grey-green reptiles sliding sinuously around each other and the long tables that run the length of the room. There must be hundreds, no, at least a thousand basilisks down there, carrying, analyzing, sorting the vast amount of junk the tables are heaped with.");
					if (flags[kFLAGS.BENOIT_AFFECTION] == 100) outputText("  This can only be the hall that " + getGame().bazaar.benoit.benoitMF("Benoit", "Benoite") + " once worked in.");
					outputText("  You get the fright of your life when you think you see a number of depthless pools of grey revolve up to meet yours- but they don’t freeze you, you note as you reflexively turn away. The tinted glass must carry some sort of anti-petrifying charm, and further it must be reflective on the other side, because no one below seems to realize you’re standing there. Relaxing a bit, you continue to absorb the massive room. At the end furthest away from you two huge piles have been created- one of eggs, a massed assortment of every color and size imaginable, and one of pure junk, presumably everything the basilisks have found whilst scavenging and considered worth keeping. The detritus of a dozen collapsed civilizations must be down there, collected for the demons’ perusal by their scaly custodians. Directly below you, you can see archways like the one you just passed under, through which the basilisks ebb and flow.");

					outputText("\n\nYour heartbeat quickens as you consider. There is a grid gantry running from where you are right around the room to the other side, where you can see a matching observation booth, presumably containing another exit. But it’s quite a distance, there are stairs leading down to the ground level, and outside the protective glass you would surely be spotted and apprehended");
					if (player.canFly()) outputText(", even if you tried to fly it");
					outputText(". Wouldn’t you? You can’t outrun the gaze of a thousand basilisks... could you?");
					if (player.hasKeyItem("Laybans") >= 0) outputText("  You take the Laybans out of your pouch and hold them up against the glass. It’s exactly as you hoped - they are made of the same material, and are almost certainly what the demons wear when they themselves interact with the basilisks. They would surely help you get across the hall, if you were crazy enough to try.");
				}
				else
				{
					outputText("Again you creep up to the tinted glass, again you take in the vast hall with the army of basilisks below hard at work, and again you stare out at the metal gantry, with the exit tantalizingly visible on the other side.");
					if (player.hasKeyItem("Laybans") < 0) outputText("  Are you going to try this?");
					else outputText("  You take the Laybans out of your pocket, turning them around in your hands as you consider. Are you going to try this?");
				}

				menu();
				addButton(0, "Go!", jeanClaude.gogoFuckTheseBasilisks);
				addButton(1, "Fall Back", fallbackFromMagpieHallS);

				return true;
			}

			outputText("You are back in the southern end of the Magpie Hall.  Without the bustle of activity below it is a gapingly empty and quiet place, the only sound the murmur of activity from elsewhere. There is a vast amount of collected junk below but it would take, well, an army of basilisks to sort through it to find anything worthwhile. You could check out the massive pile of eggs, though.");

			if (eggsAvailable() > 0)
			{
				addButton(2, "Eggs", goToEggPile);
			}

			return false;
		}

		private const BLACK:int = 1 << 0;
		private const BLUE:int = 1 << 1;
		private const WHITE:int = 1 << 2;
		private const PINK:int = 1 << 3;
		private const BROWN:int = 1 << 4;
		private const PURPLE:int = 1 << 5;

		private function eggsAvailable():int
		{
			var flagNum:int = flags[kFLAGS.D3_EGGS_AVAILABLE];

			var eggs:int = 0;

			if (!(flagNum & BLACK)) eggs++;
			if (!(flagNum & BLUE)) eggs++;
			if (!(flagNum & WHITE)) eggs++;
			if (!(flagNum & PINK)) eggs++;
			if (!(flagNum & BROWN)) eggs++;
			if (!(flagNum & PURPLE)) eggs++;

			return eggs;
		}

		private function goToEggPile():void
		{
			clearOutput();
			outputText("You head down the stairs into the hall proper to inspect the ramble hoard of eggs the basilisks collected. They’re mostly unfertilised harpy ovum, but you quickly pick out a number of differently coloured transformative eggs stolen from Gods know who.");

			menu();

			var flagNum:int = flags[kFLAGS.D3_EGGS_AVAILABLE];

			if (!(flagNum & BLACK)) addButton(0, "Black", takeEgg, BLACK);
			if (!(flagNum & BLUE)) addButton(1, "Blue", takeEgg, BLUE);
			if (!(flagNum & WHITE)) addButton(2, "White", takeEgg, WHITE);
			if (!(flagNum & PINK)) addButton(3, "Pink", takeEgg, PINK);
			if (!(flagNum & BROWN)) addButton(4, "Brown", takeEgg, BROWN);
			if (!(flagNum & PURPLE)) addButton(5, "Purple", takeEgg, PURPLE);

			addButton(14, "Back", resumeFromFight);
		}

		private function takeEgg(eggMask:int):void
		{
			var item:SimpleConsumable;

			if (eggMask == BLACK) item = consumables.L_BLKEG;
			if (eggMask == BLUE) item = consumables.L_BLUEG;
			if (eggMask == WHITE) item = consumables.L_WHTEG;
			if (eggMask == PINK) item = consumables.L_PNKEG;
			if (eggMask == BROWN) item = consumables.L_BRNEG;
			if (eggMask == PURPLE) item = consumables.L_PRPEG;

			//menuLoc = 9999;
			// Should actually be handled by the fallthrough of doNext(1) in the takeItem shit

			clearOutput();
			outputText("You pluck out " + item.longName + " ");

			flags[kFLAGS.D3_EGGS_AVAILABLE] += eggMask;
			inventory.takeItem(item, playerMenu); //playerMenu is equivalent to doNext(1)
		}

		private function fallbackFromMagpieHallS():void
		{
			clearOutput();
			outputText("No, there has to be a better way.");
			if (player.hasKeyItem("Laybans") < 0 && player.inte >= 50) outputText("  Surely the demons themselves are not immune to the basilisks’ glares - the darkened screen is proof of that. How do they interact with the creatures, then? Maybe if you keep poking around, you might find an answer.");
			outputText("\n\nYou head back through the archway into the gloomy antechamber.");

			menu();
			addButton(1, "Next", move, "antechamber");
		}

		private function magpiehallnRoomFunc():Boolean
		{
			outputText("Magpie Hall\n");
			if (flags[kFLAGS.D3_JEAN_CLAUDE_DEFEATED] == 0)
			{
				outputText("You find yourself back in the small booth, with the locked door leading out into the Magpie Hall. Just like the one on the opposite side, there is a darkened screen here through which you can see hundreds of basilisks milling down below, sorting through the vast amount of junk and eggs they have collected from the mountainside. They don’t seem to have taken any extra precautions following your narrow escape of them- the gantry remains free of any guards, and the door on the other side looks open.");

				menu();

				addButton(0, "Go!", jeanClaude.gogoFuckTheseBasilisksNorth);
				addButton(1, "Stronghold", move, "tunnel2");

				return true;
			}

			outputText("You are back in the northern end of the Magpie Hall. Without the bustle of activity below it is a gapingly empty and quiet place, the only sound the murmur of activity from elsewhere. There is a vast amount of collected junk below but it would take, well, an army of basilisks to sort through it to find anything worthwhile. You could check out the massive pile of eggs, though.");

			if (eggsAvailable() > 0)
			{
				addButton(2, "Eggs", goToEggPile);
			}

			return false;
		}

		private function tunnel2RoomFunc():Boolean
		{
			outputText("Tunnel 2\n");
			outputText("Light trickles in from the east. After all the trekking through these subterranean holes, you’ve got to be close to the mountain’s summit. You know that down the steeply sloped passage will take you back through the basilisks’ chamber if you want to leave the way you came, but a second trip through that crowded hall might be ill-advised. It’d be best to move forward into the sun.");
			return false;
		}

		private function edgeofkeepRoomFunc():Boolean
		{
			outputText("Edge of Keep\n");
			outputText("Standing on the edge of the mountain's summit, you can see Mareth for miles in all direction. It's fairly disconcerting to focus on long with the constant shifting and twisting of the wasted areas, but here and there you can pick out islands of stability in the ephemeral terrain. You blink your eyes to clear the nauseating landscape from your view and turn back to the way ahead. Lethice's fortress lies a short distance to the north, its walls tall and stout. The gates themselves hang open. Likely she didn't expect anyone to make it this far.");
			return false;
		}

		private function northentryRoomFunc():Boolean
		{
			outputText("North Entry\n");
			outputText("You now stand in the archway that is the southern entrance to Lethice's headquarters. The place is built like a castle. You can't see too much from your shaded position, but the bricks that surround you are individual as big as horses. The gates themselves are crafted of wood that looks at least a century old, reinforced with bands of gleaming metal that you doubt will ever rust. A barren cliffside can be seen to the south, the demon queen's lair to the north.");
			return false;
		}

		private function southcourtyardRoomFunc():Boolean
		{
			outputText("South Courtyard\n");
			outputText("Lethice's courtyard is surprisingly well-groomed for a place that's supposedly home to neverending debauchery and depravity. The paths are laid with interconnecting sandstone bricks that reflect the sun to give the place a gentle, amber glow, and lush, green grass lines the sides along with well-trimmed hedges. You could almost mistake this place for a churchyard if it wasn't for the faint sound of moans on the wind. The courtyard paths lead away east and west, while the gateway out hangs open to the south.");
			return false;
		}

		private function southwestcourtyardRoomFunc():Boolean
		{
			outputText("Southwest Courtyard\n");
			outputText("Some of the nearby bushes are blooming, filling the air with their sweet scent, unlike any flowers you’ve encounter before. Their petals are a multitude of colors, and their scents, though laced with corruption, are as sweet and pleasant as anything you've had the pleasure of smelling. The path you're treading upon curves north and east from here along the thick, red walls. Vines seem to crowd the way to the north. There are no signs of any ramps or ladders to get to the battlements, but there is a doorway to the west marked as 'Forge Wing'. A notice declares it closed for repairs.");
			return false;
		}

		private function southwestwalkRoomFunc():Boolean
		{
			outputText("Southwest Walk\n");
			outputText("The bushes surrounding the path have given way here to a mass of tentacles, some still bedecked in the flowers that surround the air. They twist and writhe but seem content to stay in their place for now. Besides, if you hang back along the edge of the walk, you should be out of their reach. The path heads north and south... if the wall of oily-looking tendrils leaves you alone.");

			if (flags[kFLAGS.D3_GARDENER_DEFEATED] == 0)
			{
				outputText("\n\nThe slick foilage parts just ahead, revealing a lissom leg clad in green hosiery that resembles the spiderwork patterns of leafy veins more than any garment. Its owner follows but a moment later, so perfectly, wonderfully shapely that you freeze in place, compelled by biology to take notice. Her expansive bosom, womanly hips, and gentle, soft curves invite you to fall into her embrace. Her lips, full and pouting, beckon for you to taste them. Her hair's lustrous shine glitters like an angler fish's lure, just out of reach and oh so foolish to pursue. The smooth, twists of her ram-like horns keep her coiffure stylish while simultaneously jolting you out of your reverie.");

				outputText("\n\nYou shake your head to regain your focus. This is a demon, and you won't fall for her tricks this easily");

				if (player.lust <= 75) // I'm not sure what this variation was supposed to point at specifically.
				{
					outputText("!");
				}
				else
				{
					outputText(".... You grope yourself absentmindedly as you consider just how long you'll hold out before submitting. It won't be long.");
				}

				outputText("\n\n\"Why hello there,\" the corrupt temptress says with a tone that's the auditory equivalent to a pat on the head. \"You must be [name]. Did you come all this way just to join my garden?\" The corner of the succubus' mouth curls ever so slightly, her lips gleaming invitingly. \"Or perhaps you could be my first non-floral pet. Would you like that?\" She arches her back to present her breasts to you, held aloft by their own incredible, perfect shape and framed by a skimpy underbust covering that only serves to highlight her hard, perky nipples. They gleam with moisture - milk you suppose.");

				outputText("\n\nShe smiles encouragingly. \"What'll it be?\"");

				//[Surrender] [Fight]
				menu();
				addButton(0, "Fight", startCombatImmediate, new SuccubusGardener());
				addButton(1, "Surrender", succubusGardener.surrenderToTheGardener);

				return true;
			}

			return false;
		}

		private function westwalkRoomFunc():Boolean
		{
			outputText("West Walk\n");
			outputText("Pollen clings to you, released by the many flowering bushes in the area. They only grow thicker to the south, too. To the east, you can");
			if (flags[kFLAGS.D3_STATUE_DEFEATED] == 0) outputText(" see a massive statue with an immense hammer");
			else outputText(" a mound of rubble, the scattered remains of the animated statue that you slew");
			outputText(". The warm, sandstone bricks underfoot fork in a T-intersection, leading north, east, and south. The thick castle walls prevent passage to the west.");

			return false;
		}

		private function northwestwalkRoomFunc():Boolean
		{
			outputText("Northwest Walk\n");
			outputText("A narrow path splits from the sandstone thoroughfare towards a pair of double doors to the west. The craftsmanship of the carpenter who made them is on full display; intricate designs of dragons engaged in sexual positions of all kinds are carved around the outer edges of the frame while more mundane, eye-pleasing patterns decorate the center panels. Above, a sign designates this area as the library. Unfortunately the doors are sealed closed. Perhaps the library is not yet written. You smirk at your own joke.");
			outputText("\n\nThe courtyard itself continues much as it has elsewhere. The bushes to the south appear more unruly than elsewhere, but to the north there appears to be nothing but pleasant walking through this botanical paradise.");
			return false;
		}

		private function northwestcourtyardRoomFunc():Boolean
		{
			outputText("Northwest Courtyard\n");
			outputText("The courtyard comes to an abrupt end here, hemmed in by a impressively high stone wall to the north, high enough to shame the walls in the other cardinal directions. The path is also bounded in by stonework to the west, forcing it to curve to the east and south around a bush that has been tastelessly shaped to resemble a turgid prick. The demons even went so far as to trim ivory flowers into a contiguous path along one side, very much looking like a stream of arboreal spunk.");
			return false;
		}

		private function northcourtyardRoomFunc():Boolean
		{
			outputText("North Courtyard\n");
			outputText("You stand before what can only be the entrance to Lethice’s throne room. It is unlabelled, but the immense door is unlike any you’ve seen in this world or the last. Constructed from some kind of pink-tinged metal and polished to a mirror sheen, this portal has had a lifetime of care poured into it. What’s more, intricate locking mechanisms overlap the edges of it, each one culminating in an intricately worked seal. Fortunately, each of the seals has been left over. Security must not be much of a concern for the demon queen at this point in time. ")
			if (flags[kFLAGS.D3_GARDENER_DEFEATED] > 0 && flags[kFLAGS.D3_CENTAUR_DEFEATED] > 0 && flags[kFLAGS.D3_STATUE_DEFEATED] > 0) {
				outputText("The seal appears to be broken. You could move north and attempt to defeat Lethice for once and for all. Or you can move east and west through the courtyard, if you like.");
			}
			else {
				outputText("If only the door would open. For some reason, it’s still sealed closed. You can still move east and west through the courtyard, if you like.");
			}
			return false;
		}

		private function northeastcourtyardRoomFunc():Boolean
		{
			outputText("Northeast Courtyard\n");
			outputText("This particular corner of the courtyard feels remarkably cramped, even a little claustrophobic. To the north, a stone wall rises, dwarfing the smaller one to the east, and to make matters worse, the hedges to the southwest are high and square, virtually a wall in their own right. The only avenues of travel available are to the south or west, following the red sandstone bricks as they bend around the corner.");

			if (flags[kFLAGS.D3_CENTAUR_DEFEATED] == 0)
			{
				hermCentaur.encounterThePony();
				return true;
			}

			return false;
		}

		private function northeastwalkRoomFunc():Boolean
		{
			outputText("Northeast Walk\n");
			outputText("The air is pleasant and free here. Not even the corrupt nature of this place can stop you from enjoying this moment in the demon queen’s garden. Still, there is an aura of lingering danger here. The flowers smell pleasant but somehow off, and every now and again the breezes carry the sounds of whorish moans. An entryway in the east wall leads towards the barracks and mess, identified by a simple sign to the left of the imposing iron door frame. Fortunately, the door is barred and sealed. It seems you’ve come at a time when Lethice’s fortress is near empy. How fortunate for you.");
			return false;
		}

		private function eastwalkRoomFunc():Boolean
		{
			outputText("East Walk\n");
			outputText("The smooth, almost flawlessly laid stones split into a T-intersection here, heading north, south, and west. The bushes that hem in the paths are likewise split, though they have been maintained with the same sense of care you’ve seen elsewhere in the garden. One particularly interesting shrub has been trimmed into the shape of a large bust, complete with erect nipples. You shake your head and glance west, where you can spot");
			if (flags[kFLAGS.D3_STATUE_DEFEATED] == 0) outputText(" a massive statue with an immense hammer.");
			else outputText(" a mound of rubble, the scattered remains of the animated statue that you slew.");
			return false;
		}

		private function southeastwalkRoomFunc():Boolean
		{
			outputText("Southeast Walk\n");
			outputText("Swarms of butterflies congregate on the flowering bushes here. At first, the sight seems beautiful, almost pristine. Then, you spot the endemic corruption that Lethice has spread through the lands. They aren’t just swarms of butterflies - they’re swarms of mating butterflies, crawling all over each other in a swarm of sweet-smelling pollen and fluttering wings. You had best move on. The path leads north and south.");
			return false;
		}

		private function southeastcourtyardRoomFunc():Boolean
		{
			outputText("Southeast Courtyard\n");
			outputText("Walking along the sandstone path, you're treated to a remarkably peaceful view. Up here, above the clouds the ring the mountain, it's almost too easy to let your guard down. A small hole in the southern wall of Lethice's fortress appears to the south. Peeking through, you can see machinery and some kind of lift suspended over the cliffside. That must be how the demons can come and go safely. You can continue to walk among the bushes to the north and west. An iron door to the east bears lettering denoting it as 'recreation'. A small placard explains that it's currently off limits due to renovations. Graffiti below complains about some contractor named Fenoxo delivering on his promised work schedule.");
			return false;
		}

		// 9999 - Check this
		private function courtyardsquareRoomFunc():Boolean
		{
			outputText("Courtyard Square\n");
			//Statue not exploded - mossy - 30’ high
			outputText("A circle of polished stone wraps around a colossus here in the center of the courtyard, ringed by cushioned benches that would be a delight to sit on were they not stained with bodily fluids of all colors and sexes. You didn’t think pink cum was possible, but the demons’ endless sexual creativity doesn’t seem to be bound by such notions. You can leave east and west from here.");

			if (flags[kFLAGS.D3_STATUE_DEFEATED] == 0)
			{
				outputText("\n\nWait... what’s that?");

				menu();
				addButton(0, "Next", livingStatue.encounter);
				return true;
			}

			outputText("Two disembodied, marble feet and a field of rubble are all that remains of the once proud statue that stood in the center of the courtyard. You dealt with the animated monstrosity but can’t help but feel a little shame at the destruction you’ve so openly wrought. Many of the bushes are torn in half by two ton slabs, and the path is scarred in a dozen places by chips and smashed divots. You can go east and west from here, if you move carefully around the more jagged pieces of stone.");

			return false;
		}

		private function greatliftRoomFunc():Boolean
		{
			outputText("Great Lift\n");
			outputText("Intricate stonework supports this precarious platform as it juts from the side of Lethice's fortress, hanging over a sheer cliff that must go down for hundreds of feet. The harpies appear to have moved away from the area immediately below, whether by choice or by demonic action, though you can still spot a few of their nests in other places on the mountainside. A complicated looking machine sits on the side of the platform, attached to a cage that dangles over the edge, supported by a lowly metal cable. It must be some kind of mechanical lift - a way to come and go as one would please.");

			incubusMechanic.meetAtElevator();

			return false;
		}

		private function throneRoomFunc():Boolean
		{
			if (flags[kFLAGS.DRIDERINCUBUS_DEFEATED] == 0) {
				driderIncubus.encounterDriderIncbutt();
				return true;
			}
			if (flags[kFLAGS.MINOTAURKING_DEFEATED] == 0) {
				minotaurKing.encounterMinotaurKing();
				return true;
			}
			if (flags[kFLAGS.LETHICE_DEFEATED] == 0) {
				lethice.encounterLethice();
				return true;
			}
			else
			{
				outputText("Throne Room\n");
				outputText("The throne room is intricately designed. Purple carpet with red highlights line the floor from the door to the throne. The throne appears to be carved in marble and dotted with lethicite. Along the way, there are beautifully carved marble columns and cum fountains. You blush just by looking at the fountains. ");
				if (flags[kFLAGS.LETHICITE_ARMOR_TAKEN] <= 0 && player.newGamePlusMod() > 0) {
					outputText("\n\nThere is still a suit of lethicite armor Lethice worn when you battled her, in good condition. You could take it if you like. ");
					addButton(0, "Take Armor", lethice.takeLethiciteArmor, null, null, null, armors.LTHCARM.description);
				}
			}
			return false;
		}

		public function unlockedThroneRoom():Boolean
		{
			return (flags[kFLAGS.D3_GARDENER_DEFEATED] > 0 && flags[kFLAGS.D3_CENTAUR_DEFEATED] > 0 && flags[kFLAGS.D3_STATUE_DEFEATED] > 0);
		}
	}
}