Fix hair, dick around with new game screen.
[18plus-7leafadventure.git] / src / org / sevenchan / dongs / clothing / Clothing.as
blob403158c198782c678a1b5bcba50f1fee5142dfcf
1 package org.sevenchan.dongs.clothing
3 import org.sevenchan.dongs.bodyparts.IBodyPart;
4 import org.sevenchan.dongs.Creature;
5 import org.sevenchan.dongs.Item;
6 import org.sevenchan.dongs.Screen;
7 import org.sevenchan.dongs.screens.InfoScreen;
8 /**
9 * An article of clothing or armor, is also an item.
10 * @author Harbinger
12 public class Clothing extends Item
14 public var HP:Number = 0;
15 public var maxHP:Number = 5;
16 public var type:ClothingType = ClothingType.HEADGEAR; // Determines what is obscured.
17 public var opaque:Boolean = true;
18 public var isArmor:Boolean = false;
20 public function Clothing(num:uint=0)
22 super(num);
25 /**
26 * Used by the body part to determine if it's being hidden.
27 * @param part
29 public function isObscuring(part:IBodyPart):Boolean {
30 return opaque && type.obscures.some(function(o:*):Boolean {
31 return part.category == (o as String);
32 });
35 public function getDescr(host:Creature):String {
36 return "[LOL NO GetDescr()!]";
39 override public function Use(host:Creature):Boolean
41 if ((HP / maxHP) < 0.1){
42 InfoScreen.push("This " + this.getDescr(host) + " is too damaged to be worn.");
43 return false;
45 var text:String = "";
46 switch(type) {
47 case ClothingType.FOOTWEAR:
48 if (host.legs.length == 0){
49 InfoScreen.push("You cannot wear this item, as you have no legs with feet on which to wear them.");
50 return false;
52 text = "You drop the " + this.getDescr(host) + " onto the ground and slide your feet into them, finding them nice and snug";
53 if (HP / maxHP < 0.5)
54 text += ", despite the holes";
55 else if (HP / maxHP < 0.7)
56 text += ", despite the obvious wear";
57 text += "."
58 break;
59 case ClothingType.HEADGEAR:
60 text = "You place the " + this.getDescr(host) + " onto your head, knowing that you now look";
61 if (HP / maxHP < 0.5)
62 text += " like a peasant on his way to a soup kitchen.";
63 else if (HP / maxHP < 0.7)
64 text += " like an old gentleman, the item being as worn as it is.";
65 else
66 text += " very dapper.";
67 break;
68 case ClothingType.PANTS:
69 if (host.legs.length == 0){
70 InfoScreen.push("You cannot wear this item, as you have no legs to wear them on.");
71 return false;
73 text = "You find a nice secluded area and slip into your " + this.getDescr(host);
74 if (HP / maxHP < 0.5)
75 text += ", being mindful of the huge holes slashed into the garment";
76 else if (HP / maxHP < 0.7)
77 text += ", aware of the worn knees and scratches.";
78 break;
79 case ClothingType.TOP:
80 text = "Ensuring no one's around to catch you off-guard, you slip the " + this.getDescr(host) + " over your head";
81 if (HP / maxHP < 0.5)
82 text += ", peeking through the holes and cuts to be sure no one sneaks up on you.";
83 else if (HP / maxHP < 0.7)
84 text += ", ignoring the scratches and loose fibers.";
85 break;
87 InfoScreen.push(text);
88 host.clothing.push(this);
89 return true;