<<if $sugar gt 60 and not $dream_cave>><<set $dream_cave = true>><<set $dream_return = 'mines'>><<display 'next dream'>><<else>><<if $level gt 2>><<if not $beat_spider>><<display 'cave_spider'>><<else>><<display 'cave_free'>><<endif>><<else>>The cave looks dark and scary and you hear someone screaming for help from within. You are too cowardly to enter - come back when you are stronger.\n\n<<display 'woods'>><<endif>><<endif>>

<<if $level gt 1>><<if not $beat_troll>><<display 'woods_troll'>><<else>><<display 'woods_free'>><<endif>><<else>>Twizzle the town guard stops you. "You're not strong enough to deal with the wood creatures yet! Why not go take a lesson at the candy school?"\n\n<<display 'village'>><<endif>>

"Hello again" says Jolly, "today we will be learning about fizzy candy!".\n\n"Fizzy candy is inhabited by microscopic demons which are released when it is eaten. You will feel them jumping up and down on your tongue! Consuming their essence makes your attacks more powerful, but only for a limited time. Fizzy candy is very expensive to produce because of the difficulty of binding the demons, but thanks to our sponsors we have some free samples for you here today - all hail the Candy King!"\n\n<<replace "take popping candy (+1 fizzy damage) {3}">><<set $poppings = $poppings+3>>You carefully put the popping candy in your candy pouch.\n\nGo back to the [[village|Levelup]].<<endreplace>>

"Welcome to my class" says Jolly, "today we will be learning about sugary candy!".\n\n"There are four basic flavours, each affecting a different part of your tongue and a different combat stat. The most fundamental flavour is <i>sugary</i>, and almost all candy possesses it in some measure! Eating sugary candy contributes to your <i>sugar shield</i> which is essential to absorb combat damage, but if you have too much you will harm your teeth - reducing your ability to eat candy at all!"\n\n<<replace "eat gobstopper (+9 sugar shield)">><<set $shield = $shield+9>><<set $sugar = $sugar+10>><<set $mouth = 2>>You eat a gobstopper. Sugar shield at <<print $shield>>.\n\n"Gobstoppers are a very long-lasting form of pure sugary candy. Here are two more - use them to endure difficult quests!"<<set $gobstoppers = $gobstoppers+2>>\n\nGo back to the [[village|Levelup]].<<endreplace>>

"Today's lesson will be your last," says Jolly, "for the fourth and final flavour you need to know about is <i>sour</i>".\n\n"Sour foods are unpleasant to eat, but they make your tongue more sensitive to savour delicious treats! If you can find any sour lollies, eat them to increase your appetite for everything else. However they are exceedingly rare and we do not have any specimens here today. Good luck averting doom!"\n\nGo back to the [[village|Levelup]].<<endreplace>>

"Welcome back to my class" says Jolly, "today's lesson is everyone's favourite - chocolate!".\n\n"Chocolate is a magical radioactive mineral found deep underground. It empowers whoever eats it to make them attack faster and faster! It has positive effects also on your happiness and well-being and there is no reason not to eat as much as you can get your hands on. Admittedly the effects do wear off over time, but that just gives an excuse to eat even more chocolate! I expect you'll be eating a lot of chocolate so we'll start you off with an ample supply."\n\n<<replace "take chocolate bar (+1 delicious attack, +1 sugar shield) {5}">><<set $bars = $bars+5>>You grab all of the chocolate. All of it.\n\nGo back to the [[village|Levelup]].<<endreplace>>

<<if $sugar gt 120 and not $dream_home>><<set $dream_home = true>><<set $dream_return = 'home'>><<display 'next dream'>><<else>><<if $beat_warlord and not $gift_reward>>You find a package for you - a gift of thanks from the villagers! Opening it you find a jelly, two candollars, and three lollipops.<<set $gift_reward = true>><<set $jellies = $jellies+1>><<set $money = $money+2>><<set $lollipops = $lollipops+3>><br><br><<endif>>You are in your sugar tower.\n\nYour sugar shield is at <<print $shield>>. You may [[bathe in the treacle pools]].\n\n<<if $puzzle_box>>Examine the [[puzzle box|puzzle0]].<html><br></html><<endif>>Return to the [[mountain]].<<endif>>

