code:
package classes.Items
{
	import classes.*;
	import classes.GlobalFlags.kFLAGS;

	/**
	 * Helper class to get rid of the copy&paste-mess in classes.Items.Mutations
	 * @since July 8, 2016
	 * @author Stadler76
	 */
	public class MutationsHelper extends BaseContent
	{
		include "../../../includes/appearanceDefs.as";

		public var changes:int = 0;
		public var changeLimit:int = 1;

		public function MutationsHelper() {}

		public function restoreArms(tfSource:String):int
		{
			trace('called restoreArms("' + tfSource + '")');
			var message:String = "";

			if (tfSource == "gooGasmic") {
				// skin just turned gooey. Now lets fix unusual arms.
				var hasClaws:Boolean = player.clawType != CLAW_TYPE_NORMAL;

				message = "\n\n";
				if (player.armType == ARM_TYPE_HARPY) {
					message += "The feathers on your arms melt back into your now gooey skin.";
					if (hasClaws) message += " Additionally your now gooey claws melt back into your fingers.";
				} else if (hasClaws) {
					message += "Your now gooey claws melt back into your fingers.";
				}

				if (hasClaws) message += " Well, who cares, gooey claws aren't very useful in combat to begin with.";
				if (hasClaws || player.armType == ARM_TYPE_HARPY) output.text(message + "  You have normal human arms again.");

				updateClaws();
				player.armType = ARM_TYPE_HUMAN;
				return 1;
			}

			if (changes < changeLimit && player.armType != ARM_TYPE_HUMAN) {
				if ([ARM_TYPE_HARPY, ARM_TYPE_SPIDER, ARM_TYPE_SALAMANDER].indexOf(player.armType) >= 0)
					message += "\n\nYou scratch at your biceps absentmindedly, but no matter how much you scratch, it isn't getting rid of the itch.";

				switch (player.armType) {
					case ARM_TYPE_HARPY:
						message += "  Glancing down in irritation, you discover that your feathery arms are shedding their feathery coating."
						          +"  The wing-like shape your arms once had is gone in a matter of moments, leaving [skinfurscales] behind.";
						break;

					case ARM_TYPE_SPIDER:
						message += "  Glancing down in irritation, you discover that your arms' chitinous covering is flaking away."
						          +"  The glossy black coating is soon gone, leaving [skinfurscales] behind.";
						break;

					case ARM_TYPE_SALAMANDER:
						message += "  Glancing down in irritation, you discover that your once scaly arms are shedding their scales and that"
						          +" your claws become normal human fingernails again.";
						break;

					case ARM_TYPE_PREDATOR:
						switch (player.skinType) {
							case SKIN_TYPE_GOO:
								if (player.clawType != CLAW_TYPE_NORMAL)
									message += "\n\nYour gooey claws melt into your fingers."
									          +" Well, who cares, gooey claws aren't very useful in combat to begin with.";
								break;

							case SKIN_TYPE_PLAIN:
							case SKIN_TYPE_FUR:
							case SKIN_TYPE_SCALES:
								message += "\n\nYou feel a sudden tingle in your [claws] and then you realize,"
								          +" that they have become normal human fingernails again.";
								break;
						}
						break;

					default:
						message += "\n\nYour unusual arms change more and more until they are normal human arms, leaving [skinfurscales] behind.";
				}
				output.text(message + "  You have normal human arms again.");
				updateClaws();
				player.armType = ARM_TYPE_HUMAN;
				changes++;
				return 1;
			}

			return 0;
		}

		public function restoreLegs(tfSource:String):Boolean
		{
			trace('called restoreLegs("' + tfSource + '")');
			var doRestore:Boolean = false;
			var tsParts:Array = tfSource.split("-");
			tfSource = tsParts[0];

			//(Centaurs -> Normal Human Legs)
			if (player.isTaur()) {
				outputText("\n\nYour quadrupedal hind-quarters seizes, overbalancing your surprised front-end and causing you to stagger and fall to your side.  Pain lances throughout, contorting your body into a tightly clenched ball of pain while tendons melt and bones break, melt, and regrow.  When it finally stops, you look down to behold your new pair of human legs!");
				doRestore = true;
			}

			//(Goo -> Normal Human Legs)
			if (player.isGoo()) {
				outputText("\n\nYour lower body rushes inward, molding into two leg-like shapes that gradually stiffen up.  In moments they solidify into normal-looking legs, complete with regular, human feet.  You now have normal feet!");
				doRestore = true;
			}

			//(Naga -> Normal Human Legs)
			if (player.isNaga()) {
				outputText("\n\nYou collapse as your sinuous snake-tail tears in half, shifting into legs.  The pain is immense, particularly where your new feet are forming.  You have human legs again.");
				doRestore = true;
			}

			//(Drider -> Normal Human Legs)
			if (tfSource != "sweetGossamer" && player.isDrider()) {
				outputText("\n\nYour legs buckle under you and you fall, smashing your abdomen on the ground."
				          +"  Though your control deserts and you cannot see behind you,"
				          +" still you feel the disgusting sensation of chitin loosening and sloughing off your body,"
				          +" and the dry breeze on your exposed nerves."
				          +"  Reflexively, your legs cling together to protect as much of their now-sensitive surface as possible."
				          +"  When you try to part them, you find you cannot."
				          +"  Several minutes pass uncomforably until you can again bend your legs,"
				          +" and when you do, you find that all the legs of a side bend together.");
				outputText("  You have human legs again.");
				doRestore = true;
			}

			//(Non-human -> Normal Human Legs)
			if (tfSource == "regularHummus" && player.isBiped() && player.lowerBody != LOWER_BODY_TYPE_HUMAN) {
				outputText("\n\nYou collapse as your legs shift and twist.  By the time the pain subsides, you notice that you have normal legs and normal feet.  You now have normal feet!");
				doRestore = true;
			}

			if (doRestore) {
				player.lowerBody = LOWER_BODY_TYPE_HUMAN;
				player.legCount = 2;
				changes++;
				return true;
			}

			return false;
		}

		public function removeFeatheryHair():Boolean
		{
			if (changes < changeLimit && player.hairType == HAIR_FEATHER && rand(4) == 0) {
				//(long):
				if (player.hairLength >= 6) outputText("\n\nA lock of your downy-soft feather-hair droops over your eye.  Before you can blow the offending down away, you realize the feather is collapsing in on itself.  It continues to curl inward until all that remains is a normal strand of hair.  Your hair is no longer feathery!", false);
				//(short)
				else outputText("\n\nYou run your fingers through your downy-soft feather-hair while you await the effects of the item you just ingested.  While your hand is up there, it detects a change in the texture of your feathers.  They're completely disappearing, merging down into strands of regular hair.  Your hair is no longer feathery!", false);
				player.hairType = HAIR_NORMAL;
				changes++;
				return true;
			}

			return false;
		}

		public function newLizardSkinTone():String
		{
			if (rand(10) == 0) {
				//rare skinTone
				return rand(2) == 0 ? "purple" : "silver";
			}

			//non rare skinTone
			switch (rand(5)) {
				case 0: return "red";
				case 1: return "green";
				case 2: return "white";
				case 3: return "blue";
				case 4: return "black";
			}

			return "invalid"; // Will never happen. Suppresses 'Error: Function does not return a value.'
		}

		public function updateClaws(clawType:int = CLAW_TYPE_NORMAL):String
		{
			var clawTone:String = "";
			var oldClawTone:String = player.clawTone;

			switch (clawType) {
				case CLAW_TYPE_DRAGON:       clawTone = "steel-gray";   break;
				case CLAW_TYPE_SALAMANDER:   clawTone = "fiery-red";    break;
				case CLAW_TYPE_LIZARD:
					// See http://www.bergenbattingcenter.com/lizard-skins-bat-grip/ for all those NYI! lizard skin colors
					// I'm still not that happy with these claw tones. Any suggestion would be nice.
					switch (player.skinTone) {
						case "red":          clawTone = "reddish";      break;
						case "green":        clawTone = "greenish";     break;
						case "white":        clawTone = "light-gray";   break;
						case "blue":         clawTone = "bluish";       break;
						case "black":        clawTone = "dark-gray";    break;
						case "purple":       clawTone = "purplish";     break;
						case "silver":       clawTone = "silvery";      break;
						case "pink":         clawTone = "pink";         break; // NYI! Maybe only with a new Skin Oil?
						case "orange":       clawTone = "orangey";      break; // NYI!
						case "yellow":       clawTone = "yellowish";    break; // NYI!
						case "desert-camo":  clawTone = "pale-yellow";  break; // NYI!
						case "gray-camo":    clawTone = "gray";         break; // NYI!
						default:             clawTone = "gray";         break;
					}
					break;
				default:
					clawTone = "";
			}

			player.clawType = clawType;
			player.clawTone = clawTone;

			return oldClawTone;
		}

		public function lizardHairChange(tfSource:String):int
		{
			var hairPinID:int = player.hasKeyItem("Feathery hair-pin");
			trace('called lizardHairChange("' + tfSource + '")');

			switch (tfSource) {
				case "reptilum-lizan":
				case "reptilum-dragonewt":
					//-Hair stops growing!
					if (flags[kFLAGS.HAIR_GROWTH_STOPPED_BECAUSE_LIZARD] == 0) {
						output.text("\n\nYour scalp tingles oddly.  In a panic, you reach up to your [hair], but thankfully it appears unchanged.");
						output.text("\n\n(Your hair has stopped growing.)");
						changes++;
						flags[kFLAGS.HAIR_GROWTH_STOPPED_BECAUSE_LIZARD] = 1;
						return -1; // --> hair growth stopped
					}
					return 0;

				case "PlayerEvents-benoitHairPin":
				case "reptilum-basilisk":
				case "reptilum-dracolisk":
					if (player.hairType == HAIR_BASILISK_PLUME && player.cor < 65) return 0;

					if (player.isFemaleOrHerm() && player.cor < 15 && player.featheryHairPinEquipped() && player.isBasilisk()) {
						var benoitMFText:String = getGame().bazaar.benoit.benoitMF(
							" your hair has changed into a plume of feathers that, like legend is told, belongs to a female basilisk!",
							" you have a plume, like a female basilisk!"
						);

						if (player.hairType == HAIR_GOO)
							output.text("\n\nYour gooey hair begins to fall out in globs, eventually leaving you with a bald head.");

						output.text("\n\nYour head begins to tickle and you reach up to scratch at it, only to be surprised by the softness you feel."
						           +" It reminds you of the down of baby chickens, velvety soft and slightly fluffy. You look at yourself in a nearby"
						           +" puddle and gasp, [if (hairlength <= 0) where your hair once was] you now have red feathers,"
						           +" some longer and larger than others. This floppy but soft plume sits daintily on your head,"
						           +" reminding you of a ladies fascinator. You realise soon that" + benoitMFText);

						if (flags[kFLAGS.HAIR_GROWTH_STOPPED_BECAUSE_LIZARD] != 0)
							output.text("\n\nYour hair is growing again and is now a plume of short red feathers.");
						else
							output.text("\n\nYour hair is now a plume of short red feathers.");

						flags[kFLAGS.HAIR_GROWTH_STOPPED_BECAUSE_LIZARD] = 0;
						player.hairLength = 2;
						player.hairColor = "red";
						player.hairType = HAIR_BASILISK_PLUME;
						player.keyItems[hairPinID].value2 = 0;
						changes++;
						return 1; // --> gained basilisk hair (plume)
					}

					if (player.cor >= 65 && player.hairType != HAIR_BASILISK_SPINES && player.hasLizardScales() && player.hasReptileFace()) {
						// Corrupted Basilisk
						if (player.hairLength > 0 && [HAIR_GOO, HAIR_BASILISK_PLUME].indexOf(player.hairType) == -1) {
							output.text("\n\nYour scalp feels tight and hot, causing you to run a hand through your [hair] to rub at it gingerly.");

							if (player.featheryHairPinEquipped())
								output.text("\n\nThe pin in your hair heats up to the point where you have to pull it free and toss it to the ground,"
								           +" it sizzling against the earth.");

							output.text("\n\nTo your shock a handful of your [hair] comes loose, exposing the [skinFurScales] beneath. You wonder why"
							           +" this is happening to you but realise it must be the potion, lizards don't tend to have hair after all."
							           +" You continue to rub at your scalp, the cool air against your slowly revealed skin a welcome relief."
							           +" After several minutes of this, you're certain you've shed all your hair. When you think it's all over,"
							           +" you feel an uncomfortable pressure build, your scalp morphing and changing as you grimace."
							           +" When the sensation finally fades you rush to look at yourself in a puddle. Where you once had hair,"
							           +" you now have a crown of dull reptilian spines!");

						}

						// Female Basilisk to Corrupted Basilisk
						if (player.hairLength > 0 && player.hairType == HAIR_BASILISK_PLUME) {
							output.text("\n\nA sudden sharp pain drills through your skull, a pressure forming across your scalp."
							           +" If you didn't know any better you'd think you were being plucked!");

							if (player.featheryHairPinEquipped())
								output.text("\n\nThe pin in your hair heats up to the point where you have to pull it free and toss it to the ground,"
								           +" it sizzling against the earth.");

							output.text("\n\nYou clutch your head as you feel the feathers on your head push out further, thickening up as they do so."
							           +" The soft vane seems to fall from the spine of the feathers, stripping them bare as the red fluff falls to"
							           +" the floor. Soon the tips of the feathers follow, leaving some rather alien looking spines behind. Your head"
							           +" throbs with dull pain as the transformation seems to end and you go to look at your reflection in a nearby"
							           +" puddle. Your once magnificent plume has turned into a dull crown of spines, like that of the corrupt"
							           +" basilisk of the mountains. As you mourn the loss of your feathered hair, you notice your spines move with"
							           +" your emotions, their sensitive tips picking up on the breeze as they lower closer to your skull.");
						}

						// Corrupted basilisk with gooey or no hair (bald)
						if (player.hairType == HAIR_GOO || player.hairLength <= 0) {
							if (player.hairType == HAIR_GOO)
								output.text("\n\nYour gooey hair begins to fall out in globs, eventually leaving you with a bald head.");

							if (player.featheryHairPinEquipped())
								output.text("\n\nThe pin in your hair heats up to the point where you have to pull it free and toss it to the ground,"
								           +" it sizzling against the earth.");

							output.text("\n\nYour scalp feels tight, as though the skin is shifting and morphing."
							           +" You let out groan as you grip your head, praying for the pain to subside quickly. Pressure builds,"
							           +" your head feeling ready to split. As the sensation fades you're left wondering what just happened and you"
							           +" run to look at yourself in a nearby puddle.");
						}

						// Finalize Corrupted Basilisk TFs
						player.hairColor = player.skinTone;                   // hairColor always set to player.skinTone
						player.hairType = HAIR_BASILISK_SPINES;               // hairType set to basilisk spines
						player.hairLength = 2;                                // hairLength set to 2 (inches, displayed as ‘short’)
						flags[kFLAGS.HAIR_GROWTH_STOPPED_BECAUSE_LIZARD] = 0; // Hair growth stops
						changes++;
						output.text("\n\nWhere your hair would be, you now have a crown of dull reptilian spines!");

						if (player.featheryHairPinEquipped())
							output.text("\n\nYou place the hair-pin in your inventory, no longer able to wear it.");
						else if (hairPinID >= 0)
							output.text("\n\nYour thoughts wander to the hair-pin while you adjust to your new [hair]. You probably won't be able to"
							           +" wear it while you're this tainted.");

						if (hairPinID >= 0) {                                 // hair-pin set to unequipped
							player.keyItems[hairPinID].value1 = 0;
							player.keyItems[hairPinID].value2 = 0;
						}
						if (tfSource == "PlayerEvents-benoitHairPin") output.text("\n");
						return 1;
					}
					return 0;

				default:
					return 0;
			}
		}

		/**
		 * Updates the perk Oviposition depending on the class/method stored in tfSource, that called it.
		 * @param	tfSource	The method- or classname plus additional info seperated by the '-'-character
		 * @return	-1: lost the perk, 0: no change, 1: gained the perk
		 * @author	Stadler76
		 */
		public function updateOvipositionPerk(tfSource:String):int
		{
			trace('called updateOvipositionPerk("' + tfSource + '")');
			var tsParts:Array = tfSource.split("-");
			if (tsParts.length > 1 && ["goldenSeed", "catTransformation"].indexOf(tsParts[0]) == -1)
				tfSource = tsParts[0];

			// First things first :)
			if (player.findPerk(PerkLib.BasiliskWomb) >= 0) {
				if (player.findPerk(PerkLib.Oviposition) >= 0)
					return 0; // we already have it => no change

				// Basilisk Womb but no Oviposition? Fix, whats broken
				outputText("\n\nDeep inside yourself there is a change.  It makes you feel a little woozy, but passes quickly."
				          +"  Beyond that, you aren't sure exactly what just happened, but you are sure it originated from your basilisk womb.\n");
				outputText("(Perk Gained: Oviposition)");

				player.createPerk(PerkLib.Oviposition, 0, 0, 0, 0);
				return 1; // true => gained Oviposition Perk
			}

			if (changes >= changeLimit) return 0;

			// Note, that we don't do the score checks anymore. That was just an unly workaround and we don't want to do that again!
			switch(tfSource) {
				case "emberTFs":
				case "snakeOil":
				case "goldenSeed-HarpyWomb":
				//case "catTransformation-dragonne": // Keep it? Maybe later.
				// TFs with minor changes. Just in case, we change our mind or if we intend to upgrade them.
				case "winterPudding":
				case "rizzaRootEffect":
					return 0; // Don't change it. So we're done, yay!

				case "reptilum":
					if (player.findPerk(PerkLib.Oviposition) >= 0) return 0;
					outputText("\n\nDeep inside yourself there is a change.  It makes you feel a little woozy, but passes quickly."
					          +"  Beyond that, you aren't sure exactly what just happened, but you are sure it originated from your womb.\n");
					outputText("(Perk Gained: Oviposition)");

					player.createPerk(PerkLib.Oviposition, 0, 0, 0, 0);
					changes++;
					return 1; // Gained it
					break;

				default:
					if (player.findPerk(PerkLib.Oviposition) < 0) return 0;
					if (player.lizardScore() >= 8) return 0; // Still high, so don't remove Oviposition yet!
					if (tfSource != "superHummus") {
						outputText("\n\nAnother change in your uterus ripples through your reproductive systems."
						          +"  Somehow you know you've lost a little bit of reptilian reproductive ability.\n");
						outputText("(Perk Lost: Oviposition)\n");
					}
					player.removePerk(PerkLib.Oviposition);
					return -1; // Lost it
			}
		}

		public function updateGills(newGillType:int = GILLS_NONE):int
		{
			trace("Called updateGills(" + newGillType + ")");
			var oldgillType:int = player.gillType;
			if (player.gillType == newGillType) return 0; // no change

			player.gillType = newGillType;
			changes++;

			// for now, we only have anemone gills on the chest
			switch (newGillType) {
				case GILLS_NONE:
					if (oldgillType == GILLS_ANEMONE) {
						output.text("\n\nYour chest itches, and as you reach up to scratch it, you realize your gills have withdrawn into your"
						           +" skin.");
					} else { // losing fish gills
						output.text("\n\nYou feel your gills tighten, the slits seeming to close all at once. As you let out a choked gasp your"
						           +" gills shrink into nothingness, leaving only smooth skin behind. Seems you won't be able to stay in the water"
						           +" quite so long anymore.");
					}
					output.text("  You no longer have gills!");
					return -1; // Gills lost

				case GILLS_ANEMONE:
					if (oldgillType == GILLS_FISH) {
						output.text("\n\nYou feel your gills tighten, the slits seeming to close all at once. As you let out a choked gasp your"
						           +" gills shrink into nothingness, leaving only smooth skin behind. When you think it's over you feel something"
						           +" emerge from under your neck, flowing down over your chest and brushing your nipples. You look in surprise as"
						           +" your new feathery gills finish growing out, a film of mucus forming over them shoftly after.");
					} else { // if no gills
						output.text("\n\nYou feel a pressure in your lower esophageal region and pull your garments down to check the area."
						           +" Before your eyes a pair of feathery gills start to push out of the center of your chest,"
						           +" just below your neckline, parting sideways and draping over your " + player.nippleDescript(0) + "s."
						           +" They feel a bit uncomfortable in the open air at first, but soon a thin film of mucus covers them and you"
						           +" hardly notice anything at all. You redress carefully.");
					}
					output.text("\n\nYou now have feathery gills!");
					return 1; // Gained gills or gillType changed

				case GILLS_FISH:
					if (oldgillType == GILLS_ANEMONE) {
						output.text("\n\nYou feel your gills tingle, a vague numbness registering across thier feathery exterior. You watch in awe as"
						           +" your gill's feathery folds dry out and fall off like crisp autumn leaves. The slits of your gills then"
						           +" rearrange themselves, becoming thinner and shorter, as they shift to the sides of your neck. They now close in"
						           +" a way that makes them almost invisible. As you run a finger over your neck you feel little more than several"
						           +" small raised lines where they meet your skin.");
					} else { // if no gills
						output.text("\n\nYou feel a sudden tingle on your neck. You reach up to it to feel, whats the source of it. When you touch"
						           +" your neck, you feel that it begins to grow serveral narrow slits which slowly grow longer. After the changes"
						           +" have stopped you quickly head to a nearby puddle to take a closer look at your neck. You realize,"
						           +" that your neck has grown gills allowing you to breathe under water as if you were standing on land.");
					}
					output.text("\n\nYou now have fish like gills!");
					return 1; // Gained gills or gillType changed

				default:
					player.gillType = oldgillType;
					changes--;
					trace("ERROR: Unimplemented new gillType (" + newGillType + ") used");
					return 0; // failsafe, should hopefully never happen
			}
		}

		public function gainSnakeTongue():Boolean
		{
			if (player.tongueType != TONGUE_SNAKE && changes < changeLimit) {
				if (player.tongueType == TONGUE_HUMAN) {
					outputText("\n\nYour taste-buds start aching as they swell to an uncomfortably large size. "
					          +"Trying to understand what in the world could have provoked such a reaction, you bring your hands up to your mouth, "
					          +"your tongue feeling like it's trying to push its way past your lips.");
					outputText("  The soreness stops and you stick out your tongue to try and see what would have made it feel the way it did. "
					          +"As soon as you stick your tongue out you realize that it sticks out much further than it did before, "
					          +"and now appears to have split at the end, creating a forked tip.");
					outputText("  The scents in the air are much more noticeable to you with your snake-like tongue.");
				} else {
					outputText("\n\nYour inhuman tongue shortens, pulling tight in the very back of your throat.");
					outputText("  After a moment the bunched-up tongue-flesh begins to flatten out, then extend forwards.");
					outputText("  By the time the transformation has finished, your tongue has changed into a long, forked snake-tongue.");
				}
				player.tongueType = TONGUE_SNAKE;
				dynStats("sen", 5);
				changes++;
				return true;
			}

			return false;
		}

		public function gainDraconicHorns(tfSource:String):void
		{
			trace('called gainDraconicHorns("' + tfSource + '")');
			var tsParts:Array = tfSource.split("-");
			var race:String;

			if (tsParts[0] == "emberTFs")
				race = "dragon";
			else if (tsParts[0] == "reptilum" && tsParts.length > 1)
				race = tsParts[1];
			else
				throw new Error("Unimplemented tfSource: '" + tfSource + "' used in gainDraconicHorns!");

			//No dragon horns yet.
			if (player.hornType != HORNS_DRACONIC_X2 && player.hornType != HORNS_DRACONIC_X4_12_INCH_LONG) {
				//Already have horns
				if (player.horns > 0) {
					//High quantity demon horns
					if (player.hornType == HORNS_DEMON && player.horns > 4) {
						outputText("\n\nYour horns condense, twisting around each other and merging into larger, pointed protrusions.  By the time they finish you have four draconic-looking horns, each about twelve inches long.");
						player.horns = 12;
						player.hornType = HORNS_DRACONIC_X4_12_INCH_LONG;
					}
					else {
						outputText("\n\nYou feel your horns changing and warping, and reach back to touch them.  They have a slight curve and a gradual taper.  They must look something like the horns the dragons in your village's legends always had.");
						player.hornType = HORNS_DRACONIC_X2;
						if (player.horns > 13) {
							outputText("  The change seems to have shrunken the horns, they're about a foot long now.");
							player.horns = 12;
						}

					}
					changes++;
				}
				//No horns
				else {
					//-If no horns, grow a pair
					outputText("\n\nWith painful pressure, the skin on the sides of your forehead splits around two tiny nub-like horns.  They're angled back in such a way as to resemble those you saw on the dragons in your village's legends.  A few inches of horn sprout from your head before stopping.  You have about four inches of dragon-like horn.");
					player.horns = 4;
					player.hornType = HORNS_DRACONIC_X2;

					changes++;
				}
			}
			//ALREADY DRAGON
			else {
				if (player.hornType == HORNS_DRACONIC_X2) {
					if (player.horns < 12) {
						if (rand(2) == 0) {
							outputText("\n\nYou get a headache as an inch of fresh horn escapes from your pounding skull.");
							player.horns += 1;
						}
						else {
							outputText("\n\nYour head aches as your horns grow a few inches longer.  They get even thicker about the base, giving you a menacing appearance.");
							player.horns += 2 + rand(4);
						}
						if (player.horns >= 12) outputText("  Your horns settle down quickly, as if they're reached their full size.");
						changes++;
					}
					//maxxed out, new row
					else {
						//--Next horn growth adds second row and brings length up to 12\"
						outputText("\n\nA second row of horns erupts under the first, and though they are narrower, they grow nearly as long as your first row before they stop.  A sense of finality settles over you.  You have as many horns as a " + race + " can grow.");
						player.hornType = HORNS_DRACONIC_X4_12_INCH_LONG;
						changes++;
					}
				}
			}
		}
	}
}


