Fix hair, dick around with new game screen.
[18plus-7leafadventure.git] / src / org / sevenchan / dongs / screens / WitchShopScreen.as
bloba4195f6e8f18836cf62e78470c8413c456a0ce2c
1 package org.sevenchan.dongs.screens
3 import flash.utils.*;
4 import org.sevenchan.AdventureController;
5 import org.sevenchan.dongs.bodyparts.Breast;
6 import org.sevenchan.dongs.bodyparts.Penis;
7 import org.sevenchan.dongs.Item;
8 import org.sevenchan.dongs.items.GoldPotion;
9 import org.sevenchan.dongs.items.PinkPotion;
10 import org.sevenchan.dongs.items.Potion;
11 import org.sevenchan.dongs.Screen;
13 /**
14 * ...
15 * @author Harbinger
17 public class WitchShopScreen extends Screen
19 private var page:String = "main";
20 private var subpage:String = "main";
21 private var text:String = "";
22 private var state:String = "main";
23 private var title:String = "";
24 private var priceoffset:Number = 0;
25 private var dickincrement:Number = 0;
26 private var type:int = 0;
27 private var inventory:Array = [];
29 public static function push(id:int = -1):void
31 AdventureController.screenQueue.write(new WitchShopScreen(id));
34 public function WitchShopScreen(id:int = -1)
36 if (id == -1)
37 id = MathUtils.rand(0, 3);
38 this.type = id;
39 switch (id)
41 //Oh god don't sue me
42 case 0:
43 setup(-5, 3, "Mildred's Manacles: Body Parts for LESS!");
44 break;
45 case 1:
46 setup(0, 6, "Hallasee's Potion Shoppe: Always Low Quality. Always.");
47 inventory = [
48 new GoldPotion(MathUtils.rand(6, 10)),
49 new PinkPotion(MathUtils.rand(6, 10))];
50 break;
51 case 2:
52 setup(1, 12, "Ehf's Dick Depot: Every Fuck Begins with Ehf.");
53 break;
54 case 3:
55 setup(10, 24, "Granny Rasputin's Grand Gonads: The Balls of Champions.");
56 break;
60 private function setup(po:Number, i:Number, t:String):void
62 this.title = t;
63 this.priceoffset = po;
64 this.dickincrement = i;
67 override public function processButtonPress(id:int):Boolean
69 clearButtons();
70 trace(id, page);
71 if (page == "main")
72 return onStartupScreen(id);
73 if (page == "buy")
74 return onBuy(id);
75 if (page == "sell")
76 return onSell(id);
77 if (page == "bodymod")
78 return onBodyMod(id);
79 return false;
82 override public function getScreenText():String
84 return text;
87 public function onStartupScreen(id:int):Boolean
89 switch (id)
91 case 0: // Buy
92 page = "buy";
93 return onBuy(-1);
94 break;
95 case 1: // Sell
96 page = "sell";
97 return onSell(-1);
98 break;
99 case 2: // BodyMods
100 page = "bodymod";
101 return onBodyMod(-1);
102 break;
103 case 3: // leave
104 return true;
105 break;
107 //[Buy] [Sell] [Change]
108 setButton(0, "Buy");
109 setButton(1, "Sell");
110 setButton(2, "Body Mods");
111 setButton(3, "Leave");
112 text = "<p>While walking through the town, your arm is grabbed by a frail-looking old woman. She ogles you, and then pulls a wand from the folds of her strange-looking clothing. It immediately dawns upon you that she is a Witch and is about to cast a spell. <i>Shit-</i> You think, right before she waves the wand.</p>";
113 text += "<p>A flash blinds you, and, instead of waking up at the barn, you look around and find that you're in a old, rustic shop that sprung up around you and the witch after she used her wand.</p>";
114 text += "<p>A cackle brings you to attention. The old woman is reclining precariously on a stool behind the shop's counter, surrounded by what can only be prices on various items. You're startled to see that there are some numbers beside illustrations of body parts, as well. The old woman notices your visible shock. &quot;Oh, come on, my prices aren't THAT bad.&quot; She frowns. &quot; So, tell me what you want.&quot;</p>";
115 text += "<p>Well, it couldn't hurt to ask. &quot;Well, a translation would be nice. I'm from out of town.&quot; You request sheepishly.</p>";
116 text += "<p>The witch looks at you in confusion, and then her expression gives way to embarassment. &quot;Oh, crap. I forgot to change the menus from Orcish. Just a moment...&quot; A wave of her wand later, and the title and purpose of the establishment becomes readable:</p>";
117 text += "<p><b>" + title + "</b></p>";
118 text += "<p>At this shop, and those like it, you can buy and sell potions, and buy modifications to your body.</p>";
119 updateScreen();
120 return false;
123 public function onBuy(id:int):Boolean
125 var item:Item = null;
126 text = "<h2>Buy</h2>";
127 text += "<ul>";
128 setButton(0, "BACK");
129 for (var i:int = 0; i < inventory.length; i++)
131 // 2x WhiteBerry (15G)
132 item = inventory[i];
133 text += "<li><b>" + item.amount + "x " + item.name + " (" + (item.value + priceoffset) + "G)</b> - <i>" + item.descr + "</i></li>";
134 setButton(i + 1, item.name);
136 text += "</ul>";
138 if (id == 0)
140 page = "main";
141 return processButtonPress(-1);
143 if (id > 0)
145 item = Item.findByID((inventory[id - 1] as Item).id);
146 var price:int = (item.value + priceoffset);
147 // Check if we have enough money
148 if (main.player.gold - price < 0)
150 text = "You don't have enough money for this.";
151 updateScreen();
152 return false;
154 // Deduct from store
155 (inventory[id - 1] as Item).amount--;
156 if ((inventory[id - 1] as Item).amount == 0)
158 inventory.splice(id - 1, 1);
161 // Give to player
162 item.amount = 1;
163 main.player.addToInventory(item);
164 main.player.gold -= price;
165 main.refreshStats();
166 updateScreen();
167 return false;
169 updateScreen();
170 return false;
173 public function onSell(id:int):Boolean
175 var i:int = 0;
176 var item:Item = null;
177 text = "<h2>Sell</h2>";
178 setButton(0, "BACK");
179 if (inventory.length > 0)
181 text += "<ul>";
182 for (i = 0; i < main.player.inventory.length; i++)
184 // 2x WhiteBerry (15G)
185 item = main.player.inventory[i];
186 text += "<li><b>" + item.amount + "x " + item.name + " (" + (item.value - priceoffset) + "G)</b> - <i>" + item.descr + "</i></li>";
187 setButton(i + 1, item.name);
189 text += "</ul>";
191 else
193 text += "<p><i>You have nothing to sell.</i></p>";
196 if (id == 0)
198 page = "main";
199 return processButtonPress(-1);
201 if (id > 0)
203 item = main.player.inventory[id - 1]
204 trace("SHOPSCREEN ITEM", item);
205 if (item is Item)
207 item = item.copy();
208 var price:Number = (item.value - priceoffset);
209 item.amount = 1;
210 main.player.takeFromInventory(item);
211 main.player.gold += price;
212 main.refreshStats();
214 updateScreen();
215 return false;
217 updateScreen();
218 return false;
221 public function onBodyMod(id:int):Boolean
223 if (subpage == "main")
225 text = "<h2>Body Modifications</h2>";
226 // BACK Species Penises Testes Vaginas Breasts
227 // Abilities Enchant Arms Legs Wings
228 setButton(0, "BACK");
229 setButton(1, "Species");
230 setButton(2, "Penises");
231 //setButton(3, "Testes");
232 //setButton(4, "Vaginas");
233 //setButton(5, "Breasts");
234 //setButton(7, "Abilities");
235 //setButton(8, "Enchant");
236 //setButton(9, "Arms");
237 //setButton(10, "Legs");
238 //setButton(11, "Wings");
240 if (id == -1)
241 subpage = "main";
242 switch (id)
244 case 0:
245 page = "main";
246 return processButtonPress(-1);
247 break;
248 case 1:
249 subpage = "species";
250 id = -1;
251 break;
252 case 2:
253 subpage = "penises";
254 id = -1;
255 break;
256 case 3:
257 subpage = "testes";
258 id = -1;
259 break;
260 case 4:
261 subpage = "vaginas";
262 id = -1;
263 break;
264 case 5:
265 subpage = "breasts";
266 id = -1;
267 break;
268 case 7:
269 subpage = "abilities";
270 id = -1;
271 break;
272 case 8:
273 subpage = "enchantments";
274 id = -1;
275 break;
276 case 9:
277 subpage = "arms";
278 id = -1;
279 break;
280 case 10:
281 subpage = "legs";
282 id = -1;
283 break;
284 case 1:
285 subpage = "wings";
286 id = -1;
287 break;
291 if (subpage == "species")
292 return BSChooseSpecies(id);
293 if (subpage == "penises")
294 return BSPenises(id);
295 if (subpage == "testes")
296 return BSTestes(id);
297 //if (subpage == "vaginas")
298 // return BSVaginas(id);
299 //if (subpage == "breasts") return BSBreasts(id);
300 //if (subpage == "abilities") return BSAbilities(id);
301 //if (subpage == "enchantments") return BSEnchantments(id);
302 //if (subpage == "arms") return BSArms(id);
303 //if (subpage == "legs") return BSLegs(id);
304 //if (subpage == "wings") return BSWings(id);
305 updateScreen();
306 return false;
309 public function BSChooseSpecies(id:int):Boolean
311 if (main.player.gold < 1000)
313 InfoScreen.push("<h2>Transformation</h2><p>You do not have enough gold.</p>");
314 WitchShopScreen.push();
315 return true;
317 text = "<h2>Choose a Species</h2><p>Choose any creature to change into it for 1000G.</p>";
318 clearButtons();
319 setButton(0, "CANCEL");
320 setButton(1, "Arachnid");
321 setButton(2, "Bova");
322 setButton(3, "Demon");
323 setButton(4, "Harpy");
324 setButton(4, "Human");
326 switch (id)
328 case 0:
329 subpage = "main";
330 return processButtonPress(-1);
331 break;
332 case 1:
333 main.player.changeTo(CreatureRegistry.arachnid);
334 main.player.gold -= 1000;
335 WitchShopScreen.push(type);
336 return true;
337 break;
338 case 2:
339 main.player.changeTo(CreatureRegistry.bova);
340 main.player.gold -= 1000;
341 WitchShopScreen.push(type);
342 return true;
343 break;
344 case 3:
345 main.player.changeTo(CreatureRegistry.demon);
346 main.player.gold -= 1000;
347 WitchShopScreen.push(type);
348 return true;
349 break;
350 case 4:
351 main.player.changeTo(CreatureRegistry.harpy);
352 main.player.gold -= 1000;
353 WitchShopScreen.push(type);
354 return true;
355 break;
356 case 5:
357 main.player.changeTo(CreatureRegistry.human);
358 main.player.gold -= 1000;
359 WitchShopScreen.push(type);
360 return true;
361 break;
363 updateScreen();
364 return false;
367 private function addMenuOption(id:int, label:String, price:Number, descr:String):String
369 // * Add Penis ($400) - Grow a new penis of your choice.
370 if (main.player.gold >= price)
371 setButton(id, label);
372 return "<li><b>" + label + " (" + price.toString() + "G)</b> - " + descr + "</li>";
375 public function BSPenises(id:int):Boolean
377 trace("BSPenises", id)
378 clearButtons();
379 setButton(0, "CANCEL");
380 text = "<h2>Penis Modifications</h2><p>Here, you can modify your member(s)... For a price.</p>";
381 text += "<ul>";
382 text += addMenuOption(1, "Add", 1000 + priceoffset, "Grow a new penis of your choice");
383 var numdicks:int = main.player.dicks.length;
384 if (numdicks > 0)
386 text += addMenuOption(2, "Remove", -900 + priceoffset, "Remove one of your penises and sell it to the store.");
387 text += addMenuOption(3, "Grow", numdicks * (100 + priceoffset), "Make your dongs bigger (by 6\")");
388 text += addMenuOption(4, "Shrink", numdicks * (100 + priceoffset), "Shrink your wangs (by 6\")");
389 //text += addMenuOption(5, "Reset", 1000 + priceoffset, "Reset your groin to the default number, type, and size of dicks for your species.");
391 text += "</ul>";
393 switch (id)
395 case 0:
396 subpage = "main";
397 return processButtonPress(-1);
398 break;
399 case 1:
400 var wang:Penis = main.player.addDick();
401 if (wang == null)
403 InfoScreen.push("Your species doesn't have a default penis, so you'll get a human dick instead.");
404 wang = BodyPartRegistry.human_penis;
406 wang.onAdded(true, main.player);
407 WitchShopScreen.push(type);
408 main.player.gold -= 1000 + priceoffset;
409 return true;
410 break;
411 case 2:
412 wang = main.player.dicks.pop();
413 main.player.gold += 900 - priceoffset;
414 wang.onRemoved(true, main.player);
415 WitchShopScreen.push(type);
416 return true;
417 break;
418 case 3:
419 text = "<h2>Grow Dicks</h2>";
420 var glassDesc:String = "shot glass";
421 if (dickincrement >= 6 && dickincrement < 12)
423 glassDesc = "vial";
425 else if (dickincrement >= 12 && dickincrement < 18)
427 glassDesc = "flask";
429 else if (dickincrement >= 18 && dickincrement < 24)
431 glassDesc = "tumbler";
433 else if (dickincrement >= 24)
435 glassDesc = "beer mug";
437 text += "<p>The proprietor of the shop produces a " + glassDesc + " full of a maroon, murky liquid and hands the warm glass ";
438 text += "to you. </p><p>&quot;Drink.&quot; She directs in a bored tone.</p><p>You give the liquid a quick glance, and then ";
439 text += "shrug, raising the " + glassDesc + " to your lips and draining it of its sweet contents. It doesn't take long for ";
440 text += "the effects to take hold, as pins-and-needles rush over your " + Utils.pluralize(main.player.dicks.length,"penis") + ". The skin tightens, ";
441 text += "and then expands. You groan loudly as your " + Utils.pluralize(main.player.dicks.length,"member") + " erect to their full size, and then ";
442 text += "continue until they reach the size you requested:</p><ul>";
443 for (var i:int = 0; i < main.player.dicks.length; i++)
445 text += "<li>" + main.player.dicks[i].grow(main.player, true, dickincrement) + "</li>";
446 main.player.gold -= 100 + priceoffset;
448 text += "</ul>";
449 break;
450 case 4:
451 text = "<h2>Shrink Dicks</h2>";
452 text += "<p>The old woman nods after counting her cash, picks up her wand, and then suddenly screams at your groin, pointing ";
453 text += "her wand at it. She stops and returns to counting her cash as your penises retract the amount you specified:</p>";
454 text += "<ul>";
455 for (i = 0; i < main.player.dicks.length; i++)
457 text += "<li>" + main.player.dicks[i].shrink(main.player, true, dickincrement) + "</li>";
458 main.player.gold -= 100 + priceoffset;
460 text += "</ul>";
461 break;
462 case 5:
463 var cc:Class = getDefinitionByName(getQualifiedClassName(main.player)) as Class;
464 var c:Creature = new cc();
465 main.player.gold -= 1000;
466 return true;
467 break;
469 updateScreen();
470 return false;
473 public function BSTestes(id:int):Boolean
475 trace("BSPenises", id)
476 clearButtons();
477 setButton(0, "CANCEL");
478 text = "<h2>Testicle Modifications</h2><p>Here, you can modify your nut(s)... For a price.</p>";
479 text += "<ul>";
480 text += addMenuOption(1, "Add", 1000 + priceoffset, "Grow a new testicle of your choice");
481 var numballs:int = main.player.dicks.length;
482 if (numballs > 0)
484 text += addMenuOption(2, "Remove", -900 + priceoffset, "Remove one of your balls and sell it to the store.");
485 //text += addMenuOption(5, "Reset", 1000 + priceoffset, "Reset your groin to the default number, type, and size of dicks for your species.");
487 text += "</ul>";
489 switch (id)
491 case 0:
492 subpage = "main";
493 return processButtonPress(-1);
494 break;
495 case 1:
496 var wang:Penis = /*main.player.addBall()*/null;
497 if (wang == null)
499 InfoScreen.push("Your species doesn't have a default penis, so you'll get a human dick instead.");
500 wang = BodyPartRegistry.human_penis;
502 wang.onAdded(true, main.player);
503 WitchShopScreen.push(type);
504 main.player.gold -= 1000 + priceoffset;
505 return true;
506 break;
507 case 2:
508 wang = main.player.dicks.pop();
509 main.player.gold += 900 - priceoffset;
510 wang.onRemoved(true, main.player);
511 WitchShopScreen.push(type);
512 return true;
513 break;
514 case 3:
515 text = "<h2>Grow Dicks</h2>";
516 var glassDesc:String = "shot glass";
517 if (dickincrement >= 6 && dickincrement < 12)
519 glassDesc = "vial";
521 else if (dickincrement >= 12 && dickincrement < 18)
523 glassDesc = "flask";
525 else if (dickincrement >= 18 && dickincrement < 24)
527 glassDesc = "tumbler";
529 else if (dickincrement >= 24)
531 glassDesc = "beer mug";
533 text += "<p>The proprietor of the shop produces a " + glassDesc + " full of a maroon, murky liquid and hands the warm glass ";
534 text += "to you. </p><p>&quot;Drink.&quot; She directs in a bored tone.</p><p>You give the liquid a quick glance, and then ";
535 text += "shrug, raising the " + glassDesc + " to your lips and draining it of its sweet contents. It doesn't take long for ";
536 text += "the effects to take hold, as pins-and-needles rush over your " + Utils.pluralize(main.player.dicks.length,"penis") + ". The skin tightens, ";
537 text += "and then expands. You groan loudly as your " + Utils.pluralize(main.player.dicks.length,"dick") + " erect to their full size, and then ";
538 text += "continue until they reach the size you requested:</p><ul>";
539 for (var i:int = 0; i < main.player.dicks.length; i++)
541 text += "<li>" + main.player.dicks[i].grow(main.player, true, dickincrement) + "</li>";
542 main.player.gold -= 100 + priceoffset;
544 text += "</ul>";
545 break;
546 case 4:
547 text = "<h2>Shrink Dicks</h2>";
548 text += "<p>The old woman nods after counting her cash, picks up her wand, and then suddenly screams at your groin, pointing ";
549 text += "her wand at it. She stops and returns to counting her cash as your penises retract the amount you specified:</p>";
550 text += "<ul>";
551 for (i = 0; i < main.player.dicks.length; i++)
553 text += "<li>" + main.player.dicks[i].shrink(main.player, true, dickincrement) + "</li>";
554 main.player.gold -= 100 + priceoffset;
556 text += "</ul>";
557 break;
558 case 5:
559 var cc:Class = getDefinitionByName(getQualifiedClassName(main.player)) as Class;
560 var c:Creature = new cc();
561 main.player.gold -= 1000;
562 return true;
563 break;
565 updateScreen();
566 return false;
568 public function BSBreasts(id:int):Boolean
570 trace("BSBreasts", id)
571 clearButtons();
572 setButton(0, "CANCEL");
573 text = "<h2>Breast Modifications</h2><p>Want bigger boobs? More tits? Fewer tits? Pay up and they're yours.</p>";
574 text += "<ul>";
575 text += addMenuOption(1, "Add", 1000 + priceoffset, "Grow a new breast");
576 var numboobs:int = main.player.breasts.length;
577 if (numboobs > 0)
579 text += addMenuOption(2, "Remove", -900 + priceoffset, "Remove one of your balls and sell it to the store.");
580 text += addMenuOption(3, "Grow", 100 + priceoffset, "Fuck up your back by growing enormous tits!");
581 text += addMenuOption(4, "Shrink", 100 + priceoffset, "Shrink your boobs");
582 //text += addMenuOption(5, "Reset", 1000 + priceoffset, "Reset your groin to the default number, type, and size of dicks for your species.");
584 text += "</ul>";
586 switch (id)
588 case 0:
589 subpage = "main";
590 return processButtonPress(-1);
591 break;
592 case 1:
593 var boob:Breast = main.player.addBreast();
594 if (boob == null)
596 InfoScreen.push("Your species doesn't have a default breast type, so you'll get a human boob instead.");
597 boob = BodyPartRegistry.human_breast;
599 boob.onAdded(true, main.player);
600 WitchShopScreen.push(type);
601 main.player.gold -= 1000 + priceoffset;
602 return true;
603 break;
604 case 2:
605 boob = main.player.breasts.pop();
606 main.player.gold += 900 - priceoffset;
607 boob.onRemoved(true, main.player);
608 WitchShopScreen.push(type);
609 return true;
610 break;
611 case 3:
612 text = "<h2>Grow Dicks</h2>";
613 var glassDesc:String = "shot glass";
614 if (dickincrement >= 6 && dickincrement < 12)
616 glassDesc = "vial";
618 else if (dickincrement >= 12 && dickincrement < 18)
620 glassDesc = "flask";
622 else if (dickincrement >= 18 && dickincrement < 24)
624 glassDesc = "tumbler";
626 else if (dickincrement >= 24)
628 glassDesc = "beer mug";
630 text += "<p>The proprietor of the shop produces a " + glassDesc + " full of a maroon, murky liquid and hands the warm glass ";
631 text += "to you. </p><p>&quot;Drink.&quot; She directs in a bored tone.</p><p>You give the liquid a quick glance, and then ";
632 text += "shrug, raising the " + glassDesc + " to your lips and draining it of its sweet contents. It doesn't take long for ";
633 text += "the effects to take hold, as pins-and-needles rush over your " + Utils.pluralize(main.player.dicks.length,"penis") + ". The skin tightens, ";
634 text += "and then expands. You groan loudly as your " + Utils.pluralize(main.player.dicks.length,"member") + " erect to their full size, and then ";
635 text += "continue until they reach the size you requested:</p><ul>";
636 for (var i:int = 0; i < main.player.dicks.length; i++)
638 text += "<li>" + main.player.dicks[i].grow(main.player, true, dickincrement) + "</li>";
639 main.player.gold -= 100 + priceoffset;
641 text += "</ul>";
642 break;
643 case 4:
644 text = "<h2>Shrink Dicks</h2>";
645 text += "<p>The old woman nods after counting her cash, picks up her wand, and then suddenly screams at your groin, pointing ";
646 text += "her wand at it. She stops and returns to counting her cash as your penises retract the amount you specified:</p>";
647 text += "<ul>";
648 for (i = 0; i < main.player.dicks.length; i++)
650 text += "<li>" + main.player.dicks[i].shrink(main.player, true, dickincrement) + "</li>";
651 main.player.gold -= 100 + priceoffset;
653 text += "</ul>";
654 break;
655 case 5:
656 var cc:Class = getDefinitionByName(getQualifiedClassName(main.player)) as Class;
657 var c:Creature = new cc();
658 main.player.gold -= 1000;
659 return true;
660 break;
662 updateScreen();
663 return false;
666 private function BSVaginas(id:int):Boolean
668 return false;