You make a deal for some popping candy.<<set $money = $money-5>><<set $poppings = $poppings+1>>\n\n<<display 'general store'>>

<<set $made_shop = true>><<set $doom = $doom+1>><<display 'time passes'>>You start up your oven and spend the day baking planks of bread and piling them up. Before long you have a gingerbread house of your own.\n\n<<display 'gingerbread cottage'>>

<<if $doom gte 99 and not $dream_lab>><<set $dream_lab = true>><<set $dream_return = 'desert laboratory'>><<display 'next dream'>><<else>>The flimsy laboratory shack is constantly beset by the hopping creatures of the desert sector! You feel a sense of frantic action terror!\n\n[[Search|laboratory2]] the laboratory.\n[[Escape|desert]] into the desert.<<endif>>

The kangaroo explodes into a fiery explosion of kangaroo innards. Mysterious! But it is still too distracting here to examine the puzzle box, what with all the hopping. Take it somewhere more private.<<set $doom = $doom+2>><<display 'time passes'>>\n\n[[Keep searching|laboratory2]].\n[[Escape|desert]] into the desert.

<<if $level gt 3>><<if not $beat_goblin>><<display 'mine_goblin'>><<else>><<display 'mine_free'>><<endif>><<else>>The mines look even scarier than the cave, and dangerous too! Come back when you are less timid!\n\n<<display 'cave'>><<endif>>

<<if $sugar gt 30 and not $dream_mystic>><<set $dream_mystic = true>><<set $dream_return = 'mystic convergence'>><<display 'next dream'>><<else>>A tangled nexus from which many paths lead. There is a highway here. There is a dungeon here<<if not $unlocked_dungeon>>, but it is locked<<else>>, which you have unlocked<<endif>>. There is the entrance to an ice zone here. There is a path to desert here.\n\nReturn along the [[highway]].<<if $unlocked_dungeon>><br>Enter the [[dungeon]].<<else>><<if $dungeon_key>><br>Unlock [[dungeon|dungeon_key]].<<endif>><<endif>>\nEnter the [[ice zone]].\nEnter the [[desert]].<<endif>>

<<if $doom gte 99 and not $dream_highway>><<set $dream_highway = true>><<set $dream_return = 'highway'>><<display 'next dream'>><<else>><<if $level gt 4>><<if not $beat_thief and $money gt 0>><<display 'highway_thief'>><<else>><<display 'highway_free'>><<endif>><<else>>The highway is too dangerous to travel on, there may be highwaymen living there! You go back into the woods.\n\n<<display 'woods'>><<endif>><<endif>>

<<set $visited_dungeon = true>><<set $last_dungeon = 7>><<if $beat_warlord and not $beat_doom>><<set $enemy_name = "Doom Boss">><<set $enemy_hp = 999>><<set $enemy_damage = 10>><<set $enemy_passage = "You are fighting the doom boss.">><<set $enemy_defeat = 'doom_boss'>><<set $enemy_attack = 0>><<set $enemy_retreat = 'dungeon'>>As you reach the peak of the dungeon mountain, the doom boss appears.\n\n<<display 'hax'>><<else>>In the centre of the dungeon there is a mountain, reaching far above those shadowed depths of torment.\n\nFrom its peak you can see only darkness.\n\nDescend back into the [[dungeon]].<<if $portal3>><html><br></html>Enter the portal to the [[ice mountain]].<<if $portal1>><html><br></html>Enter the portal to the [[village mountain|mountain]].<<endif>><<if $portal4>><html><br></html>Enter the portal to the [[trash mountain]].<<endif>><<if $portal5>><html><br></html>Enter the portal to the [[hell mountain]].<<endif>><<endif>><<endif>>