code:
package classes.Items.Other
{

	public class DebugWand extends SimpleUseable
	{

		public function DebugWand()
		{
			super("DbgWand", "Debug Wand", "a wand of debugging", 1000, "This mysterious wand has an entirely unknown origin but somehow you feel like a cheater when using it.", "You raise the wand and a slab of stone emerges from the ground. The slab has fifteen buttons and a text panel.");
		}

		override public function canUse():Boolean {
			return true;
		}

		override public function useItem():Boolean {
			if (!game.debug) game.inventory.takeItem(this, game.debugMenu.accessDebugMenu);
			game.debugMenu.accessDebugMenu();
			return true;
		}

	}

}

license: unknown


code:
package classes.Items.Other
{
	import classes.Items.Useable;
	import classes.Player;

	public class SimpleUseable extends Useable
	{
		//This class should be used for items which the player cannot consume, wear or use directly.
		//The useFunction or useText should describe the item or give a hint as to its purpose. After attempted use SimpleUseables return to the inventory automatically.
		private var canUseFunction:Function;
		private var canUseText:String;

		public function SimpleUseable(id:String, shortName:String, longName:String, value:Number, description:String, useText:String, useFunction:Function = null)
		{
			super(id, shortName, longName, value, description);
			canUseFunction = useFunction;
			canUseText = useText;
		}

		override public function canUse():Boolean
		{
			clearOutput();
			if (canUseFunction != null)
			{
				canUseFunction();
			}
			else
			{
				outputText(canUseText);
			}
			return false;
		}
	}
}


