Fix hair, dick around with new game screen.
[18plus-7leafadventure.git] / src / org / sevenchan / dongs / bodyparts / Penis.as
blobd4e0956310f50fc340bbf6a90289c2da99cf380b
1 package org.sevenchan.dongs.bodyparts
4 import flash.net.registerClassAlias;
5 import org.sevenchan.dongs.clothing.Clothing;
6 import org.sevenchan.dongs.clothing.ClothingType;
7 import org.sevenchan.dongs.Creature;
8 import org.sevenchan.dongs.enchantment.*;
9 import org.sevenchan.dongs.screens.InfoScreen;
10 import org.sevenchan.dongs.weapons.IWeapon;
12 /**
13 * ...
14 * @author Harbinger
16 public class Penis implements IBodyPart
18 registerClassAlias("P_Dick", Penis);
20 public var size:Number = 0;
21 public var sizeMult:Number = 1;
22 public var _name:String;
24 private var _value:Number;
25 public var _location:String = "";
27 public function get location():String
29 return _location;
32 public function get value():Number
34 return _value;
37 public function Penis(name:String = "", value:Number = 400, sz:Number = 1, targetEnch:Enchantment = null, hostEnch:Enchantment = null)
39 _value = value;
40 size = sz;
41 this._name = name;
42 _location = "";
45 public function get name():String
47 return _name;
50 public function get category():String
52 return "dicks";
55 public function get sellDesc():String
57 return getDescr(-1, null);
60 public function getDescr(num:Number, host:Creature):String
62 var sizeDesc:String = "average";
63 var erectDesc:String = "flaccid";
64 var dick:String = getShortDescr();
65 var lust:Number = 0;
66 if (host != null)
67 lust = host.lust;
68 var sz:Number = size * sizeMult;
70 if (sz > 100)
71 sizeDesc = "bus-sized, bloated and";
72 else if (sz > 50)
73 sizeDesc = "man-sized, bulging and";
74 else if (sz > 35)
75 sizeDesc = "huge, pulsing and";
76 else if (sz > 20)
77 sizeDesc = "massive";
78 else if (sz > 10)
79 sizeDesc = "big";
80 else if (sz > 7)
81 sizeDesc = "large";
83 if (lust >= 100)
84 erectDesc = "rock-hard, throbbing";
85 else if (lust >= 75)
86 erectDesc = "hard";
87 else if (lust >= 50)
88 erectDesc = "hardening";
89 else if (lust >= 25)
90 erectDesc = "growing";
92 // massive rock-hard, throbbing 5" dicks
93 var dm:String = sizeDesc + " " + erectDesc + " " + MathUtils.inchesToFootInches(sz) + " " + name + " " + dick + ((num > 1) ? "s" : "");
94 if (num == -1)
95 return dm;
96 if (num == 1)
97 dm = "a single " + dm;
98 if (num > 1)
99 dm = num + " " + dm;
100 if (_location.length > 0)
101 dm = dm + " growing out of " + _location;
102 return dm;
105 public function getShortDescr(withModifier:Boolean = false):String
107 var t:String = "dick"
108 if (withModifier)
109 t = name + " " + t;
110 return t;
113 public function onFailedAttack(from:Creature, to:Creature):void
117 public function onGoodAttack(from:Creature, to:Creature):void
121 public function onAdded(atStore:Boolean, ply:Creature):void
123 // TODO: Needs work
124 var text:String = "<h2>New Penis</h2>";
125 if (atStore)
127 text += "<p>The shopkeeper whispers a few words, and then pokes your groin with her wand. You begin ";
128 text += "whispering your own hushed curses as you ";
130 else
132 text += "<p>You groan as you ";
134 text += "feel your groin heat up and begin bulging outward. The bulge then slowly ";
135 text += "worms outward, like a meaty tenticle, until it begins to take the shape of a " + getDescr(1, ply) + "."
136 InfoScreen.push(text);
139 public function onRemoved(atStore:Boolean, ply:Creature):void
141 // TODO: Needs work
142 var text:String = "<h2>Remove a Penis</h2>";
144 if (atStore)
145 text += "<p>The old woman mutters a few ancient words under her breath, and then jabs at your " + getDescr(1, ply) + " with her old wand, doing a twisting motion with her wrist as she does so. An accusing scowl takes over her face and she continues chanting, her voice becoming more angry. Almost like a dog running away from an angry owner with its tail tucked between its legs, your dong retreats back into your body and vanishes.</p>";
146 else
147 text += "<p>You groan as your " + getDescr(1, ply) + " retracts into your body like a hose being reeled in.</p>";
149 InfoScreen.push(text);
152 public function grow(ply:Creature, atStore:Boolean, _size:Number):String
154 // TODO: Needs work
155 this.size += _size;
156 var descr:String = getDescr(1, ply);
157 return "You feel more weight in your trousers. Frightened, you look down and see a penis has grown to become " + Utils.A(descr) + " " + descr + ".";
160 public function shrink(ply:Creature, atStore:Boolean, _size:Number):String
162 // TODO: Needs work
163 this.size -= _size;
164 return "You groan as you feel your " + getDescr(1, ply) + " sucked back into your body a few inches.";
167 private var _weapon:IWeapon = null;
169 public function get weapon():IWeapon
171 return _weapon;
174 public function tryEquip(weap:IWeapon):Boolean
176 return false;
179 public function getBulgeSize(host:Creature, c:Clothing):Number
181 if (c.type != ClothingType.PANTS)
182 return 0;
183 var horniness:Number = Number(host.lust+0.0) / 100.0;
184 var realsize:Number = Math.max(0.1, horniness) * (size*sizeMult);
185 trace("bsize of a " + MathUtils.inchesToFootInches(size * sizeMult) + "("+(size*sizeMult).toString()+", h"+horniness.toString()+") dick = " + realsize.toString());
186 return realsize;
189 public function isProducingABulge(host:Creature, c:Clothing):Boolean
191 if (getBulgeSize(host, c) > 6)
192 return true;
193 return false;
196 public function isProducingABulgeInSomething(host:Creature, clothing:Vector.<Clothing>):Boolean
198 for each (var c:Clothing in clothing)
200 if (getBulgeSize(host, c) > 6)
201 return true;
203 return false;
206 public function isConcealedBy(host:Creature, clothing:Vector.<Clothing>):Boolean
208 return clothing.some(function(c_:Object, index:int, vector:Vector.<Clothing>):Boolean
210 var c:Clothing = Clothing(c_);
211 if (c != null)
213 return (c.type.obscures.indexOf(category) > -1 && !isProducingABulge(host, c));
215 else
217 return false;