<<if $sugar gt 50 and not $dream_hell>><<set $dream_hell = true>><<set $dream_return = 'hell zone'>><<display 'next dream'>><<else>>You stand at the entrance of the HELL ZONE.\n\nThis is where the most doom will be found.\n\n<<if $gauntlet_complete>>Climb the [[hell mountain]].<<else>>Fight through the [[hell gauntlet]].<<endif>>\nReturn through the portal to [[ice zone]].<<endif>>

You have entered the ice zone. This is symbolic of the difficulties the hero must overcome to complete their quest, and it resembles a ruined version of their home village in deep winter. It is also a literal difficulty which must be overcome. There is much doom here.<<if (Math.floor(Math.random()*2)) eq 0>><html><br><br></html>It is snowing.<<endif>>\n\nTo the far south you see an ice mountain, past a dangerous ice grotto. <<if $battle_arena>>You can see your battle arena from here.<<else>>In another direction there is ice robot battle arena factory.<<endif>>\n\nGo south through the [[ice grotto]].\n<<if $battle_arena>>Enter the [[ice robot battle arena]].<<else>>Go another direction to the [[ice robot battle arena factory]].<<endif>>

<<set $visited_hell = true>>You stand at the peak of the hell mountain, adorned with darkblossoms. There is a diabolical cauldron here, which you can use to mix potions!\n\n<<display 'list_inventory'>>\n\n<<if $lollipops gt 1 and $poppings gt 0>>Mix 2 lollipops and 1 popping candy into [[aspartame potion|potion1]].<html><br></html><<endif>><<if $bars gt 1 and $truffles gt 0>>Mix 2 chocolate bars and 1 chocolate truffle into [[cocoa potion|potion2]].<html><br></html><<endif>><<if $sours gt 1 and $flosses gt 0>>Mix 2 sour lollies and 1 candy floss into [[bitter potion|potion3]].<html><br></html><<endif>>Return to the entrance of the [[hell zone]].<<if $portal5>><html><br></html>Enter the portal to the [[ice mountain]].<<if $portal1>><html><br></html>Enter the portal to the [[village mountain|mountain]].<<endif>><<if $portal3>><html><br></html>Enter the portal to the [[dungeon mountain]].<<endif>><<if $portal4>><html><br></html>Enter the portal to the [[trash mountain]].<<endif>><<endif>>

<<if not $beat_robot>><<set $beat_robot = true>><<set $doom = $doom+11>><<set $money = $money+30>><<set $cupcakes = $cupcakes+1>><<display 'time passes'>>As you shatter the robot its glowing core opens up revealing a portal to Hell. You also collect 30 candollars and a prize cupcake.<html><br><br></html><<endif>>You are in the ICE ROBOT BATTLE ARENA, now empty for its purpose is fulfilled. There is a portal to Hell here.\n\nGo to [[hell zone]].\nReturn to [[ice zone]].

<<if not $beat_troll>><<set $beat_troll = true>><<set $doom = $doom+1>><<display 'gain experience'>><<set $flosses = $flosses+1>>The troll crumbles into a pile of sugary dust. You gather together enough to form one candy floss.<html><br><br></html><<endif>>The finest fudge forest, these woods are peaceful and free of doom.\nThere are mysterious paths leading to a cave and a highway.\n\n<<if $level gt 4 and $class eq "Lollipop Witch">><<if $made_shop>>Enter your [[gingerbread cottage]].<<else>>Bake a new [[gingerbread house|new gingerbread house]], for you are now a full Lollipop Witch.<<endif>><html><br></html><<endif>>Return to the [[village]].\nExplore the [[cave]].\nTravel the [[highway]].

<html><img width="256" src="title.png"></html>\n\nTwice came doom to the toothsome village, and twice was it averted by heroic deeds. Yet darkness can ever only be delayed, so in accordance with prophecy once more it returns.\n\nOnly you can save your home!\n\n[[Start|Class]]\n\n<span style="font-size:0.7em;"><i>Thanks to Leon Arnott for help with Twine and Andi McClure for BECOME A GREAT ARTIST IN JUST 10 SECONDS.</i></span>