code:
/**
 * Created by Kitteh6660 on 01.29.15.
 */
package classes.Items
{
	/**
	 * ...
	 * @author Kitteh6660
	 */
	import classes.ItemType;
	import classes.PerkLib;
	import classes.Player;
	import classes.GlobalFlags.kFLAGS

public class Shield extends Useable //Equipable
	{
		private var _block:Number;
		private var _perk:String;
		private var _name:String;

		public function Shield(id:String, shortName:String, name:String, longName:String, block:Number, value:Number = 0, description:String = null, perk:String = "") {
			super(id, shortName, longName, value, description);
			this._name = name;
			this._block = block;
			this._perk = perk;
		}

		public function get block():Number { return _block; }

		public function get perk():String { return _perk; }

		public function get name():String { return _name; }

		override public function get description():String {
			var desc:String = _description;
			//Type
			desc += "\n\nType: Shield";
			//Block Rating
			desc += "\nBlock: " + String(block);
			//Value
			desc += "\nBase value: " + String(value);
			return desc;
		}

		override public function useText():void {
			outputText("You equip " + longName + ".  ");
		}

		override public function canUse():Boolean {
			if (game.player.weaponPerk == "Large") {
				outputText("Your current weapon requires two hands. Unequip your current weapon or switch to one-handed before equipping this shield. ");
				return false;
			}
			return true;
		}

		public function playerEquip():Shield { //This item is being equipped by the player. Add any perks, etc. - This function should only handle mechanics, not text output
			return this;
		}

		public function playerRemove():Shield { //This item is being removed by the player. Remove any perks, etc. - This function should only handle mechanics, not text output
			return this;
		}

		public function removeText():void {} //Produces any text seen when removing the armor normally

	}
}


code:
package classes.Items
{
	/**
	 * ...
	 * @author Kitteh6660
	 */
	import classes.Items.Shields.*;
	import classes.PerkLib;
	import classes.PerkType;

	public final class ShieldLib
	{
		public static const DEFAULT_VALUE:Number = 6;

		public static const NOTHING:Nothing = new Nothing();

		public const BUCKLER:Shield = new Shield("Buckler", "Buckler", "buckler", "a buckler", 5, 50, "A simple wooden rounded shield.");
		public const GREATSH:Shield = new Shield("GreatSh", "GreatShld", "greatshield", "a greatshield", 12, 300, "A large metal shield. It's a bit heavy.");
		public const KITE_SH:Shield = new Shield("Kite Sh", "KiteShield", "kite shield", "a kite shield", 8, 150, "An average-sized kite shield.");
		public const TOWERSH:Shield = new TowerShield();
		public const DRGNSHL:DragonShellShield = new DragonShellShield();

		/*private static function mk(id:String,shortName:String,name:String,longName:String,effectId:Number,effectMagnitude:Number,value:Number,description:String,type:String,perk:String=""):Jewelry {
			return new Shield(id,shortName,name,longName,effectId,effectMagnitude,value,description,type,perk);
		}*/

		public function ShieldLib()
		{
		}
	}

}


code:
/**
 * Created by aimozg on 10.01.14.
 */
package classes.Items.Shields
{
	import classes.GlobalFlags.kFLAGS;
	import classes.GlobalFlags.kGAMECLASS;
	import classes.Items.Shield;
	import classes.Player;

	public class DragonShellShield extends Shield {

		public function DragonShellShield() {
			super("DrgnShl", "DrgnShl", "dragon-shell shield", "a dragon-shell shield", 14, 1500, "A durable shield that has been forged from the remains of the dragon egg you found in the swamp.  Absorbs any fluid attacks you can catch, rendering them useless.");
		}

		override public function get description():String {
			var desc:String = game.flags[kFLAGS.EMBER_HATCHED] > 0 ? "A durable shield that has been forged from the dragon eggshell Ember gave you for maxing out " + game.emberScene.emberMF("his", "her") + " affection." : "A durable shield that has been forged from the remains of the dragon egg you found in the swamp.";
			//Type
			desc += "\n\nType: Shield";
			//Block Rating
			desc += "\nBlock: " + String(block);
			//Value
			desc += "\nBase value: " + String(value);
			return desc;
		}

		override public function useText():void { //Produces any text seen when equipping the armor normally
			if (game.flags[kFLAGS.TIMES_EQUIPPED_EMBER_SHIELD] == 0) {
				clearOutput();
				outputText("Turning the sturdy shield over in inspection, you satisfy yourself as to its craftsmanship and adjust the straps to fit your arm snugly.  You try a few practice swings, but find yourself overbalancing at each one due to the deceptive lightness of the material.  Eventually, though, you pick up the knack of putting enough weight behind it to speed it through the air while thrusting a leg forward to stabilize yourself, and try bashing a nearby rock with it.  You smile with glee as ");
				if (game.player.str < 80) outputText("bits and pieces from the surface of the");
				else outputText("huge shards of the shattered");
				outputText(" rock are sent flying in all directions.");
				outputText("\n\nAfter a few more practice bashes and shifts to acquaint yourself with its weight, you think you're ready to try facing an enemy with your new protection.  One last thing... taking off the shield and turning it straps-down, you spit onto the surface.  Satisfyingly, the liquid disappears into the shell as soon as it touches.");
			}
			else {
				outputText("You equip " + this.longName + ".  ");
			}
			game.flags[kFLAGS.TIMES_EQUIPPED_EMBER_SHIELD]++;
		}

	}
}


code:
package classes.Items.Shields
{
	import classes.ItemType;
	import classes.Items.Shield;
	import classes.Player;

	public class Nothing extends Shield
	{
		public function Nothing()
		{
			super("noshild", "noshield", "nothing", "nothing", 0, 0, "no shield", "shield");
		}

		override public function playerRemove():Shield {
			return null; //There is nothing!
		}
	}
}


code:
package classes.Items.Shields
{
	import classes.GlobalFlags.kFLAGS;
	import classes.GlobalFlags.kGAMECLASS;
	import classes.Items.Shield;
	import classes.Player;

	public class TowerShield extends Shield
	{

		public function TowerShield()
		{
			super("TowerSh", "TowerShld", "tower shield", "a tower shield", 16, 500, "A towering metal shield. It looks heavy!");
		}

		override public function canUse():Boolean {
			if (game.player.str >= 40) return true;
			outputText("This shield is too heavy for you to hold effectively. Perhaps you should try again when you have at least 40 strength?");
			return false;
		}
	}

}


