Fix hair, dick around with new game screen.
[18plus-7leafadventure.git] / src / org / sevenchan / dongs / Town.as
blob2adbac938e16bdee85df3befd9ddd4456da9931a
1 package org.sevenchan.dongs
3 import flash.utils.Dictionary;
4 import flash.utils.getQualifiedClassName;
5 import org.sevenchan.AdventureController;
6 import org.sevenchan.dongs.bodyparts.Gender;
7 import org.sevenchan.dongs.creature.Human;
8 import org.sevenchan.dongs.creature.Player;
9 import org.sevenchan.dongs.screens.InfoScreen;
10 import org.sevenchan.dongs.screens.Shop;
11 import org.sevenchan.dongs.towns.*;
13 /**
14 * ...
15 * @author Harbinger
17 public class Town extends Screen
19 // Explore, Shop, Rest (10G), Leave, Fap
20 private var context:Array = [];
22 public var text:String = "";
24 public static var knownTowns:Object = {};
26 public var shops:Object = null;
28 /**
29 * ID of the town
31 public var ID:String = "";
33 /**
34 * Name of the town
36 public var name:String = "";
38 /**
39 * IDs of connected towns to list when exiting.
41 public var connectedTowns:Array = [];
43 /**
44 * Is this town actually a Wilds?
46 public var isWilds:Boolean = false;
48 /**
49 * Does this town have free room and board?
51 public var freeRest:Boolean = false;
53 /**
54 * What kinds of creatures inhabit this town? (Hostile and otherwise)
56 * TYPE => CHANCE (0-1)
58 public var inhabitants:Dictionary = new Dictionary();
60 private var menu:String = "main";
62 public var biome:Biome = Biome.WOODS;
64 public static function setup():void
66 Item.fillRegistry();
67 knownTowns = {barn: new TownBarn(), banala: new TownBanala(), damned: new TownDamned(), haara: new WildsHaaraWastes(), harpycabin: new TownHarpyCabin(), horus: new WildsHorusSpine(), lake: new WildsLake()};
70 public function Town()
72 this.appearanceButton = true;
73 this.debugMenuButton = true;
74 this.exportGameButton = false;
75 this.loadOrSaveButton = true;
76 this.newGameButton = false;
77 this.importGameButton = false;
79 this.clearButtons()
82 public function onShopBuyMenu():String
84 // TODO: Needs work
85 return "<p>&quot;So, what interests you today, buddy?&quot; The shopkeeper asks, watching you (and your money-bag) with great intensity.</p>";
88 public function onShopSellMenu():String
90 // TODO: Needs work
91 return "<p>&quot;All right, let's see what you got, chief.&quot;</p>";
94 public function onShopWelcome():String
96 // TODO: Needs work
97 return "<p>The shopkeeper is, as usual, mopping the old, dirty floor with an equally old and dirty mop when he notices you enter. His piggish face brightens a bit.</p>" + "<p>&quot;Oh great. My favorite customer.&quot; He mutters sarcastically, continuing to mop. &quot;So, do you wanna buy, or sell?&quot;</p>";
100 override public function processButtonPress(id:int):Boolean
102 if (id == -1)
104 menu = "main";
105 if (!main.player.getExplored(ID))
107 if (onRevelation())
109 main.player.setExplored(ID);
111 else
113 text += "You cannot enter this area... Yet.";
114 return false;
117 else
119 onEnter();
121 clearButtons();
122 setButton(0, "Explore");
123 if (!isWilds)
125 if (shops != null)
126 setButton(1, "Shop");
127 if (freeRest)
128 setButton(2, "Rest");
129 else
130 setButton(2, "Rest (10G)");
132 setButton(3, "Leave");
133 setButton(4, "Masturbate");
134 setButton(5, "Inventory");
135 updateScreen();
136 return false;
138 else
140 switch (menu)
142 case "main":
143 switch (id)
145 case 0:
146 var c:Creature = getRandomInhabitant();
147 if (c != null)
149 if (c.getHostile(main.player))
151 main.startCombat(this, c);
152 return false;
154 else
156 var encounter:Boolean = c.onEncounter(main.player)
157 if (!encounter)
158 onExplore(c);
159 return encounter;
162 onExplore(c);
163 break;
164 case 1:
165 menu = "shop";
166 clearButtons();
167 setButton(0, "Back");
168 var i:int = 0;
169 text = "<h2>Shop</h2><p>You look around cautiously for a place to buy some wares. After a cursory examination of your surroundings, you find the following places of commerce:</p><ul>";
170 context = [];
171 for (var shopName:String in shops)
173 i++;
174 setButton(i, shopName);
175 context.push(shopName);
176 text += "<li><b>" + shopName + "</b> - " + (shops[shopName] as Shop).description + "</li>";
178 text += "</ul>";
179 updateScreen();
180 return false;
181 break;
182 case 2:
183 menu = "rest";
184 if (main.player.gold >= 10 || freeRest)
186 //trace("success");
187 if (!freeRest)
188 main.player.gold -= 10;
189 onSuccessfulRest();
190 main.player.HP = main.player.maxHP;
191 main.refreshStats();
193 else
195 main.refreshStats();
196 onFailedRest();
198 clearButtons();
199 setButton(NEXT_BUTTON, "Next");
200 updateScreen();
201 return false;
202 break;
203 case 3:
204 menu = "leave";
205 clearButtons();
206 setButton(0, "CANCEL");
207 text = "<p>You peer at the roadsigns in the middle of town and try to make out the destinations.</p>";
208 if (connectedTowns.length == 0)
210 text += "<p>However, you cannot make them out (bug; connectedTowns=[]).</p>";
212 else
214 text += "<ul>";
215 for (var j:int = 0; j < connectedTowns.length; j++)
217 var t:Town = Town.knownTowns[connectedTowns[j]];
218 setButton(j + 1, t.ID);
219 if (t.isWilds)
220 text += "<li><b>" + t.ID + "</b> - " + t.name + " (Wilds)</li>";
221 else
222 text += "<li><b>" + t.ID + "</b> - " + t.name + "</li>";
224 text += "</ul>";
226 updateScreen();
227 return false;
228 break;
229 case 4:
230 setButton(NEXT_BUTTON, "NEXT");
231 text = "<h2>Masturbate</h2>";
232 if (main.player.currentTown.isWilds)
234 getWildsMasturbation();
236 else
238 text += getShelteredMasturbation();
240 var propText:String = getPropositioned();
241 if (propText.length > 0)
243 // Let the system handle it
244 return false;
246 text += "<p>The yearning for release drives you on, pushing you to ";
247 if (main.player.gender.hasDick)
248 text += "pump";
249 if (main.player.gender.hasDick && main.player.gender.hasVag)
250 text += " and ";
251 if (main.player.gender.hasVag)
252 text += "finger";
253 text += " as fast as you can. Grimacing in sheer delight, you moan out in ecstasy. With feverish need, ";
254 text += "you bring yourself to the point of no return and groan in primal bliss as your orgasm";
255 if (main.player.gender.hasDick)
257 text += " works its way up your " + Utils.pluralize(main.player.dicks.length, "cock") + ".";
258 //TODO: Need to get clarification on these, as cum amount is determined by the testicles.
259 // Low:
260 if (main.player.balls.length >= 2 && main.player.balls.length < 4)
262 text += "Your "+Utils.pluralize(main.player._dicks.length,"prick erupts","pricks erupt")+" with thin strands of semen that arc through the air, landing on ";
263 text += "the ground before you."
265 // Moderate:
266 if (main.player.balls.length >= 4 && main.player.balls.length < 8)
268 text += "Drooling with lust, your "+Utils.pluralize(main.player._dicks.length,"cock unleashes its","cocks unleash their")+" liberal payload ";
269 text += "against the ground, coating it in thick strands of your pent up arousal.";
271 // High:
272 if (main.player.balls.length >= 8)
274 text += "Release is fast and furious, as your "+Utils.pluralize(main.player._dicks.length,"member explodes and rains its","members explode and rain their")+" copious juices all over the immediate area, dosing you in jism while you twitch uncontrollably.";
277 else if (main.player.gender.hasVag)
279 var vagDescr:String = main.player.vaginas[0].getDescr(1, main.player);
280 //text += "ic excitement throbs through your " + ;
281 // Reword this, makes the PC sound like a fucking werewolf.
282 text += " gushes forth from your " + vagDescr + "; the culmination of your sexual talent and pent up lust bringing forth a noisy series of howls from your mouth.";
284 else
286 text += " hits your body like a runaway oxcart.";
288 text += "</p>";
289 text += "<p>Spent, you lie against the ground, breathing heavily as you pant from the exhaustive efforts. ";
290 text += "You decide that laying there for a bit doesn’t sound like a bad idea, you think to yourself, ";
291 text += "still high on the rush of orgasm as you rest.</p>";
292 text += "<p>Once your strength returns, you grab a hold of your clothing and proceed to don it once more, ";
293 text += "eager to set out and stop the Demon menace that ravages both these lands.</p>";
294 main.player.lust = 0;
295 updateScreen();
296 return false;
297 break;
298 case 5:
299 main.showInventory();
300 return false;
301 break;
303 updateScreen();
304 return false;
305 break;
306 case "shop":
307 if (id == 0)
309 processButtonPress(-1);
310 return false;
312 AdventureController.screenQueue.write(shops[context[id - 1]] as Shop);
313 return true;
314 break;
315 case "rest":
316 processButtonPress(-1);
317 break;
318 case "leave":
319 if (id == 0)
321 processButtonPress(-1);
322 return false;
324 main.setTown(knownTowns[connectedTowns[id - 1]]);
325 return true;
326 case "inventory":
328 case "masturbate":
329 break;
332 return false;
335 public function getWildsMasturbation():String
337 var t:String = "";
338 t += "<p>The lust boiling in your loins is too much to ignore anymore as you nervously look around ";
339 t += "for other signs of life; you don’t want some sex crazed Demon or creature to get the drop on ";
340 t += "you while you tend to your urges. ";
341 if ((main.player as Player).baseType is Human)
343 t += "Or worse, by some stroke of chance having a survivor from your unit stumble upon you as you ";
344 t += "relieve a little &quot;tension&quot;.";
346 t += "</p><p>";
347 t += "Spotting only the harmless landscape, you deem that its safe enough to find someplace private ";
348 t += "and get intimately acquainted with your body.</p>";
350 var gbody:String = (main.player.gender == Gender.ASEXUAL) ? "body" : "genitalia";
352 switch (main.player.currentTown.biome)
354 case Biome.WOODS:
355 t += "<p>Ducking into a secluded bush, you endeavor to work yourself free of your ";
356 t += "clothing and free your ";
357 switch (main.player.gender)
359 case Gender.FEMALE:
360 t += Utils.pluralize(main.player.vaginas.length, "vagina");
361 break;
362 case Gender.HERM:
363 t += "genitalia";
364 break;
365 case Gender.MALE:
366 t += Utils.pluralize(main.player.dicks.length, "cock");
367 break;
368 case Gender.ASEXUAL:
369 t += "body";
370 break;
372 break;
373 case Biome.PLAINS:
374 var sexes:String = (main.player.gender == Gender.ASEXUAL) ? "body" : Utils.pluralize(main.player.vaginas.length + main.player.dicks.length, "sex", "sexes");
375 t += "<p>Concealing yourself in between a pair of boulders, you finally indulge the ";
376 t += "ceaseless lamentations of your " + sexes + " and free ";
377 switch (main.player.gender)
379 case Gender.FEMALE:
380 t += "your " + Utils.pluralize(main.player.vaginas.length, "vagina");
381 break;
382 case Gender.HERM:
383 t += "your genitalia";
384 break;
385 case Gender.MALE:
386 t += "your " + Utils.pluralize(main.player.dicks.length, "cock");
387 break;
388 case Gender.ASEXUAL:
389 t += "yourself";
390 break;
392 t += " of your clothing</p>";
393 break;
394 case Biome.BEACH:
395 t += "<p>Finding a nice, out of way spot on the hot sand, you eagerly strip down and ";
396 t += "expose your " + gbody + " to the brisk air that blows over the tranquil environment.</p>";
397 break;
398 case Biome.JUNGLE:
399 t += "<p>Working your way up the humid, slippery trunk of a tree, you manage to perch ";
400 t += "yourself on a stable branch that’s high enough off the ground to give you some advance ";
401 t += "warning.</p>";
402 break;
403 case Biome.MOUNTAINS:
404 t += "<p>Shielded from the whipping winds of this plateau by welcome rockface, you ";
405 t += "breath a sigh of relief and take in the feeling of solid ground under your body; ";
406 t += "something that's been sorely lacking as you’ve explored these mountains. Now filled ";
407 t += "with a sense of security, you work to remove your clothing and bring your " + gbody + " to attention.</p>";
408 break;
409 case Biome.CAVE:
410 t += "<p>After scoping out and wiping down a well hidden hole in the cavernous ";
411 t += "tunnels, you climb inside and quickly undo your pant buckles. Even in the darkness, you ";
412 t += "instinctively know where ";
413 if (main.player.gender == Gender.ASEXUAL)
415 t += "your " + gbody + " are, reaching down and taking a firm hold on ";
416 t += Utils.pluralize(main.player.vaginas.length + main.player.dicks.length, "it", "them") + ".";
418 else
420 t += "you need to touch, trying your best to trigger a body shuddering spasm of joyful gratification.";
422 break;
424 return t;
427 public function getShelteredMasturbation():String
429 var t:String = "<p>Your physical arousal no longer deniable, you find your hands taking to your ";
430 if (main.player.gender.hasDick)
431 t += Utils.stripA(main.player.getDickDescr());
432 else if (main.player.gender.hasVag)
433 t += Utils.stripA(main.player.getVagDescr());
434 else
435 t += "body";
436 t += " with a primal need, ";
437 if (main.player.gender.hasDick)
438 t += "stroking the sensitive features of your flaring head";
439 else
440 t += "caressing your tender skin";
441 t += " with such tantalizing efforts that only you know how to achieve. Closing your eyes, you allow";
442 t += " the physical touch of your efforts to resonate through your body; your hunger for sexual";
443 t += " stimulation at long last being sated as ";
444 if (main.player.gender.hasDick)
445 t += "the rise and fall of your palm against your flesh causes you to groan in satisfaction. ";
446 else
447 t += "the sensation of your delicate fingers solicits a whimper from your pursed mouth. ";
448 t += "Physically flushed with pleasure you power onwards, ";
449 if (main.player.gender.hasDick)
450 t += "pumping your " + Utils.pluralize(main.player.dicks.length, "cock") + " with ever increasing ferocity";
451 else
452 t += "taking to your pussy like a succulent pastery as you work your fingers into your honey pot, the surprise jolt of intense euphoria teasing your mind.";
453 t += "</p>";
454 return t;
457 public function getPropositioned():String
459 var t:String = text;
460 //Check to see if PC is propositioned by a passer-by (monster girl, etc) or attacked
461 var c:Creature = this.getRandomInhabitant();
462 if (c == null)
463 return "";
464 if (!isWilds && c.getInterested(main.player))
466 t += "<p>&quot;H-hey!&quot; A voice rings out, startling you as you snap back to reality.</p>";
467 t += "<p>Expecting the worst, ";
468 if (main.player.hasAnyWeapon())
470 t += "you reach for your weapon";
472 else
474 t += "ready yourself for battle";
476 t += ". &quot;Whoa, WHOA! Take it easy!&quot; The " + c.getTypeName() + " exclaims, palms facing you in a defensive gesture.";
477 t += " &quot;I heard you... tending to yourself and was coming to see who it was...” %SUB% states, before looking you up";
478 t += " and down. &quot;Mhmmm... and whether they wanted to give up playing with themselves and spend some time with me instead.&quot;";
479 t += "</p>";
481 t += "<p>Your visitor is " + c.getDescription() + "</p>";
482 t += "<p>&quot;Full disclosure: <b>I'm actually a " + c.gender.label + "</b>,&quot; %CSUB% blushes beet red with the revelation.</p>";
484 t += "<p>Do you want to forego masturbation and indulge the " + c.getTypeName() + ", or would you rather not?</p>";
485 t = c.getApparentGender().doReplace(t);
488 if (isWilds && c.getHostile(main.player))
490 t += "The sounds of something moving around your hiding spot ";
491 t += "draws you from the realm of carnal gratification and into the real world. Cautiously, you ";
492 if (main.player.hasAnyWeapon())
493 t += "reach for your " + main.player.getFirstWeapon().name;
494 else
495 t += "ready yourself for a fight."
496 t += "&quot;I can smell your excitement in the air! Why don’t you come on out here and let me have a little fun with you...&quot;";
497 t += "The unknown entity calls out. &quot;I’d <i>hate</i> to have to hurt you if you resist; I doubt you can take me when I’ve ";
498 t += "caught you with your ";
499 if (main.player.gender.hasDick)
500 t += "dick in your hand";
501 else
502 t += "pants down";
503 t += ".&quot;</p>";
504 t += "<p><i>Great, no time to suit back up</i>, you think to yourself. Your musings and disappointment in being found are ";
505 t += "shattered as a pair of eyes dart towards your face. &quot;Gotcha!&quot; The " + c.getTypeName() + " cries out, grinning like a ";
506 if (c.getApparentGender().hasDick)
507 t += "man";
508 else
509 t += "woman";
510 t += " possessed at the &quot;bounty&quot %SUB% has happened upon.";
511 t = c.getApparentGender().doReplace(t);
512 //leads to a butt naked fight.
513 InfoScreen.push(t);
514 // Detach all clothing.
515 main.player.inventory.push(main.player.clothing);
516 main.player.clothing.splice(0, main.player.clothing.length);
517 main.startCombat(null, c, false);
518 return "combat";
520 return t;
523 //Being found isn’t triggered
525 //Haven't implemented anything for this yet.
526 //Massaging
528 //Sexual stimulation certainly can be difficult when you lack the proper “equipment” to do so, but you are determined to rid yourself of all this pent up lust. As you strip down to your birthday suit you begin to caress at your body, allowing your digits to teasingly slide across your chest and stomach.
530 //PC is at level 0 Massage: It’s hard to properly stimulate yourself when you have so little
531 //experience with this sort of thing, but you trudge on regardless as...
533 //PC is at level 1 Massage: What little experience you possess allows for a more sensual rub down, but you definitely have much to learn if you are to properly manage your lust in your current state.
535 //PC is at level 2-3 Massage: Now possessing some experience at getting yourself off to your own soft tough, you are much more adept at releasing sexual tension, and you eagerly look forward to improving on your technique.
537 //PC is at level 4-5 Massage: Stimulating your sexless body has become as natural as breathing, and you crave the near orgasmic state you can bring yourself to now as...
539 //!!Check for interruption at this point!! Display standard interruption dialouge for whatever gets triggered; proposition or attacked
541 //Your hands busily explore your sexless body, sweeping along your [breast descript] and [nipple descript] before darting down to your [thigh descript], massaging the sensitive contours of your lower torso. You
543 //PC is at level 0-1: attempt to derive what little pleasure you can from your unco-ordinated and ultimately blinded efforts to stimulate yourself, frustratingly deprived of the release you so crave.
545 //PC is at level 2-3 bask in the satisfying embrace of your hands, eager to further your
546 //skills as you feel yourself coming so close to “release”.
548 //PC is at level 4-5: can’t help but twitch like a bug under a magnifying glass, the supple
549 //touch of your fingers along your [skin] simply too much to bear as you fall over in “orgasm”, unleashing a series of distorted moans as you surrender yourself to sensual bliss.
551 //Endings for all except levels 4-5
553 //With some time and effort you manage to slate some of your pent up lust, rising to your feet and breathing a final, heavy sigh of relief. It hasn’t dissipated completely, but it’s better than the state you you were in when you started. Eager to get back to your adventure you reach down and grab your [armor], hopping along as you work yourself back into your attire.
555 //Ending for levels 4-5
557 //“Normal” people might place a lot of importance on having genitalia or the ability to “orgasm”; they can have them! you think to yourself, still reeling from your body shaking spasm of sensual pleasure. You’ll get your (armor) back on soon enough; right now you just want to lay back, smile, and enjoy the fruits of your labor.
559 override public function getScreenText():String
561 return text;
565 * omg new town what's it like
567 public function onRevelation():Boolean
569 text = "REVELATION";
570 return true;
573 public function onExplore(bumpedInto:Creature):void
575 text = "EXPLORE";
578 public function onEnter():void
580 text = "ENTER";
583 public function onFailedRest():void
585 text = "FAILEDREST";
588 public function onSuccessfulRest():void
590 text = "SUCCESSFULREST";
593 public function getRandomInhabitant():Creature
595 for (var type:Object in inhabitants)
597 var c:Creature = type as Creature;
598 var rnd:Number = Math.random();
599 trace("CRND", getQualifiedClassName(c), rnd);
600 if (inhabitants[type] > rnd)
602 c.setupBody();
603 return c;
606 return null;