<<display 'time passes'>><<set $doom = $doom+8>><<set $beat_doom = true>><<set $shield = $shield+10>><<set $sugar = $sugar+20>>The doom boss tumbles from the mountain, never to be seen again. Until next time..\n\nThe doom around you lessens noticeably. You feel very sweet.\n\n<<display 'dungeon mountain'>>

<<if not $beat_warlord and $doom gt 68>><<set $enemy_name = "Doom Warlord">><<set $enemy_hp = 32>><<set $enemy_damage = 3>><<set $enemy_passage = "The doom warlord battle continues.">><<set $enemy_defeat = 'village_free'>><<set $enemy_attack = 0>>Entering the village you sense that something is different. The streets are unusually quiet. Suddenly you notice the figure of a Lieutenant Doom Warlord casting a shadow before you. You must fight it.\n\n<<display 'hax'>><<else>>The twilit streets of the doom-beset village lie before you. <<if $level lt $lesson>>The candy school is open for lessons.<<else>>The candy school is closed.<<endif>> <<if $beat_spider>>Wonko's general store is open.<<else>>The general store is closed.<<endif>> To the south a path leads into the woods. A mountain hovers overhead.\n\n<<display 'list_inventory'>> Doom is <<if $doom eq 0>>0<<else>><<print $doom>><<endif>>% averted.\n\n<<if $level gt 4 and $class eq "Chocolatier">><<if $made_shop>>Enter your [[chocolate shop]].<<else>>Open a new [[chocolate shop|open chocolate shop]], for you are now a master Chocolatier.<<endif>><html><br></html><<endif>><<if $beat_spider>>Shop at the [[general store]].<html><br></html><<endif>><<if $level lt $lesson>>Learn at the [[candy school]].<html><br></html><<endif>>Wander into the [[woods]].\nClimb the [[mountain]].<<endif>>

<<if not $beat_frog>><<set $beat_frog = true>><<set $doom = $doom+1>><<display 'time passes'>><<set $jellies = $jellies+1>>The frog is squished by your attack into a smear of jelly. You take the delicious sugary jelly.<html><br><br></html><<endif>>The desert sputters with butterscotch sand. All around are bizarre hopping creatures. You hope they don't notice you again.\nThere is a metal hut with strange protuberances here.\n\nInvestigate [[desert laboratory]].\nBack to [[mystic convergence]].

<<if not $beat_spider>><<set $beat_spider = true>><<set $rocks=$rocks+1>><<set $doom = $doom+1>><<display 'gain experience'>>The spider turns into rock candy. You take the rock candy.\n\nIn the cave you find Wonko the shopkeeper tangled up in webs. He is grateful to be rescued!<html><br><br></html><<endif>>The cave appears to be the entrance to an abandoned mine!\n\nReturn to the [[woods]].\nExplore deeper into the [[mines]].

At last, the ice mountain.\n\nLong abandoned on the towering peak, a mountain-portal generator. Perhaps you can use this to open portals connecting other mountains you have visited?\n\n<<if not $portal1>>Open portal to [[village mountain|portal1]].<<else>>Go to [[village mountain|mountain]].<<endif>><<if $visited_dungeon>><html><br></html><<if not $portal3>>Open portal to [[dungeon mountain|portal3]].<<else>>Go to [[dungeon mountain]].<<endif>><<endif>><<if $visited_trash>><html><br></html><<if not $portal4>>Open portal to [[trash mountain|portal4]].<<else>>Go to [[trash mountain]].<<endif>><<endif>><<if $visited_hell>><html><br></html><<if not $portal5>>Open portal to [[hell mountain|portal5]].<<else>>Go to [[hell mountain]].<<endif>><<endif>>\nReturn to [[ice zone entrance|ice zone]].