code:
package classes.Items
{
	/**
	 * @author Kitteh6660
	 */
	public class Undergarment extends Useable //Equipable
	{
		private var _type:Number;
		private var _perk:String;
		private var _name:String;

		public function Undergarment(id:String, shortName:String, name:String, longName:String, undergarmentType:Number, value:Number = 0, description:String = null, perk:String = "")
		{
			super(id, shortName, longName, value, description);
			this._type = undergarmentType;
			this._name = name;
			this._perk = perk;
		}

		public function get type():Number { return _type; }

		public function get perk():String { return _perk; }

		public function get name():String { return _name; }

		override public function useText():void {
			outputText("You equip " + longName + ".  ");
		}

		override public function get description():String {
			var desc:String = _description;
			desc += "\n\nType: Undergarment ";
			if (type == 0) desc += "(Upper)";
			else if (type == 1) desc += "(Lower)";
			else if (type == 2) desc += "(Full)";
			//Defense
			if (armorDef > 0) desc += "\nDefense: " + String(armorDef);
			//Sexiness
			if (sexiness > 0) desc += "\nSexiness: " + String(sexiness);
			//Value
			desc += "\nBase value: " + String(value);
			//Naga wearable?
			if (type == 0 && perk == "NagaWearable" && game.player.isNaga()) desc += "\nNagas aren't restricted from wearing this type of lower undergarment.";
			return desc;
		}

		public function get armorDef():int {
			switch(this.name) {
				case "spider-silk bra":
				case "spider-silk loincloth":
				case "spider-silk panties":
					return 1;
				case "dragonscale bra":
				case "dragonscale loincloth":
				case "dragonscale thong":
					return 2;
				default:
					return 0;
			}
		}

		public function get sexiness():int {
			switch(this.name) {
				case "spider-silk bra":
				case "spider-silk loincloth":
				case "spider-silk panties":
				case "dragonscale bra":
				case "dragonscale loincloth":
				case "dragonscale thong":
					return 1;
				case "fundoshi":
				case "fur loincloth":
					return 2;
				case "latex bra":
				case "latex shorts":
				case "latex thong":
				case "stockings and garters":
					return 3;
				default:
					return 0;
			}
		}

		override public function canUse():Boolean {
			if (!game.player.armor.supportsUndergarment) {
				outputText("It would be awkward to put on undergarments when you're currently wearing your type of clothing. You should consider switching to different clothes. You put it back into your inventory.");
				return false;
			}
			if (type == UndergarmentLib.TYPE_LOWERWEAR) {
				if (game.player.isBiped() || game.player.isGoo()) {
					return true; //It doesn't matter what leg type you have as long as you're biped.
				}
				else if (game.player.isTaur() || game.player.isDrider()) {
					outputText("Your form makes it impossible to put on any form of lower undergarments. You put it back into your inventory.");
					return false;
				}
				else if (game.player.isNaga()) {
					if (perk != "NagaWearable") {
						outputText("It's impossible to put on this undergarment as it's designed for someone with two legs. You put it back into your inventory.");
						return false;
					}
					else return true;
				}
			}
			return true;
		}

		public function playerEquip():Undergarment { //This item is being equipped by the player. Add any perks, etc. - This function should only handle mechanics, not text output
			return this;
		}

		public function playerRemove():Undergarment { //This item is being removed by the player. Remove any perks, etc. - This function should only handle mechanics, not text output
			return this;
		}

		public function removeText():void {} //Produces any text seen when removing the undergarment normally

	}

}


code:
package classes.Items
{
	/**
	 * ...
	 * @author Kitteh6660
	 */
	import classes.Items.Undergarments.*;
	import classes.PerkLib;
	import classes.PerkType;

	public final class UndergarmentLib
	{
		public static const DEFAULT_VALUE:Number = 6;

		public static const TYPE_UPPERWEAR:int = 0;
		public static const TYPE_LOWERWEAR:int = 1;
		public static const TYPE_FULLWEAR:int  = 2;

		//public static const COMFORTABLE_UNDERCLOTHES:Undergarment = new ComfortableUnderclothes();
		public static const NOTHING:Undergarment = new Nothing();

		//Upper
		public const C_BRA  :Undergarment = new Undergarment("C. Bra ", "C. Bra", "comfortable bra", "a pair of comfortable bra", TYPE_UPPERWEAR, DEFAULT_VALUE, "A generic pair of bra.");
		public const DS_BRA :Undergarment = new Undergarment("DS. Bra", "D.Scale Bra", "dragonscale bra", "a pair of dragonscale bra", TYPE_UPPERWEAR, 600, "This bra appears to be made of dragon scale. It's held together with leather straps for flexibility. Great for those on the primal side!");
		public const LTX_BRA:Undergarment = new Undergarment("Ltx.Bra", "Latex Bra", "latex bra", "a pair of latex bra", TYPE_UPPERWEAR, 250, "This bra is black and shiny, obviously made of latex. It's designed to fit snugly against your breasts.");
		public const SS_BRA :Undergarment = new Undergarment("SS. Bra", "S.Silk Bra", "spider-silk bra", "a pair of spider-silk bra", TYPE_UPPERWEAR, 1000, "This bra looks incredibly comfortable. It's as white as snow and finely woven with hundreds of strands of spider silk.");

		//Lower
		public const C_LOIN :Undergarment = new Undergarment("C. Loin", "C. Loin", "comfortable loincloth", "a pair of comfortable loincloth", TYPE_LOWERWEAR, DEFAULT_VALUE, "A generic pair of loincloth.", "NagaWearable");
		public const C_PANTY:Undergarment = new Undergarment("C.Panty", "C.Panties", "comfortable panties", "a pair of comfortable panties", TYPE_LOWERWEAR, DEFAULT_VALUE, "A generic pair of panties.");
		public const DS_LOIN:Undergarment = new Undergarment("DS.Loin", "D.Scale Loin", "dragonscale loincloth", "a dragonscale loincloth", TYPE_LOWERWEAR, 600, "This loincloth appears to be made of dragonscale and held together with a leather strap that goes around your waist. Great for those on the wild side!", "NagaWearable");
		public const DSTHONG:Undergarment = new Undergarment("DSPanty", "D.Scale Thong", "dragonscale thong", "a pair of dragonscale thong", TYPE_LOWERWEAR, 600, "This thong appears to be made of dragonscale and held together with a leather strap that goes around your waist. Great for those on the wild side!");
		public const FUNDOSH:Undergarment = new Undergarment("Fundosh", "Fundoshi", "fundoshi", "a fundoshi", TYPE_LOWERWEAR, 20, "This Japanese-styled undergarment resembles a cross between a thong and a loincloth.");
		public const FURLOIN:Undergarment = new Undergarment("FurLoin", "FurLoin", "fur loincloth", "a front and back set of loincloths", TYPE_LOWERWEAR, DEFAULT_VALUE, "A pair of loincloths to cover your crotch and butt.  Typically worn by people named 'Conan'. ", "NagaWearable");
		public const GARTERS:Undergarment = new Undergarment("Garters", "Garters", "stockings and garters", "a pair of stockings and garters", TYPE_LOWERWEAR, DEFAULT_VALUE, "These pairs of stockings, garters and lingerie are perfect for seducing your partner!");
		public const LTXSHRT:Undergarment = new Undergarment("LtxShrt", "LatexShorts", "latex shorts", "a pair of latex shorts", TYPE_LOWERWEAR, 300, "These shorts are black and shiny, obviously made of latex. It's designed to fit snugly against your form.");
		public const LTXTHNG:Undergarment = new Undergarment("LtxThng", "LatexThong", "latex thong", "a pair of latex thong", TYPE_LOWERWEAR, 300, "This thong is black and shiny, obviously made of latex. It's designed to fit snugly against your form.");
		public const SS_LOIN:Undergarment = new Undergarment("SS.Loin", "S.Silk Loin", "spider-silk loincloth", "a spider-silk loincloth", TYPE_LOWERWEAR, 1000, "This loincloth looks incredibly comfortable. It's as white as snow and finely woven with hundreds of strands of spider silk.", "NagaWearable");
		public const SSPANTY:Undergarment = new Undergarment("SSPanty", "S.Silk Panty", "spider-silk panties", "a pair of spider-silk panties", TYPE_LOWERWEAR, 1000, "These panties look incredibly comfortable. It's as white as snow and finely woven with hundreds of strands of spider silk.");

		public function UndergarmentLib()
		{
		}

	}

}


code:
package classes.Items.Undergarments
{
	import classes.Items.Undergarment;

	public final class ComfortableUnderclothes extends Undergarment
	{

		public function ComfortableUnderclothes() {
			super("c.under", "c.under", "comfortable underclothes", "comfortable underclothes", 1, 6, "A pair of comfortable undergarment. \n\nType: Undergarments");
		}

	}
}


code:
package classes.Items.Undergarments
{
	import classes.Items.Undergarment;

	public class Nothing extends Undergarment
	{
		public function Nothing() {
			super("nounder", "nounder", "nothing", "nothing", -1, 0, "nothing", "light");
		}

		override public function playerRemove():Undergarment {
			return null; //Player never picks up their underclothes
		}
	}
}


code:
/**
 * Created by aimozg on 09.01.14.
 */
package classes.Items
{
	import classes.CoC_Settings;
	import classes.Player;

	/**
	 * Represent item that can be used but does not necessarily disappears on use. Direct subclasses should overrride
	 * "useItem" method.
	 */
	public class Useable extends CommonItem {

		public function Useable(id:String, shortName:String = null, longName:String = null, value:Number = 0, description:String = null) {
			super(id, shortName, longName, value, description);
		}

		override public function get description():String {
			var desc:String = _description;
			//Type
			desc += "\n\nType: ";
			if (shortName == "Condom" || shortName == "GldStat") desc += "Miscellaneous";
			else if (shortName == "Debug Wand") desc += "Miscellaneous (Cheat Item)";
			else desc += "Material";
			//Value
			desc += "\nBase value: " + String(value);
			return desc;
		}

		public function canUse():Boolean { return game.prison.prisonCanUseItem(this); } //If an item cannot be used it should provide some description of why not

//		public function hasSubMenu():Boolean { return false; } //Only GroPlus and Reducto use this. //Replaced with a return

		public function useItem():Boolean {
			CoC_Settings.errorAMC("Useable", "useItem", id);
			return(false);
		}

		public function useText():void {} //Produces any text seen when using or equipping the item normally

        /**
         * @param player user
         * @param output print text
         * @param external item is external (used in consumables: do not remove from player inventory)
         */
/* New version removes the need for any parameters - item is always used on the player, item always outputs text if needed, item is never consumed from inventory (That's up to the calling code).
		public function useItem(player:Player,output:Boolean,external:Boolean):void
		{
			CoC_Settings.errorAMC("Useable", "useItem", id);
		}
*/
	}
}


code:
/**
 * Created by aimozg on 10.01.14.
 */
package classes.Items
{
	import classes.BaseContent;
	import classes.GlobalFlags.kGAMECLASS;
	import classes.Items.Other.DebugWand;
	import classes.Items.Other.SimpleUseable;
	import classes.Player;
	import classes.internals.Utils;

	use namespace kGAMECLASS;

	public final class UseableLib extends BaseContent
	{
		public function UseableLib() {}

		//MATERIALS
		public const B_CHITN:SimpleUseable = new SimpleUseable("B.Chitn", "B.Chitn", "a large shard of chitinous plating", 6,
			"A perfect piece of black chitin from a bee-girl.  It still has some fuzz on it.",
			"You look over the scale carefully but cannot find a use for it.  Maybe someone else will know how to use it.");
		public const GREENGL:SimpleUseable = new SimpleUseable("GreenGl", "GreenGl", "a clump of green gel", 6,
			"This tough substance has no obvious use that you can discern.",
			"You examine the gel thoroughly, noting it is tough and resiliant, yet extremely pliable.  Somehow you know eating it would not be a good idea.");
		public const T_SSILK:SimpleUseable = new SimpleUseable("T.SSilk", "T.SSilk", "a bundle of tough spider-silk", 6,
			"This bundle of fibrous silk is incredibly tough and strong, though somehow not sticky in the slightest.  You have no idea how to work these tough little strands into anything usable.  Perhaps one of this land's natives might have an idea?",
			"You look over the tough webbing, confusion evident in your expression.  There's really nothing practical you can do with these yourself.  It might be best to find someone more familiar with the odd materials in this land to see if they can make sense of it.");
		public const D_SCALE:SimpleUseable = new SimpleUseable("D.Scale", "Dragonscale", "a freshly-shed dragonscale", 6,
			"This sheet of dragon scale is incredibly strong and flexible.  No dragons were seriously harmed in the acquisition of this item.",
			"You look over the sheet of dragon scale. You've seen various legends about how the scales of a dragon can be worked into tough armor or used in alchemy.");
		public const LETHITE:SimpleUseable = new SimpleUseable("Lethite", "Lethicite", "a chunk of lethicite", 1000,
			"A chunk of lethicite. It's rare as lethicite is only produced when a mortal becomes a demon and cums their souls out. A demon's favourite treat.",
			"You examine the pinkish-purple crystal. It must be lethicite. You know that the demons like to consume them but you're sure there might be a use for it.");
		public const IMPSKLL:SimpleUseable = new SimpleUseable("ImpSkll", "ImpSkull", "an imp skull", 25,
			"A skull taken from a slain imp.",
			"You look at the imp skull.  A pair of horns protrude from the skull.  You admire the overall frame of the skull yet you find no obvious uses for it.");
		//MISCELLANEOUS
		public const CONDOM :SimpleUseable = new SimpleUseable("Condom ", "Condom", "a packet of condom", 6,
			"This wrapper contains a latex condom that can be worn over penis. It's designed to prevent pregnancy most of the time. Can be used in certain sex scenes.",
			"You look at the unopened packet of condom.  If applicable, you can use the condom to prevent pregnancy most of the time.");
		public const GLDSTAT:SimpleUseable = new SimpleUseable("GldStat", "GldStat", "a golden statue", 600,
			"An intricate golden idol of an androgynous humanoid figure with nine long tails.  It probably had some spiritual significance to its owner.",
			"", kGAMECLASS.forest.kitsuneScene.kitsuneStatue);
		//CHEAT ITEM
		public const DBGWAND:DebugWand = new DebugWand();
	}
}


