Fix a bunch of issues with Haara.
[18plus-7leafadventure.git] / src / org / sevenchan / dongs / screens / encounters / HaaraRevelationEncounter.as
blob028e4f2b2b5bc7547ac82b9bb496814d30a846b5
1 package org.sevenchan.dongs.screens.encounters
3 import org.sevenchan.dongs.ActionNode;
4 import org.sevenchan.dongs.Creature;
5 import org.sevenchan.dongs.enchantment.Hunger;
6 import org.sevenchan.dongs.MenuNode;
7 import org.sevenchan.dongs.screens.Encounter;
8 import org.sevenchan.AdventureController;
9 import org.sevenchan.dongs.screens.InfoScreen;
10 import org.sevenchan.dongs.Town;
12 /**
13 * ...
14 * @author Harbinger
16 public class HaaraRevelationEncounter extends Encounter
18 public static function push():void
20 AdventureController.screenQueue.write(new HaaraRevelationEncounter(null));
22 public function HaaraRevelationEncounter(target:Creature)
24 super(target);
25 lustCost = 0;
26 currentItem.clearChildren();
27 text = <![CDATA[
28 <p>
29 For some reason, you get it into your thick skull to wander out into the desert surrounding Banala
30 (which - according to the grouchy Innkeeper, anyway - is called the Haara Wastes, after the demon
31 general who led his army into it and was never heard from again). Since you're not completely
32 braindead, you bring enough water to allow you to survive in the blinding desert for a couple of
33 weeks, provided you ration it carefully.
34 </p>
35 <p>
36 Unfortunately, the desert has other plans.
37 </p>
38 <p>
39 The first day into your journey, you are horrified to discover that the goatskin bag containing your
40 main water supply has come apart at the bottom, and most of the water has already leaked out. You
41 begin to head back to Banala, but the rapidly setting sun and the fact that you have no idea where
42 you are gives you pause.
43 </p>
44 ]]>.toString();
45 currentItem.content = text;
46 currentItem.canGoBack = false;
47 currentItem.pushAction("Banala", -1, "Head back to Banala.", onBanala, null);
48 var mnuCamp:MenuNode = currentItem.pushMenu("Camp", "Set up camp.");
50 mnuCamp.content = <![CDATA[
51 <p>You sigh, check your spare goatskin, and set up camp for the night.</p>
52 <p>
53 Your sleep is fitful. You dream of the shifting sands, and the mysterious creatures that might inhabit the Wastes.
54 </p>
55 <p>
56 You then dream of a beautiful woman, dressed in long, sand - colored robes, rising from the desert. She approaches you, lays a hand on your cheek, and whispers your name into your ear.
57 </p>
58 <p>
59 You awaken to a golden flask, lightly dusted with sand, propped up next to you. Startled, you jump to your feet and look around the camp quickly, but find no one. Wondering what the hell is going on, you peer into the flask, and find a clear fluid at the bottom.
60 </p>
62 ]]>.toString();
64 /* Menu: Drink/Don’t Drink */
65 mnuCamp.canGoBack = false;
66 mnuCamp.pushAction("Drink", -1, "Drink the contents.", onDrink);
67 mnuCamp.pushAction("Don't drink", -1, "Leave it sealed.", onNoDrink);
71 public function onNoDrink(ply:Creature, node:ActionNode, o:*):Boolean {
72 //If player selects Don’t Drink*
74 text=<![CDATA[
75 <p>
76 Suspicious, you ignore the mysterious flask and begin packing your belongings for the journey
77 back to Banala. As you leave, you give a single glance back to the flask, but only see swirling sands.
78 </p>
79 <p>
80 The walk back is arduous, and you begin to wish you had taken a chance and drunk from the flask. By
81 the time you finally find the road leading back to Banala, your throat is painfully parched.
82 </p>
83 ]]>.toString();
84 //Player loses some HP, but not as much as they would if they had not camped in the desert.
85 main.player.HP = main.player.HP / 8;
86 return true;
89 public function onDrink(ply:Creature, node:ActionNode, o:*):Boolean
91 text=<![CDATA[
92 <p>
93 You raise the flask to your lips cautiously, and taste the liquid within.
94 </p>
95 ]]>.toString();
96 // Game randomly selects the flask’s contents.
97 var possibilities:Array = new Array(
98 "water",
99 "pink potion",
100 "gold potion"
103 //CONSEQUENCES
104 var result:String = String(MathUtils.getRandomArrayEntry(possibilities));
106 // If flask contents are water
107 if (result == "water")
109 text+=<![CDATA[
111 Water? But how did...? A surprisingly large flood of water of pours into your mouth, and you hungrily drink.
112 </p>
113 ]]>.toString();
115 //If flask contents are pink potion
116 if (result == "pink potion")
118 text+=<![CDATA[
120 The flask’s warm liquid rushes down your throat. It tastes almost like warm milk, but sweeter. A strange
121 warmth spreads over your chest, and you drop the flask in surprise as your [breast description] begin
122 to expand.
123 </p>
124 ]]>.toString()
125 .replace("[breast description]", main.player.getBreastDescr());
127 // Player’s breast size increases
128 if (main.player.breasts.length == 0) {
129 trace(main.player,"doesn't have boobs, adding.");
130 main.player.addBreast();
131 main.player.addBreast();
132 } else {
133 for (var i:int = 0; i < main.player.breasts.length;i++)
134 main.player.breasts[i].bigger();
136 var lastPart:String = <![CDATA[
138 Pulling open your [clothing description], you curiously squeeze your new [breast description]. You
139 attempt to stand and stagger slightly, unused to the new, heavy weight on your chest.
140 </p>
141 ]]>.toString()
142 .replace("[breast description]", main.player.getBreastDescr())
143 .replace("[clothing description]", main.player.getClothingDescr()); // TODO: Use ClothingType.Top or something.
145 // If flask contents are gold potion
146 if (result == "gold potion")
148 var effects:String = "";
149 // If player has less than max HP
150 if (main.player.HP < main.player.maxHP)
152 effects += "All the scrapes and bruises you’ve accumulated disappear.";
153 main.player.HP = main.player.maxHP;
155 //If player has a deadly enchantment
156 if (main.player.hasEnchantment("hunger")) {
157 delete main.player.enchantments["hunger"];
158 if (effects.length > 0)
159 effects += " ";
160 effects += "You are no longer afflicted with hunger.";
162 text+=<![CDATA[
164 The liquid is pleasantly sweet. As you continue to drink from the flask, a feeling of calmness
165 overtakes you, and warmth spreads through your body. [effects]
166 </p>
167 ]]>.toString()
168 .replace("[effects]", effects);
170 text+=<![CDATA[
172 After quenching your thirst, you are surprised to notice the flask is the same weight as when you
173 first picked it up. Shaking your head in abject wonder, you begin the task of packing up your dusty
174 belongings to continue your exploration of the desert, sans one goatskin bag.
175 </p>
177 Once your belongings are packed, you go to retrieve the flask. However, all you see is swirling sand;
178 You attempt to dig around for the flask, but find nothing. Sighing, you begin to trudge back towards Banala.
179 </p>
180 ]]>.toString();
181 main.setTown(Town.knownTowns.banala);
182 InfoScreen.push(text);
183 return true;
186 public function onBanala(ply:Creature, node:ActionNode,o:*):Boolean
188 text = <![CDATA[
190 Despite the darkening sky and your lack of direction, you resolutely continue your journey back to Banala.
191 You strike out in a random direction, hoping it leads back to civilization.
192 </p>
194 Night swiftly falls, and the darkness makes you even more lost. You wander about the desert for the entire night,
195 and only stumble into Banala the following day, thirsty and worn.
196 </p>
197 ]]>.toString();
198 main.player.HP = main.player.HP / 4;
199 main.setTown(Town.knownTowns.banala);
200 InfoScreen.push(text);
201 return true;