<<if not $beat_giant>><<set $beat_giant = true>><<set $doom = $doom+2>><<display 'gain experience'>><<set $truffles = $truffles+1>>The giant explodes in a burst of rainbows and confetti, and a single chocolate truffle.<html><br><br></html><<endif>>From the top of the mountain you can see for miles! <<if $doom lte 25>>There is much doom all around.<<elseif $doom lte 50>>The doom is beginning to clear.<<elseif $doom lte 75>>Doom lurks in the distance.<<elseif $doom lte 100>>Some doom still lingers.<<else>>There is no doom in sight.<<endif>>\n\n<<if $level gt 4 and $class eq "Sucromancer">><<if $made_shop>>Enter your [[tower]].<<else>>Summon a [[tower of sugar]], for you are now a master Sucromancer.<<endif>><html><br></html><<endif>><<if $portal1>>Enter the portal to the [[ice mountain]].<html><br></html><<if $portal3>>Enter the portal to the [[dungeon mountain]].<html><br></html><<endif>><<if $portal4>>Enter the portal to the [[trash mountain]].<html><br></html><<endif>><<if $portal5>>Enter the portal to the [[hell mountain]].<html><br></html><<endif>><<endif>>Return to the [[village]].

<<if not $visited_trash>><<set $visited_trash = true>><<display 'time passes'>><<endif>>Eventually you reach the top, with a devastating vista across endless trash.\n\n<<if $portal4>><<if $portal1>>Enter the portal to the [[village mountain|mountain]].<br><<endif>>Enter the portal to the [[ice mountain]].\n<<if $portal3>>Enter the portal to the [[dungeon mountain]].<br><<endif>><<if $portal5>>Enter the portal to the [[hell mountain]].<br><<endif>><<endif>>Climb back down to the [[junkyard]].

WELCOME TO ICE ROBOT BATTLE ARENA FACTORY\n\n<<if $arena_assembled>>HERE IS YOUR ARENA, ARE YOU GOING TO USE IT NOW THAT IT HAS BEEN MANUFACTURED?\n\nEnter [[ice robot battle arena]].\nReturn to [[ice zone entrance|ice zone]].<<elseif $electric_toothbrush and $unknown_device>>YOU COULDN'T FIND AN AUTOMATIC OBSTACLE? NEVER MIND, YOU WILL HAVE TO OPERATE THEM MANUALLY.\n\nLET'S GET THIS ARENA ASSEMBLED!\n\nTIME PASSES...<<display 'time passes'>>\n\nOK HERE IS YOUR ARENA.\n\n<<set $battle_arena = true>>Enter [[ice robot battle arena]].\nReturn to [[ice zone entrance|ice zone]].<<else>>WE CAN BUILD YOU AN ICE ROBOT BATTLE ARENA IF YOU WISH TO FIGHT THE ICE ROBOT BOSS\n\nALL WE NEED ARE SOME SPARE PARTS:\nAN AUTOMATIC OBSTACLE\n<<if not $electric_toothbrush>>AN ELECTRIC TOOTHBRUSH<html><br></html><<endif>><<if not $unknown_device>>AN UNKNOWN DEVICE<html><br></html><<endif>>\nYOU MAY BE ABLE TO FIND SOME OF THESE IN THE TRASH<<if not $junkyard_map>><br>THE JUNKYARD IS HIDDEN BUT HERE IS A MAP<<endif>>\n\n<<if not $junkyard_map>>Take [[junkyard map|ice robot battle arena factory][$junkyard_map = true]].<br><<endif>>Return to [[ice zone entrance|ice zone]].<<endif>>

<<if $visited_trash and $electric_toothbrush>><<display 'trash mountain'>><<else>>The longer you spend going up the trash heap the higher it gets, until it seems a veritable trash mountain towering above you.<<if not $electric_toothbrush>><html> </html>You see an electric toothbrush here.<<endif>>\n\n<<if not $electric_toothbrush>>Take [[electric toothbrush|trash heap][$electric_toothbrush = true]].<html><br></html><<endif>>Continue up the [[trash mountain]].\nReturn to the [[junkyard entrance|junkyard]].<<endif>>

<<set $beat_elf = true>><<set $doom = $doom+2>><<display 'time passes'>>The elf's blood sprays out into the chill air of the grotto, glistening prismatically as it rapidly freezes. Sudden flickers as sparkling cold-locusts leap on the frostlets and crunch them for nourishment.\n\nContinue to the [[ice mountain]].