code:
/**
 * Created by aimozg on 09.01.14.
 */
package classes.Items
{
	import classes.ItemType;
	import classes.Player;

	public class Weapon extends Useable //Equipable
	{
		private var _verb:String;
		private var _attack:Number;
		private var _perk:String;
		private var _name:String;

		public function Weapon(id:String, shortName:String, name:String,longName:String, verb:String, attack:Number, value:Number = 0, description:String = null, perk:String = "") {
			super(id, shortName, longName, value, description);
			this._name = name;
			this._verb = verb;
			this._attack = attack;
			this._perk = perk;
		}

		public function get verb():String { return _verb; }

		public function get attack():Number { return _attack; }

		public function get perk():String { return _perk; }

		public function get name():String { return _name; }

		override public function get description():String {
			var desc:String = _description;
			//Type
			desc += "\n\nType: Weapon ";
			if (perk == "Large") desc += "(Large)";
			else if (name.indexOf("staff") >= 0) desc += "(Staff)";
			else if (verb.indexOf("whip") >= 0) desc += "(Whip)";
			else if (verb.indexOf("punch") >= 0) desc += "(Gauntlet)";
			else if (verb == "shot") desc += "(Ranged)";
			else if (verb == "slash" || verb == "keen cut") desc += "(Sword)";
			else if (verb == "stab") desc += "(Dagger)";
			else if (verb == "smash") desc += "(Blunt)";
			//Attack
			desc += "\nAttack: " + String(attack);
			//Value
			desc += "\nBase value: " + String(value);
			return desc;
		}

		override public function useText():void {
			outputText("You equip " + longName + ".  ");
			if (perk == "Large" && game.player.shield != ShieldLib.NOTHING) {
				outputText("Because the weapon requires the use of two hands, you have unequipped your shield. ");
			}
		}

		override public function canUse():Boolean {
			return true;
		}

		public function playerEquip():Weapon { //This item is being equipped by the player. Add any perks, etc. - This function should only handle mechanics, not text output
			if (perk == "Large" && game.player.shield != ShieldLib.NOTHING) {
				game.inventory.unequipShield();
			}
			return this;
		}

		public function playerRemove():Weapon { //This item is being removed by the player. Remove any perks, etc. - This function should only handle mechanics, not text output
			return this;
		}

		public function removeText():void {} //Produces any text seen when removing the armor normally

/*
		override protected function equip(player:Player, returnOldItem:Boolean, output:Boolean):void
		{
			if (output) clearOutput();
			if (canUse(player,output)){
				var oldWeapon:Weapon = player.weapon;
				if (output) {
					outputText("You equip your " + name + ".  ");
				}
				oldWeapon.unequip(player, returnOldItem, output);
				player.setWeaponHiddenField(this);
				equipped(player,output);
			}
		}

		override public function unequip(player:Player, returnToInventory:Boolean, output:Boolean = false):void
		{
			if (returnToInventory) {
				var itype:ItemType = unequipReturnItem(player, output);
				if (itype != null) {
					if (output && itype == this)
						outputText("You still have " + itype.longName + " left over.  ");
					game.itemSwapping = true;
					game.inventory.takeItem(this, false);
				}
			}
			player.setWeaponHiddenField(WeaponLib.FISTS);
			unequipped(player,output);
		}
*/
	}
}


code:
/**
 * Created by aimozg on 09.01.14.
 */
package classes.Items
{
	import classes.Items.Weapons.*;

	public final class WeaponLib
	{
		public static const DEFAULT_VALUE:Number = 6;

		public static const FISTS:Fists = new Fists();

		public const B_SWORD:Weapon = new BeautifulSword();
		public const B_SCARB:Weapon = new Weapon("B.ScarB", "B.ScarBlade", "broken scarred blade", "a broken scarred blade", "slash", 12, 1000, "This saber, made from lethicite-imbued metal, seems to no longer seek flesh; whatever demonic properties in this weapon is gone now but it's still an effective weapon.");
		public const BLUNDER:Weapon = new Weapon("Blunder", "Blunderbuss", "blunderbuss", "a blunderbuss", "shot", 16, 600, "This is a blunderbuss. It's effective at short range but poor at long range.", "Ranged");
		public const CLAYMOR:Weapon = new LargeClaymore();
		public const CROSSBW:Weapon = new Weapon("Crossbw","Crossbow","crossbow","a crossbow","shot",11,200,"This weapon fires bolts at your enemies.", "Ranged");
		public const DAGGER :Weapon = new Weapon("Dagger ","Dagger","dagger","a dagger","stab",4,40,"A small blade.  Preferred weapon for the rogues.");
		public const E_STAFF:EldritchStaff = new EldritchStaff();
		public const FLAIL  :Weapon = new Weapon("Flail  ","Flail","flail","a flail","smash",10,200,"This is a flail, a weapon consisting of a metal spiked ball attached to a stick by chain. Be careful with this as you might end up injuring yourself.");
		public const FLINTLK:Weapon = new Weapon("Flintlk","Flintlock","flintlock pistol","a flintlock pistol","shot",14,250,"A flintlock pistol. Pew pew pew. Can fire four times before a reload is required and Speed has a factor in damage.", "Ranged");
		public const URTAHLB:Weapon = new Weapon("UrtaHlb","UrtaHlb","halberd","a halberd","slash",11,10,"Urta's halberd. How did you manage to get this?","Large");
		public const H_GAUNT:Weapon = new Weapon("H.Gaunt", "H.Gaunt", "hooked gauntlets", "a set of hooked gauntlets", "clawing punch", 8, 300, "These metal gauntlets are covered in nasty looking hooks that are sure to tear at your foes flesh and cause them harm.");
		public const HNTCANE:HuntsmansCane = new HuntsmansCane();
		public const JRAPIER:JeweledRapier = new JeweledRapier();
		public const KATANA :Weapon = new Weapon("Katana ","Katana","katana","a katana","keen cut",10,500,"A curved bladed weapon that cuts through flesh with the greatest of ease.");
		public const KIHAAXE:Weapon = new Weapon("KihaAxe","Greataxe","fiery double-bladed axe","a fiery double-bladed axe","fiery cleave",20,1000,"This large, double-bladed axe matches Kiha's axe. It's constantly flaming.", "Large");
		public const L__AXE :Weapon = new Weapon("L. Axe ","L. Axe","large axe","an axe large enough for a minotaur","cleave",15,100,"This massive axe once belonged to a minotaur.  It'd be hard for anyone smaller than a giant to wield effectively.  The axe is double-bladed and deadly-looking.  Requires height of 6'6\" or 90 strength.","Large");
		public const L_DAGGR:Weapon = new Weapon("L.Daggr","L.Daggr","lust-enchanted dagger","an aphrodisiac-coated dagger","stab",3,150,"A dagger with a short blade in a wavy pattern.  Its edge seems to have been enchanted to always be covered in a light aphrodisiac to arouse anything cut with it.","Aphrodisiac Weapon");
		public const L_HAMMR:LargeHammer = new LargeHammer();
		public const L_STAFF:LethiciteStaff = new LethiciteStaff();
		public const L_WHIP :Weapon = new Weapon("L. Whip", "L. Whip", "flaming whip", "a flaming whip once belonged to Lethice", "whip-crack", 16, 2000, "This whip once belonged to Lethice who was defeated at your hands. It gives off flames when you crack this whip.");
		public const MACE   :Weapon = new Weapon("Mace   ","Mace","mace","a mace","smash",9,100,"This is a mace, designed to be able to crush against various defenses.");
		public const PIPE   :Weapon = new Weapon("Pipe   ","Pipe","pipe","a pipe","smash",5,25,"This is a simple rusted pipe of unknown origins.  It's hefty and could probably be used as an effective bludgeoning tool.");
		public const PTCHFRK:Weapon = new Weapon("PtchFrk","Pitchfork","pitchfork","a pitchfork","stab",10,200,"This is a pitchfork.  Intended for farm work but also useful as stabbing weapon.");
		public const RIDINGC:Weapon = new Weapon("RidingC","RidingC","riding crop","a riding crop","whip-crack",5,50,"This riding crop appears to be made of black leather, and could be quite a painful (or exciting) weapon.");
		public const RRAPIER:RaphaelsRapier = new RaphaelsRapier();
		public const S_BLADE:Spellblade = new Spellblade();
		public const S_GAUNT:Weapon = new Weapon("S.Gaunt","S.Gauntlet","spiked gauntlet","a spiked gauntlet","spiked punch",5,400,"This single metal gauntlet has the knuckles tipped with metal spikes.  Though it lacks the damaging potential of other weapons, the sheer pain of its wounds has a chance of stunning your opponent.");
		public const SCARBLD:Weapon = new ScarredBlade();
		public const SCIMITR:Weapon = new Weapon("Scimitr", "Scimitar", "scimitar", "a scimitar", "slash", 15, 500, "This curved sword is made for slashing.  No doubt it'll easily cut through flesh.");
		public const SPEAR  :Weapon = new Weapon("Spear  ","Spear","deadly spear","a deadly spear","piercing stab",8,450,"A staff with a sharp blade at the tip designed to pierce through the toughest armor.  This would ignore most armors.");
		public const SUCWHIP:Weapon = new Weapon("SucWhip","SucWhip","succubi whip","a succubi whip","sexy whipping",10,400,"This coiled length of midnight-black leather practically exudes lust.  Though it looks like it could do a lot of damage, the feel of that slick leather impacting flesh is sure to inspire lust.  However, it might slowly warp the mind of wielder.");
		public const W_STAFF:WizardsStaff = new WizardsStaff();
		public const WARHAMR:HugeWarhammer = new HugeWarhammer();
		public const WHIP   :Weapon = new Weapon("Whip   ","Whip","coiled whip","a coiled whip","whip-crack",5,500,"A coiled length of leather designed to lash your foes into submission.  There's a chance the bondage inclined might enjoy it!");

		/*
		private static function mk(id:String,shortName:String,name:String,longName:String,verb:String,attack:Number,value:Number,description:String,perk:String=""):Weapon {
			return new Weapon(id,shortName,name,longName,verb,attack,value,description,perk);
		}
		*/
		public function WeaponLib()
		{
		}
	}
}


code:
/**
 * Created by aimozg on 10.01.14.
 */
package classes.Items.Weapons
{
	import classes.CoC_Settings;
	import classes.Creature;
	import classes.GlobalFlags.kGAMECLASS;
	import classes.Items.Weapon;
	import classes.Player;

	public class BeautifulSword extends Weapon {

		public function BeautifulSword() {
			super("B.Sword", "B.Sword", "beautiful sword", "a beautiful shining sword", "slash", 7, 400, "This beautiful sword shines brilliantly in the light, showing the flawless craftsmanship of its blade.  The pommel and guard are heavily decorated in gold and brass.  Some craftsman clearly poured his heart and soul into this blade.", "holySword");
		}

		override public function get attack():Number {
			var temp:int = 7 + (10 - game.player.cor / 3);
			if (temp < 5) temp = 5;
			return temp;
		}

		override public function canUse():Boolean {
			if (game.player.cor < (35 + game.player.corruptionTolerance())) return true;
			outputText("You grab hold of the handle of the sword only to have it grow burning hot.  You're forced to let it go lest you burn yourself.  Something within the sword must be displeased.  ");
			return false;
		}
	}
}


code:
/**
 * Created by aimozg on 10.01.14.
 */
package classes.Items.Weapons
{
	import classes.Items.Weapon;
	import classes.PerkLib;
	import classes.Player;

	public class EldritchStaff extends WeaponWithPerk {

		public function EldritchStaff() {
			super("E.Staff", "E.Staff", "eldritch staff", "an eldritch staff", "thwack", 10, 1000, "This eldritch staff once belonged to the Harpy Queen, who was killed after her defeat at your hands.  It fairly sizzles with magical power.", "Wizard's Focus", PerkLib.WizardsFocus, 0.6, 0, 0, 0);
		}

		override public function get verb():String {
			return game.player.findPerk(PerkLib.StaffChanneling) >= 0 ? "shot" : "thwack";
		}
	}
}


code:
/**
 * Created by aimozg on 09.01.14.
 */
package classes.Items.Weapons
{
	import classes.ItemType;
	import classes.Items.Weapon;
	import classes.Player;

	public class Fists extends Weapon {

		public function Fists() {
			super("Fists  ", "Fists", "fists", "fists \n\nType: Weapon (Unarmed) \nAttack: 0 \nBase value: N/A", "punch", 0);
		}

		override public function useText():void {} //No text for equipping fists

		override public function playerRemove():Weapon {
			return null;
		}

	}
}


code:
/**
 * Created by aimozg on 10.01.14.
 */
package classes.Items.Weapons
{
	import classes.Items.Weapon;
	import classes.Player;

	public class HugeWarhammer extends Weapon {

		public function HugeWarhammer() {
			super("Warhamr", "Warhammer", "huge warhammer", "a huge warhammer", "smash", 15, 1600, "A huge war-hammer made almost entirely of steel that only the strongest warriors could use.  Requires 80 strength to use.  Getting hit with this might stun the victim.", "Large");
		}

		override public function canUse():Boolean {
			if (game.player.str >= 80) return true;
			outputText("You aren't strong enough to handle such a heavy weapon!  ");
			return false;
		}

	}
}


code:
package classes.Items.Weapons
{
	import classes.Items.Weapon;
	import classes.Items.WeaponLib;
	import classes.PerkLib;
	import classes.Player;

	public class HuntsmansCane extends Weapon
	{

		public function HuntsmansCane() {
			super("H. Cane", "H. Cane", "huntsman's cane", "a cane that once belonged to Erlking", "thwack", 0, 400, "This ebony black cane is made of polished wood and topped with a golden cap in the shape of a deer's head. This lightweight staff once belonged to the Erlking, but seems too light and delicate to be an effective weapon.");
		}

		override public function useText():void {
			outputText("You equip the lightweight cane, wondering about the effectiveness of such a small stick. With the cane in your hand, though, you feel intensely focused, and you doubt anything could distract you from your goals. ");
		}

	}

}


code:
/**
 * Created by aimozg on 10.01.14.
 */
package classes.Items.Weapons
{
	import classes.GlobalFlags.kFLAGS;
	import classes.GlobalFlags.kGAMECLASS;
	import classes.Items.Weapon;

	public class JeweledRapier extends Weapon {

		public function JeweledRapier() {
			super("JRapier", "JRapier", "jeweled rapier", "a jeweled rapier", "slash", 13, 1400, "This jeweled rapier is ancient but untarnished.  The hilt is wonderfully made, and fits your hand like a tailored glove.  The blade is shiny and perfectly designed for stabbing.");
		}

		override public function get attack():Number {
			var boost:int = 0;
			if (kGAMECLASS.flags[kFLAGS.RAPHAEL_RAPIER_TRANING] < 2) boost += kGAMECLASS.flags[kFLAGS.RAPHAEL_RAPIER_TRANING] * 2;
			else boost += 4 + (kGAMECLASS.flags[kFLAGS.RAPHAEL_RAPIER_TRANING] - 2);
			return (13 + boost);
		}
	}
}


code:
/**
 * Created by aimozg on 10.01.14.
 */
package classes.Items.Weapons
{
	import classes.Items.Weapon;
	import classes.Player;

	public class LargeClaymore extends Weapon {

		public function LargeClaymore() {
			super("Claymor", "L.Claymore", "large claymore", "a large claymore", "cleaving sword-slash", 15, 1000, "A massive sword that a very strong warrior might use.  Requires 40 strength to use.", "Large");
		}

		override public function canUse():Boolean {
			if (game.player.str >= 40) return true;
			outputText("You aren't strong enough to handle such a heavy weapon!  ");
			return false;
		}

	}
}


code:
/**
 * Created by aimozg on 10.01.14.
 */
package classes.Items.Weapons
{
	import classes.CoC_Settings;
	import classes.Creature;
	import classes.Items.Weapon;
	import classes.Player;

	public class LargeHammer extends Weapon {

		public function LargeHammer() {
			super("L.Hammr", "L.Hammr", "large hammer", "Marble's large hammer", "smash", 16, 90, "This two-handed warhammer looks pretty devastating.  You took it from Marble after she refused your advances.", "Large");
		}

		override public function canUse():Boolean {
			if (game.player.tallness >= 60) return true;
			outputText("This hammer is too large for you to wield effectively.  ");
			return false;
		}

	}
}


code:
/**
 * Created by aimozg on 10.01.14.
 */
package classes.Items.Weapons
{
	import classes.Items.Weapon;
	import classes.PerkLib;
	import classes.Player;

	public class LethiciteStaff extends WeaponWithPerk {

		public function LethiciteStaff() {
			super("L.Staff", "Lthc. Staff", "lethicite staff", "a lethicite staff", "smack", 14, 1337, "This staff is made of a dark material and seems to tingle to the touch.  The top consists of a glowing lethicite orb.  It once belonged to Lethice who was defeated in your hands.", "Wizard's Focus", PerkLib.WizardsFocus, 0.8, 0, 0, 0);
		}

		override public function get verb():String {
			return game.player.findPerk(PerkLib.StaffChanneling) >= 0 ? "shot" : "smack";
		}

		override public function playerEquip():Weapon {
			while (game.player.findPerk(PerkLib.WizardsFocus) >= 0) game.player.removePerk(PerkLib.WizardsFocus);
			game.player.createPerk(PerkLib.WizardsFocus, 0.8, 0, 0, 0);
			return super.playerEquip();
		}

		override public function playerRemove():Weapon {
			while (game.player.findPerk(PerkLib.WizardsFocus) >= 0) game.player.removePerk(PerkLib.WizardsFocus);
			return super.playerRemove();
		}

	}
}


code:
/**
 * Created by aimozg on 10.01.14.
 */
package classes.Items.Weapons
{
	import classes.GlobalFlags.kFLAGS;
	import classes.GlobalFlags.kGAMECLASS;
	import classes.Items.Weapon;

	public class RaphaelsRapier extends Weapon {

		public function RaphaelsRapier() {
			super("RRapier", "RRapier", "vulpine rapier", "Raphael's vulpine rapier", "slash", 8, 1000, "He's bound it with his red sash around the length like a ribbon, as though he has now gifted it to you.  Perhaps it is his way of congratulating you.");
		}

		override public function get attack():Number {
			var boost:int = 0;
			if (kGAMECLASS.flags[kFLAGS.RAPHAEL_RAPIER_TRANING] < 2) boost += kGAMECLASS.flags[kFLAGS.RAPHAEL_RAPIER_TRANING] * 2;
			else boost += 4 + (kGAMECLASS.flags[kFLAGS.RAPHAEL_RAPIER_TRANING] - 2);
			return (8 + boost);
		}
	}
}


code:
package classes.Items.Weapons
{
	import classes.Items.Weapon;
	import classes.PerkLib;
	import classes.Player;
	import classes.GlobalFlags.*;

	public class ScarredBlade extends Weapon
	{

		public function ScarredBlade()
		{
			super("ScarBld", "ScarBlade", "scarred blade", "a scarred blade", "slash", 10, 1000, "This saber, made from lethicite-imbued metal, eagerly seeks flesh; it resonates with disdain and delivers deep, jagged wounds as it tries to bury itself in the bodies of others. It only cooperates with the corrupt.");
		}

		override public function get attack():Number {
			var temp:int = 10 + int((game.player.cor - 70) / 3)
			if (temp < 10) temp = 10;
			return temp;
		}

		override public function canUse():Boolean {
			if (game.player.cor >= (70 - game.player.corruptionTolerance())) return true;
			game.sheilaScene.rebellingScarredBlade(true);
			return false;
		}

	}

}


code:
/**
 * Created by aimozg on 10.01.14.
 */
package classes.Items.Weapons
{
	import classes.Items.Weapon;
	import classes.PerkLib;
	import classes.Player;

	public class Spellblade extends WeaponWithPerk {

		public function Spellblade() {
			super("S.Blade", "S.Blade", "inscribed spellblade", "a spellblade", "slash", 8, 500, "Forged not by a swordsmith but a sorceress, this arcane-infused blade amplifies your magic.  Unlike the wizard staves it is based on, this weapon also has a sharp edge, a technological innovation which has proven historically useful in battle.", "Wizard's Focus", PerkLib.WizardsFocus, 0.5, 0, 0, 0);
		}

	}
}


code:
package classes.Items.Weapons
{
	import classes.Items.Weapon;
	import classes.PerkType;
	import classes.PerkLib;
	import classes.Player;

	public class WeaponWithPerk extends Weapon {
		private var playerPerk:PerkType;
		private var playerPerkV1:Number;
		private var playerPerkV2:Number;
		private var playerPerkV3:Number;
		private var playerPerkV4:Number;

		public function WeaponWithPerk(id:String, shortName:String, name:String, longName:String, verb:String, attack:Number, value:Number, description:String, perk:String, playerPerk:PerkType, playerPerkV1:Number, playerPerkV2:Number, playerPerkV3:Number, playerPerkV4:Number, playerPerkDesc:String = "")
		{
			super(id, shortName, name, longName, verb, attack, value, description, perk);
			this.playerPerk = playerPerk;
			this.playerPerkV1 = playerPerkV1;
			this.playerPerkV2 = playerPerkV2;
			this.playerPerkV3 = playerPerkV3;
			this.playerPerkV4 = playerPerkV4;
		}

		override public function playerEquip():Weapon { //This item is being equipped by the player. Add any perks, etc.
			while (game.player.findPerk(playerPerk) >= 0) game.player.removePerk(playerPerk);
			game.player.createPerk(playerPerk, playerPerkV1, playerPerkV2, playerPerkV3, playerPerkV4);
			return super.playerEquip();
		}

		override public function playerRemove():Weapon { //This item is being removed by the player. Remove any perks, etc.
			while (game.player.findPerk(playerPerk) >= 0) game.player.removePerk(playerPerk);
			return super.playerRemove();
		}

		override public function get description():String {
			var desc:String = _description;
			//Type
			desc += "\n\nType: Weapon "
			if (perk == "Large") desc += "(Large)";
			else if (name.indexOf("staff") >= 0) desc += "(Staff)";
			else if (verb.indexOf("whip") >= 0) desc += "(Whip)";
			else if (verb.indexOf("punch") >= 0) desc += "(Gauntlet)";
			else if (verb == "shot") desc += "(Ranged)";
			else if (verb == "slash" || verb == "keen cut") desc += "(Sword)";
			else if (verb == "stab") desc += "(Dagger)";
			else if (verb == "smash") desc += "(Blunt)";
			//Attack
			desc += "\nAttack: " + String(attack);
			//Value
			desc += "\nBase value: " + String(value);
			//Perk
			desc += "\nSpecial: " + playerPerk.name;
			if (playerPerk == PerkLib.WizardsFocus) desc += " (+" + playerPerkV1 * 100 + "% Spell Power)";
			else if (playerPerkV1 > 0) desc += " (Magnitude: " + playerPerkV1 + ")";
			return desc;
		}

	}

}


code:
/**
 * Created by aimozg on 10.01.14.
 */
package classes.Items.Weapons
{
	import classes.Items.Weapon;
	import classes.PerkLib;
	import classes.Player;

	public class WizardsStaff extends WeaponWithPerk {

		public function WizardsStaff() {
			super("W.Staff", "W. Staff", "wizard's staff", "a wizard's staff", "smack", 3, 350, "This staff is made of very old wood and seems to tingle to the touch.  The top has an odd zig-zag shape to it, and the wood is worn smooth from lots of use.  It probably belonged to a wizard at some point and would aid magic use.", "Wizard's Focus", PerkLib.WizardsFocus, 0.4, 0, 0, 0);
		}

		override public function get verb():String {
				return game.player.findPerk(PerkLib.StaffChanneling) >= 0 ? "shot" : "smack";
		}
	}
}


code:
package classes
{
	public class KeyItemClass extends Object
	{
		//constructor
		public function KeyItemClass()
		{
		}

		//data
		public var keyName:String = "";
		//v1-v4 for storing extra stuff.
		public var value1:Number = 0;
		public var value2:Number = 0;
		public var value3:Number = 0;
		public var value4:Number = 0;
	}
}


code:
//The code that is responsible for managing MainView.
package classes
{
	import classes.*
	import classes.GlobalFlags.kFLAGS;
	import classes.GlobalFlags.kGAMECLASS;
	import flash.display.Shape;
	import flash.display.GradientType;
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.text.TextFormat;

	import coc.view.MainView;
	import coc.view.CoCButton;

	import flash.events.MouseEvent;

	import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;

	import flash.text.Font;
	import flash.text.TextFormat;
	import flash.text.TextFormatAlign;
	import flash.text.TextFieldAutoSize;

	import flash.events.KeyboardEvent;
	import flash.ui.Keyboard;

	import flash.utils.Timer;

	//import fl.transition.Tween;
	//import fl.transition.easing.*

	public class MainViewManager extends BaseContent
	{
		//Interface flags
		public var registeredShiftKey:Boolean = false;
		//public var minLustBar:MovieClip = new MovieClip();
		//public var minLustBarCreated:Boolean = false;
		public var initializedThirdRow:Boolean = false;
		public var initializedGradients:Boolean = false;

		public const textColorArray:Array = [null, null, null, 0xFFFFFF, 0xFFFFFF, null, null, null, null, null];
		public const mainColorArray:Array = [null, null, null, null, 0xFFFFFF, null, null, null, null, null];
		public const barAlphaArray:Array = [0.4, 0.4, 0.5, 1, 1, 1, 1, 1, 1, 1];

		public var statsHidden:Boolean = false;
		public var buttonsTweened:Boolean = false;
		public var barsDecorated:Boolean = false;

		//Format
		private var oldFormat:TextFormat;
		private var newFormat:TextFormat;
		//private var oldFormatLarge:TextFormat;
		//private var timeTextFormat:TextFormat;

		private var arraySet:Boolean = false;
		public var colorableTexts:Array = [];
		public var fontableTexts:Array = []; //Will be used for font adjustment.
		public var bars:Array = [];

		private var universalAlpha:Number = 0.4;

		public function MainViewManager()
		{

		}

		//------------
		// INITIALIZE
		//------------
		//For now
		private function initializeMarkers():void {
			if (barsDecorated) return;
			barsDecorated = true;
			var barsToDecorate:Array = ["strBar", "touBar", "speBar", "inteBar", "libBar", "sensBar", "corBar", "HPBar", "lustBar", "fatigueBar", "hungerBar", "esteemBar", "willBar", "obeyBar", "xpBar"];
			for (var i:int = 0; i < barsToDecorate.length; i++) {
				var marker:Sprite = new StatsBarTrim() as Sprite;
				marker.name = barsToDecorate[i] + "Trim";
				marker.x = mainView[barsToDecorate[i]].x - 2;
				marker.y = mainView[barsToDecorate[i]].y + 18;
				mainView.statsView.addChildAt(marker, mainView.statsView.numChildren);
			}
		}

		//------------
		// SHOW/HIDE
		//------------
		//Hide hunger bar, necessary if either of the 2 conditions happen: We either switch to the old interface or we have hunger disabled.
		public function hideHungerBar():void {
			if (mainView.statsView.getChildByName("hungerBar") != null) {
				mainView.hungerBar.visible = false;
				mainView.hungerNum.visible = false;
				mainView.hungerText.visible = false;
				mainView.hungerDown.visible = false;
				mainView.hungerUp.visible = false;
				mainView.statsView.getChildByName("hungerBarTrim").visible = false;
			}
		}
		public function showHungerBar():void {
			if (mainView.statsView.getChildByName("hungerBar") != null) {
				mainView.hungerBar.visible = true;
				mainView.hungerNum.visible = true;
				mainView.hungerText.visible = true;
				//mainView.hungerDown.visible = false;
				//mainView.hungerUp.visible = false;
				mainView.statsView.getChildByName("hungerBarTrim").visible = true;
			}
		}

		public function hidePrisonBar():void {
			mainView.levelNum.visible = true;
			mainView.levelText.visible = true;
			mainView.xpNum.visible = true;
			mainView.xpText.visible = true;
			mainView.gemsNum.visible = true;
			mainView.gemsText.visible = true;
			//Hide willpower
			mainView.willBar.visible = false;
			mainView.willNum.visible = false;
			mainView.willText.visible = false;
			mainView.willDown.visible = false;
			mainView.willUp.visible = false;
			mainView.statsView.getChildByName("willBarTrim").visible = false;
			//Hide self-esteem
			mainView.esteemBar.visible = false;
			mainView.esteemNum.visible = false;
			mainView.esteemText.visible = false;
			mainView.esteemDown.visible = false;
			mainView.esteemUp.visible = false;
			mainView.statsView.getChildByName("esteemBarTrim").visible = false;
			//Hide obedience
			mainView.obeyBar.visible = false;
			mainView.obeyNum.visible = false;
			mainView.obeyText.visible = false;
			mainView.obeyDown.visible = false;
			mainView.obeyUp.visible = false;
			mainView.statsView.getChildByName("obeyBarTrim").visible = false;
		}
		public function showPrisonBar():void {
			mainView.levelNum.visible = false;
			mainView.levelText.visible = false;
			mainView.xpNum.visible = false;
			mainView.xpText.visible = false;
			mainView.gemsNum.visible = false;
			mainView.gemsText.visible = false;
			//Show willpower
			if (flags[kFLAGS.USE_OLD_INTERFACE] == 0) mainView.willBar.visible = true;
			mainView.willNum.visible = true;
			mainView.willText.visible = true;
			//mainView.willDown.visible = false;
			//mainView.willUp.visible = false;
			mainView.statsView.getChildByName("willBarTrim").visible = true;
			//Show self-esteem
			if (flags[kFLAGS.USE_OLD_INTERFACE] == 0) mainView.esteemBar.visible = true;
			mainView.esteemNum.visible = true;
			mainView.esteemText.visible = true;
			//mainView.esteemDown.visible = false;
			//mainView.esteemUp.visible = false;
			mainView.statsView.getChildByName("esteemBarTrim").visible = true;
			//Show obedience
			if (flags[kFLAGS.USE_OLD_INTERFACE] == 0) mainView.obeyBar.visible = true;
			mainView.obeyNum.visible = true;
			mainView.obeyText.visible = true;
			//mainView.obeyDown.visible = false;
			//mainView.obeyUp.visible = false;
			mainView.statsView.getChildByName("obeyBarTrim").visible = true;
		}

		//Hide XP bar. (For old menus)
		public function hideExperienceBar():void {
			mainView.xpBar.visible = false;
		}
		public function showExperienceBar():void {
			mainView.xpBar.visible = true;
		}

		//Hide min lust bar. (For old menus)
		public function hideMinLustBar():void {
			mainView.minLustBar.visible = false;
		}
		public function showMinLustBar():void {
			mainView.minLustBar.visible = true;
		}

		public function setTheme():void {
			var i:int = 0; //Will be used for array.
			if (!arraySet) {
				arraySet = true;
				oldFormat = mainView.timeText.getTextFormat();
				oldFormat.size = null;
				oldFormat.align = null;
				newFormat = mainView.strNum.getTextFormat();
				newFormat.size = null;
				newFormat.align = null;
				colorableTexts.push(
					//Core stats
					mainView.strText, mainView.strNum,
					mainView.touText, mainView.touNum,
					mainView.speText, mainView.speNum,
					mainView.inteText, mainView.inteNum,
					mainView.libText, mainView.libNum,
					mainView.senText, mainView.senNum,
					mainView.corText, mainView.corNum,
					//Combat stats
					mainView.HPText, mainView.HPNum,
					mainView.lustText, mainView.lustNum,
					mainView.fatigueText, mainView.fatigueNum,
					mainView.hungerText, mainView.hungerNum,
					//Prison stats
					mainView.willText, mainView.willNum,
					mainView.esteemText, mainView.esteemNum,
					mainView.obeyText, mainView.obeyNum,
					//Advancement
					mainView.levelText, mainView.levelNum,
					mainView.xpText, mainView.xpNum,
					mainView.gemsText, mainView.gemsNum,
					//Misc
					mainView.nameText,
					mainView.coreStatsText,
					mainView.combatStatsText,
					mainView.advancementText,
					mainView.timeText
				);
				fontableTexts.push(
					//Core stats
					mainView.strText, mainView.strNum,
					mainView.touText, mainView.touNum,
					mainView.speText, mainView.speNum,
					mainView.inteText, mainView.inteNum,
					mainView.libText, mainView.libNum,
					mainView.senText, mainView.senNum,
					mainView.corText, mainView.corNum,
					//Combat stats
					mainView.HPText, mainView.HPNum,
					mainView.lustText, mainView.lustNum,
					mainView.fatigueText, mainView.fatigueNum,
					mainView.hungerText, mainView.hungerNum,
					//Prison stats
					mainView.willText, mainView.willNum,
					mainView.esteemText, mainView.esteemNum,
					mainView.obeyText, mainView.obeyNum,
					//Advancement
					mainView.levelText, mainView.levelNum,
					mainView.xpText, mainView.xpNum,
					mainView.gemsText, mainView.gemsNum
				);
				bars.push(
					//Core stats
					mainView.strBar,
					mainView.touBar,
					mainView.speBar,
					mainView.inteBar,
					mainView.libBar,
					mainView.sensBar,
					mainView.corBar,
					//Combat stats
					mainView.HPBar,
					mainView.lustBar,
					mainView.fatigueBar,
					mainView.hungerBar,
					//Prison stats
					mainView.willBar,
					mainView.esteemBar,
					mainView.obeyBar,
					//Advancement
					mainView.xpBar
				);
			}
			//Set background
			mainView.background.gotoAndStop(flags[kFLAGS.BACKGROUND_STYLE] + 1);
			mainView.sideBarBG.gotoAndStop(flags[kFLAGS.BACKGROUND_STYLE] + 1);
			//Set font
			if (flags[kFLAGS.USE_OLD_FONT] > 0) {
				for (i = 0; i < fontableTexts.length; i++) {
					fontableTexts[i].setTextFormat(oldFormat);
				}
			}
			else {
				for (i = 0; i < fontableTexts.length; i++) {
					fontableTexts[i].setTextFormat(newFormat);
				}
			}
			//Set text colour
			//mainView.mainText.textColor = mainColorArray[flags[kFLAGS.BACKGROUND_STYLE]];
			for (i = 0; i < colorableTexts.length; i++) {
				colorableTexts[i].textColor = textColorArray[flags[kFLAGS.BACKGROUND_STYLE]];
			}
			//Set bar opacity
			universalAlpha = barAlphaArray[flags[kFLAGS.BACKGROUND_STYLE]];
			for (i = 0; i < bars.length; i++) {
				bars[i].alpha = universalAlpha;
			}

		}

		//------------
		// REFRESH
		//------------
		public function refreshStats():void {
			var baseHeight:Number = 26;
			var baseWidth:Number = 170;
			//var universalAlpha:Number = 0.4;
			var gapDiff:Number = 30;
			if (!barsDecorated) {
				initializeMarkers();
			}
			showHungerBar();
			showExperienceBar();
			showMinLustBar();
			if (prison.inPrison) {
				showPrisonBar();
				hideExperienceBar();
			}
			else {
				hidePrisonBar();
				showExperienceBar();
			}
			//Set bars
			mainView.strBar.width = (player.str * (baseWidth / player.getMaxStats("str")));
			mainView.touBar.width = (player.tou * (baseWidth / player.getMaxStats("tou")));
			mainView.speBar.width = (player.spe * (baseWidth / player.getMaxStats("spe")));
			mainView.inteBar.width = (player.inte * (baseWidth / player.getMaxStats("inte")));
			mainView.libBar.width = (player.lib * (baseWidth / 100));
			mainView.sensBar.width = (player.sens * (baseWidth / 100));
			mainView.corBar.width = (player.cor * (baseWidth / 100));

			mainView.HPBar.width = ((player.HP / player.maxHP() * 100) * (baseWidth / 100));
			mainView.lustBar.width = ((player.lust / player.maxLust() * 100) * (baseWidth / 100));
			mainView.minLustBar.width = ((player.minLust() / player.maxLust() * 100) * (baseWidth / 100));
			mainView.fatigueBar.width = ((player.fatigue / player.maxFatigue() * 100) * (baseWidth / 100));

			//Hunger bar
			mainView.hungerBar.width = (player.hunger * (baseWidth / 100));
			//Experience bar.
			if (!prison.inPrison) {
				if (player.level < kGAMECLASS.levelCap) mainView.xpBar.width = (((player.XP / player.requiredXP()) * 100) * (baseWidth / 100));
				else mainView.xpBar.width = (100 * (baseWidth / 100)); //Display XP bar at 100% if level is capped.
				if (player.XP >= player.requiredXP()) mainView.xpBar.width = baseWidth; //Set to 100% if XP exceeds the requirement.
			}
			//Prison bars
			else {
				mainView.esteemBar.width = (player.esteem * (baseWidth / 100));
				mainView.willBar.width = (player.will * (baseWidth / 100));
				mainView.obeyBar.width = (player.obey * (baseWidth / 100));
			}

			mainView.strNum.text = String(Math.floor(player.str));
			mainView.touNum.text = String(Math.floor(player.tou));
			mainView.speNum.text = String(Math.floor(player.spe));
			mainView.inteNum.text = String(Math.floor(player.inte));
			mainView.libNum.text = String(Math.floor(player.lib));
			mainView.senNum.text = String(Math.floor(player.sens));
			mainView.corNum.text = String(Math.floor(player.cor));
			//Old interface is removed for now.
			//if (flags[kFLAGS.USE_OLD_INTERFACE] <= 0)
			mainView.HPNum.text = Math.floor(player.HP) + "/" + Math.floor(player.maxHP());
			//else mainView.HPNum.text = "" + Math.floor(player.HP);

			//if (flags[kFLAGS.USE_OLD_INTERFACE] <= 0)
			mainView.lustNum.text = Math.floor(player.lust) + "/" + player.maxLust();
			//else mainView.lustNum.text = "" + Math.floor(player.lust);

			//if (flags[kFLAGS.USE_OLD_INTERFACE] <= 0)
			mainView.fatigueNum.text = Math.floor(player.fatigue) + "/" + player.maxFatigue();
			//else Math.floor(player.fatigue);

			if ((flags[kFLAGS.HUNGER_ENABLED] > 0 || prison.inPrison) && flags[kFLAGS.URTA_QUEST_STATUS] != 0.75 && flags[kFLAGS.USE_OLD_INTERFACE] <= 0) {
				showHungerBar();
				mainView.hungerNum.text = Math.floor(player.hunger) + "/" + 100;
			}
			else {
				hideHungerBar();
			}
			if (prison.inPrison) {
				showPrisonBar();
				mainView.willNum.text = Math.floor(player.will) + ""; //"/" + 100;
				mainView.esteemNum.text = Math.floor(player.esteem) + ""; //"/" + 100;
				mainView.obeyNum.text = Math.floor(player.obey) + ""; //"/" + player.obeySoftCap ? 50 : 100;
			}
			else {
				hidePrisonBar();
			}
			//Display experience numbers.
			mainView.levelNum.text = String(player.level);
			if (player.level < kGAMECLASS.levelCap) mainView.xpNum.text = Math.floor(player.XP) + "/" + Math.floor(player.requiredXP());
			else mainView.xpNum.text = "MAX";
			mainView.gemsNum.text = addComma(Math.floor(player.gems)) + "";

			//Get rid of the space before colon. (For new)
			//if (flags[kFLAGS.USE_OLD_INTERFACE] <= 0) {
				mainView.strText.text = "Strength:";
				mainView.touText.text = "Toughness:";
				mainView.speText.text = "Speed:";
				mainView.inteText.text = "Intelligence:";
				mainView.libText.text = "Libido:";
				mainView.senText.text = "Sensitivity:";
				mainView.corText.text = "Corruption:";
				mainView.HPText.text = "HP:";
				mainView.lustText.text = "Lust:";
				mainView.fatigueText.text = "Fatigue:";
			/*} else {
				mainView.strText.text = "Strength    :";
				mainView.touText.text = "Toughness   :";
				mainView.speText.text = "Speed       :";
				mainView.inteText.text = "Intelligence:";
				mainView.libText.text = "Libido      :";
				mainView.senText.text = "Sensitivity :";
				mainView.corText.text = "Corruption  :";
				mainView.HPText.text = "HP          :";
				mainView.HPText.width = 130;
				mainView.lustText.text = "Lust        :";
				mainView.lustText.width = 130;
				mainView.fatigueText.text = "Fatigue     :";
				mainView.fatigueText.width = 130;
			}*/

			//Headers
			mainView.nameText.htmlText = "Name: " + player.short + "";
			if (prison.inPrison) mainView.advancementText.htmlText = "Prison Stats";
			else mainView.advancementText.htmlText = "Advancement";

			//Time display
			mainView.timeBG.alpha = 0;
			var minutesDisplay:String = "";
			if (model.time.minutes < 10) minutesDisplay = "0" + model.time.minutes;
			else minutesDisplay = "" + model.time.minutes;
			mainView.timeText.htmlText = "Day#: " + model.time.days + "\n";
			if (flags[kFLAGS.USE_12_HOURS] == 0) {
				mainView.timeText.htmlText += "Time: " + model.time.hours + ":" + minutesDisplay + "";
			}
			else {
				if (model.time.hours < 12) {
					if (model.time.hours == 0) mainView.timeText.htmlText += "Time: " + (model.time.hours + 12) + ":" + minutesDisplay + "am";
					else mainView.timeText.htmlText += "Time: " + model.time.hours + ":" + minutesDisplay + "am";
				}
				else {
					if (model.time.hours == 12) mainView.timeText.htmlText += "Time: " + model.time.hours + ":" + minutesDisplay + "pm";
					else mainView.timeText.htmlText += "Time: " + (model.time.hours - 12) + ":" + minutesDisplay + "pm";
				}
			}
			//if (timeTextFormat != null) mainView.timeText.setTextFormat(timeTextFormat);

			//Set theme!
			setTheme();
		}

		//Show/hide stats bars.
		public function tweenInStats():void {
			var t:Timer = new Timer(20, 21);
			if (!statsHidden) return;
			statsHidden = false;
			t.addEventListener(TimerEvent.TIMER, function():void { mainView.statsView.x += 10; mainView.statsView.alpha += 0.05; if (mainView.statsView.alpha > 1) mainView.statsView.alpha = 1;} );
			t.start();
		}
		public function tweenOutStats():void {
			var t:Timer = new Timer(20, 21);
			if (statsHidden) return;
			statsHidden = true;
			t.addEventListener(TimerEvent.TIMER, function():void { mainView.statsView.x -= 10; mainView.statsView.alpha -= 0.05; if (mainView.statsView.alpha < 0) mainView.statsView.alpha = 0; } );
			t.start();
		}

		//Animate buttons for startup!
		public function startUpButtons():void {
			if (buttonsTweened) return;
			buttonsTweened = true;
			for (var i:int = 0; i < 15; i++) {
				mainView.bottomButtons[i].y += 140;
			}
			var t:Timer = new Timer(1000, 1);
			t.addEventListener(TimerEvent.TIMER, tweenButtonsIn);
			t.start();
		}
		private function tweenButtonsIn(e:TimerEvent = null):void {
			var t:Timer = new Timer(20, 28);
			t.addEventListener(TimerEvent.TIMER, moveButtonsIn);
			t.start();
		}
		private function moveButtonsIn(e:TimerEvent):void {
			for (var i:int = 0; i < 15; i++) {
				mainView.bottomButtons[i].y -= 5;
			}
		}

		//Allows shift key.
		public function registerShiftKeys():void {
			if (!registeredShiftKey) {
				mainView.stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
				mainView.stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
				registeredShiftKey = true;
			}
		}

		public function keyPressed(event:KeyboardEvent):void {
			if (event.keyCode == Keyboard.SHIFT) {
				flags[kFLAGS.SHIFT_KEY_DOWN] = 1;
			}
		}
		public function keyReleased(event:KeyboardEvent):void {
			if (event.keyCode == Keyboard.SHIFT) {
				flags[kFLAGS.SHIFT_KEY_DOWN] = 0;
			}
		}
	}
}


code:
package classes
{
	import classes.GlobalFlags.kFLAGS;
	/**
	 * Class to make the measurement methods taken from PlayerAppearance globally accessible
	 * @since  19.08.2016
	 * @author Stadler76
	 */
	public class Measurements extends BaseContent
	{
		private static var _instance:Measurements = new Measurements();

		public function Measurements()
		{
			if (_instance != null)
			{
				throw new Error("Measurements can only be accessed through Measurements.init()");
			}
		}

		public static function init():Measurements { return _instance; }

		public function footInchOrMetres(inches:Number, precision:int = 2):String
		{
			if (flags[kFLAGS.USE_METRICS])
				return (Math.round(inches * 2.54) / Math.pow(10, precision)).toFixed(precision) + " metres";

			return Math.floor(inches / 12) + " foot " + inches % 12 + " inch";
		}

		public function numInchesOrCentimetres(inches:Number):String
		{
			if (inches < 1) return inchesOrCentimetres(inches);

			var value:int = Math.round(inches);

			if (flags[kFLAGS.USE_METRICS]) {
				value = Math.round(inches * 2.54);
				return num2Text(value) + (value == 1 ? " centimetre" : " centimetres");
			}

			if (inches % 12 == 0)
				return (inches == 12 ? "a foot" : num2Text(inches / 12) + " feet");

			return num2Text(value) + (value == 1 ? " inch" : " inches");
		}

		public function inchesOrCentimetres(inches:Number, precision:int = 1):String
		{
			var value:Number = Math.round(inchToCm(inches) * Math.pow(10, precision)) / Math.pow(10, precision);
			var text:String = value + (flags[kFLAGS.USE_METRICS] ? " centimetre" : " inch");

			if (value == 1) return text;

			return text + (flags[kFLAGS.USE_METRICS] ? "s" : "es");
		}

		public function shortSuffix(inches:Number, precision:int = 1):String
		{
			var value:Number = Math.round(inchToCm(inches) * Math.pow(10, precision)) / Math.pow(10, precision);
			return value + (flags[kFLAGS.USE_METRICS] ? "-cm" : "-inch");
		}

		public function inchToCm(inches:Number):Number
		{
			return flags[kFLAGS.USE_METRICS] ? inches * 2.54 : inches;
		}
	}
}