1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-26 10:45:23 -04:00

commit all random stuff to repo

This commit is contained in:
Jake Jarvis 2018-05-17 14:47:47 -05:00
parent f38f231cae
commit 809962e1ed
62 changed files with 9187 additions and 26 deletions

7
.gitignore vendored
View File

@ -8,9 +8,6 @@ package-lock.json
yarn.lock
.npmrc
.DS_Store
*.asc
public/
.DS_Store

View File

@ -20,26 +20,6 @@
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block; report=https://jakejarvis.report-uri.com/r/d/xss/enforce"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-DNS-Prefetch-Control",
"value": "off"
},
{
"key": "Referrer-Policy",
"value": "no-referrer-when-downgrade"
},
{
"key": "Content-Security-Policy",
"value": "default-src 'self'; script-src 'self' www.google-analytics.com ssl.google-analytics.com ajax.googleapis.com 'sha256-KhRmfxEAAaZsUM+7gtG8pxaii136UceZCbgie95aRd0=' 'sha256-C84Lc+r0cDvAfbbr1KHi0s1jt0nzfAWH5+bmB/2Ph8s='; style-src 'self' 'unsafe-inline' fonts.googleapis.com; img-src 'self' data: https:; font-src 'self' fonts.gstatic.com; frame-src 'self' www.youtube.com player.vimeo.com drive.google.com www.scribd.com; connect-src 'self' jakejarvis.report-uri.com www.google-analytics.com ssl.google-analytics.com; upgrade-insecure-requests; report-uri https://jakejarvis.report-uri.com/r/d/csp/enforce;"
},
{
"key": "Expect-CT",
"value": "max-age=0, report-uri=https://jakejarvis.report-uri.com/r/d/ct/reportOnly"
@ -47,7 +27,7 @@
]
},
{
"source" : "**/",
"source" : "**",
"headers": [
{
"key": "Cache-Control",
@ -56,6 +36,26 @@
{
"key": "X-UA-Compatible",
"value": "IE=edge"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block; report=https://jakejarvis.report-uri.com/r/d/xss/enforce"
},
{
"key": "Content-Security-Policy",
"value": "default-src 'self'; script-src 'self' www.google-analytics.com ssl.google-analytics.com ajax.googleapis.com 'sha256-KhRmfxEAAaZsUM+7gtG8pxaii136UceZCbgie95aRd0=' 'sha256-C84Lc+r0cDvAfbbr1KHi0s1jt0nzfAWH5+bmB/2Ph8s='; style-src 'self' 'unsafe-inline' fonts.googleapis.com; img-src 'self' data: https:; font-src 'self' fonts.gstatic.com; frame-src 'self' www.youtube.com player.vimeo.com drive.google.com www.scribd.com; connect-src 'self' jakejarvis.report-uri.com www.google-analytics.com ssl.google-analytics.com; upgrade-insecure-requests; report-uri https://jakejarvis.report-uri.com/r/d/csp/enforce;"
},
{
"key": "Referrer-Policy",
"value": "no-referrer-when-downgrade"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-DNS-Prefetch-Control",
"value": "off"
}
]
},

50
static/candies/ascii.html Executable file
View File

@ -0,0 +1,50 @@
<!DOCTYPE HTML>
<html>
<head>
<title>candy box! &mdash; ascii art credit</title>
<meta http-equiv="content-type"
content="text/html;charset=utf-8" />
</head>
<body>
<b>Quests:</b><br/><br/>
<u>The whale</u>: jgs ( <a href="http://www.retrojunkie.com/asciiart/animals/whales.htm">found here</a> )<br/>
<u>Castle's entrance</u>: part from -Sst- ( <a href="http://www.chris.com/ascii/index.php?art=objects%2Fcastles">found here</a> )<br/>
<u>The dragon</u>: b'ger ( <a href="http://www.chris.com/ascii/index.php?art=creatures%2Fdragons">found here</a> )<br/>
<u>Flowers</u>: jgs ( <a href="http://www.geocities.com/spunk1111/flowers.htm">found here</a> )<br/>
<u>Cactus</u>: jgs ( <a href="http://www.geocities.com/spunk1111/nature.htm">found here</a> )<br/>
<u>Boat</u>: unknown ( <a href="http://www.ascii-art.de/ascii/ab/boat.txt">found here</a> )<br/>
<u>Moat</u>: inspired by jgs ( <a href="http://www.geocities.com/spunk1111/nature.htm#mntanpm">found here</a> )<br/>
<br/>
<b>Cauldron:</b><br/><br/>
<u>Book</u>: boba@wwa.com ( <a href="http://www.chris.com/ascii/index.php?art=objects%2Fbooks">found here</a> )<br/>
<u>Cauldron</u>: jgs ( <a href="http://ascii.co.uk/art/cauldron">found here</a> )<br/>
<br/>
<b>Objects:</b><br/><br/>
<u>Key</u>: jgs ( <a href="http://www.retrojunkie.com/asciiart/building/keys.htm">found here</a> )<br/>
<u>Boots</u>: ajm97 ( <a href="http://www.chris.com/ascii/index.php?art=objects%2Ffootwear">found here</a> )<br/>
<u>Pink ring</u>: inspired by jgs ( <a href="http://www.geocities.com/spunk1111/wedding.htm">found here</a> )<br/>
<u>Strong armour</u>: part from jgs ( <a href="http://www.geocities.com/spunk1111/mythical2.htm">found here</a> )<br/>
<u>Cauldron</u>: part from jgs ( <a href="http://ascii.co.uk/art/cauldron">found here</a> )<br/>
<u>Horns</u>: inspired by rs ( <a href="http://www.ascii-art.de/ascii/uvw/unicorn.txt">found here</a> )<br/>
<u>Swords</u>: inspired by jgs ( <a href="http://www.retrojunkie.com/asciiart/weapons/swords.htm">found here</a> )<br/>
<br/>
<b>Other:</b><br/><br/>
<u>The candy merchant</u>: snd ( <a href="http://ascii.co.uk/art/drwho">found here</a> )<br/>
<u>The lollipops farm</u>: jgs ( <a href="http://www.geocities.com/spunk1111/farm.htm">found here</a> )<br/>
<u>Potions</u>: inspired by lbm & ejm97 ( <a href="http://www.retrojunkie.com/asciiart/containr/bottles.htm">found here</a> )<br/>
<u>Scroll</u>: inspired by hjw ( <a href="http://ascii.co.uk/art/scroll">found here</a> )<br/>
<br/><br/><br/>
these ascii artworks will never be used to gain money in any manner.
</body>
</html>

161
static/candies/design.css Executable file
View File

@ -0,0 +1,161 @@
body {
background-color:#ffffff;
overflow-y:scroll;
font-family: 'Montserrat', sans-serif;
font-size:16px;
/* disable text highlight */
-moz-user-select: none;
-webkit-user-select: none;
cursor:default;
}
pre {
font-size:14px;
}
a {
color:#000000;
font-weight:bold;
}
a:hover {
color:#79ad36;
}
#tabs {
text-align: center;
margin: auto;
padding: 0px;
margin-top: 5px;
margin-bottom:6px;
}
#tabs li {
list-style: none;
display: inline;
}
#tabs li button {
color:#282e32;
padding:8px 14px 8px 14px;
text-decoration:none;
font-size:9px;
font-family: 'Montserrat', sans-serif;
font-weight:bold;
text-transform:uppercase;
border:1px solid #464c54;
}
#tabs li button.active {
background-color:#f8f2b1;
color:#282e32;
border:1px solid #464c54;
}
#tab_candy_box {
display:block;
}
#tab_candy_box, #tab_quest, #tab_inventory, #tab_cauldron {
border:2px solid transparent;
}
#tab_quest, #tab_inventory, #tab_cauldron {
display:none;
}
.clear {
clear:both;
}
button {
background-color:#ffffff;
border:1px solid #464c54;
padding:8px 14px;
cursor:pointer;
font-family: 'Montserrat', sans-serif;
font-size:15px;
margin:4px 0px;
}
button:hover {
border:2px solid #79ad36;
padding:7px 13px;
}
button:disabled:hover {
cursor:default;
border:1px solid #464c54;
padding:8px 14px;
}
table {
border-collapse:collapse;
}
table, th, td {
border: 1px solid black;
padding:3px;
}
.tooltip {
text-decoration:none;
}
.tooltip span {
display: none;
white-space: normal; /* To force breaklines in tooltips */
text-align: left;
}
.tooltip:hover {
border: 0;
position: relative;
z-index: 500;
text-decoration: none;
}
.tooltip:hover span {
font-style: normal;
display: block;
position: absolute;
padding: 5px;
margin: 0px 5px;
color: #000;
border: 1px solid #000000;
background: #ffffff;
font-family: monospace;
font-size: 13px;
}
span.tooltip:hover span {
left: 70px;
width: 300px;
}
button.tooltip:hover span {
width: 300px;
}
#tab_quest_left_panel {
margin-right:15px;
}
div#tab_inventory table {
width:650px;
}
div#tab_inventory table td {
padding:2px 2px 2px 16px;
width:115px;
}
div#tab_inventory table td#sword_cell {
width:150px !important;
}
div#tab_quest button.potion_quest_button {
width:160px;
height:34px;
text-align:left;
}

53
static/candies/faq.html Executable file
View File

@ -0,0 +1,53 @@
<!DOCTYPE HTML>
<html>
<head>
<title>candy box! &mdash; faq</title>
<meta http-equiv="content-type"
content="text/html;charset=utf-8" />
</head>
<body>
<pre>
<h1>F.A.Q. (Frequently Asked Questions)</h1>
<b>Hey, you can only eat candies or throw them on the ground, this is stupid!</b>
Just be patient! ;)
<b>I have my 5 characters name, but I don't know how to load my game!</b>
When you click the "Save" button, a link appears next to it. You just have to click this link, and you will load your saved game. You can even put the link in your bookmarks, if you want!
If you didn't keep the link but you have your 5 characters name, then just use the load button.
<b>My lollipop production at the farm is stuck.. it's written I should have x/day or x/hour but I don't get anything..</b>
Well, you'll get your lollipops, but it's real hours and real days... you should plant more lollipops to reach an x/min production, it will be more efficient!
<b>I can't find the answer to a question of the frog :'(</b>
You can ask a friend for help! Answers are often simple, but a little bit twisted.
<b>I can go to the forge, but all I see is "There's an anvil here.", when can I do ?</b>
You don't have the appropriate sword yet.. did you answer all the frog's questions? ;)
<b>I can't buy the 60k spell at the hut!</b>
The sorceress, since she is a sorceress, can only work on magic swords. This is why you have to enchant your sword before being able to buy this spell!
<b>I can see the cauldron in my inventory, but I can't have access to it?!</b>
This bug seems to happen on Chromium-based browsers (Chrome, for example), on some computers.
Even if you don't see the cauldron tab on top of the page, you should still be able to access it with the 'right' key of your keyboard.
<b>I found a bug!</b>
Go tell Scrabble in the least annoying way possible and not during instruction time! There may be tickets involved if it's a bug I haven't heard before...
Real-life bugs are always reported to Cajun, the janitor. Tell him I sent you.
</pre>
</body>
</html>

BIN
static/candies/favicon.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
static/candies/favicon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 B

508
static/candies/index.html Executable file
View File

@ -0,0 +1,508 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- Hmm, I see you looking at the source code....cheater! :-) -->
<html>
<head>
<!--
_ _ _
| \ | | (_)
| \| | _____ _____ _ __ __ _ ___ _ __ _ __ __ _ __ _ ___ _____
| . ` |/ _ \ \ / / _ \ '__| / _` |/ _ \| '_ \| '_ \ / _` | / _` | \ \ / / _ \
| |\ | __/\ V / __/ | | (_| | (_) | | | | | | | (_| | | (_| | |\ V / __/
\_| \_/\___| \_/ \___|_| \__, |\___/|_| |_|_| |_|\__,_| \__, |_| \_/ \___|
__/ | __/ |
|___/ |___/
_ _
| \ | |
_ _ ___ _ _ _ _ _ __ | \| | _____ _____ _ __
| | | |/ _ \| | | | | | | | '_ \ | . ` |/ _ \ \ / / _ \ '__|
| |_| | (_) | |_| | | |_| | |_) | | |\ | __/\ V / __/ |
\__, |\___/ \__,_| \__,_| .__( ) \_| \_/\___| \_/ \___|_|
__/ | | | |/
|___/ |_|
_ _
| | | |
__ _ ___ _ __ _ __ __ _ | | ___| |_ _ _ ___ _ _
/ _` |/ _ \| '_ \| '_ \ / _` | | |/ _ \ __| | | | |/ _ \| | | |
| (_| | (_) | | | | | | | (_| | | | __/ |_ | |_| | (_) | |_| |
\__, |\___/|_| |_|_| |_|\__,_| |_|\___|\__| \__, |\___/ \__,_|
__/ | __/ |
|___/ |___/
_ _ _
| | | \ | |
__| | _____ ___ __ | \| | _____ _____ _ __
/ _` |/ _ \ \ /\ / / '_ \ | . ` |/ _ \ \ / / _ \ '__|
| (_| | (_) \ V V /| | | | | |\ | __/\ V / __/ |
\__,_|\___/ \_/\_/ |_| |_| \_| \_/\___| \_/ \___|_|
__ _ ___ _ __ _ __ __ _ _ __ _ _ _ __
/ _` |/ _ \| '_ \| '_ \ / _` | | '__| | | | '_ \
| (_| | (_) | | | | | | | (_| | | | | |_| | | | |
\__, |\___/|_| |_|_| |_|\__,_| |_| \__,_|_| |_|
__/ |
|___/
_ _
| | | |
__ _ _ __ ___ _ _ _ __ __| | __ _ _ __ __| |
/ _` | '__/ _ \| | | | '_ \ / _` | / _` | '_ \ / _` |
| (_| | | | (_) | |_| | | | | (_| | | (_| | | | | (_| |
\__,_|_| \___/ \__,_|_| |_|\__,_| \__,_|_| |_|\__,_|
_ _
| | | |
__| | ___ ___ ___ _ __| |_ _ _ ___ _ _
/ _` |/ _ \/ __|/ _ \ '__| __| | | | |/ _ \| | | |
| (_| | __/\__ \ __/ | | |_ | |_| | (_) | |_| |
\__,_|\___||___/\___|_| \__| \__, |\___/ \__,_|
__/ |
|___/
_ _
| \ | |
| \| | _____ _____ _ __ __ _ ___ _ __ _ __ __ _
| . ` |/ _ \ \ / / _ \ '__| / _` |/ _ \| '_ \| '_ \ / _` |
| |\ | __/\ V / __/ | | (_| | (_) | | | | | | | (_| |
\_| \_/\___| \_/ \___|_| \__, |\___/|_| |_|_| |_|\__,_|
__/ |
|___/
_
| |
_ __ ___ __ _| | _____ _ _ ___ _ _ ___ _ __ _ _
| '_ ` _ \ / _` | |/ / _ \ | | | |/ _ \| | | | / __| '__| | | |
| | | | | | (_| | < __/ | |_| | (_) | |_| | | (__| | | |_| |_
|_| |_| |_|\__,_|_|\_\___| \__, |\___/ \__,_| \___|_| \__, ( )
__/ | __/ |/
|___/ |___/
_ _
| \ | |
| \| | _____ _____ _ __ __ _ ___ _ __ _ __ __ _ ___ __ _ _ _
| . ` |/ _ \ \ / / _ \ '__| / _` |/ _ \| '_ \| '_ \ / _` | / __|/ _` | | | |
| |\ | __/\ V / __/ | | (_| | (_) | | | | | | | (_| | \__ \ (_| | |_| |
\_| \_/\___| \_/ \___|_| \__, |\___/|_| |_|_| |_|\__,_| |___/\__,_|\__, |
__/ | __/ |
|___/ |___/
_ _ _ _
| | | | \ | |
__ _ ___ ___ __| | |__ _ _ ___ | \| | _____ _____ _ __
/ _` |/ _ \ / _ \ / _` | '_ \| | | |/ _ \ | . ` |/ _ \ \ / / _ \ '__|
| (_| | (_) | (_) | (_| | |_) | |_| | __/ | |\ | __/\ V / __/ |
\__, |\___/ \___/ \__,_|_.__/ \__, |\___| \_| \_/\___| \_/ \___|_|
__/ | __/ |
|___/ |___/
_ _ _ _ _
| | | | | | (_)
__ _ ___ _ __ _ __ __ _ | |_ ___| | | __ _ | |_ ___
/ _` |/ _ \| '_ \| '_ \ / _` | | __/ _ \ | | / _` | | | |/ _ \
| (_| | (_) | | | | | | | (_| | | || __/ | | | (_| | | | | __/
\__, |\___/|_| |_|_| |_|\__,_| \__\___|_|_| \__,_| |_|_|\___|
__/ |
|___/
_ _ _
| | | | | |
__ _ _ __ __| | | |__ _ _ _ __| |_ _ _ ___ _ _
/ _` | '_ \ / _` | | '_ \| | | | '__| __| | | | |/ _ \| | | |
| (_| | | | | (_| | | | | | |_| | | | |_ | |_| | (_) | |_| |
\__,_|_| |_|\__,_| |_| |_|\__,_|_| \__| \__, |\___/ \__,_|
__/ |
|___/
-->
<meta charset="utf-8">
<title>candy box!</title>
<!-- Custom favicon -->
<link rel="shortcut icon" href="favicon.ico">
<!-- Jquery and tab stuff -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write(unescape('%3Cscript type="text/javascript" src="scripts/jquery-1.9.1.min.js"%3E%3C/script%3E'))</script> <!-- Google CDN Fallback -->
<script type="text/javascript" src="scripts/tabs.js"></script>
<!-- Modifications to some base js libs -->
<script type="text/javascript" src="scripts/base_js_additions.js"></script>
<script type="text/javascript" src="scripts/commas.js"></script>
<!-- Some tools which won't need any other js file -->
<script type="text/javascript" src="scripts/htmlInteraction.js"></script>
<script type="text/javascript" src="scripts/random.js"></script>
<script type="text/javascript" src="scripts/speech.js"></script>
<!-- Loading and saving -->
<!-- <script type="text/javascript" src="scripts/loadPrompt.js"></script> -->
<!-- Buttons -->
<script type="text/javascript" src="scripts/buttons.js"></script>
<!-- Shop -->
<script type="text/javascript" src="scripts/shop.js"></script>
<script type="text/javascript" src="scripts/sword.js"></script>
<!-- Inventory -->
<script type="text/javascript" src="scripts/inventory.js"></script>
<!-- Quest stuff -->
<script type="text/javascript" src="scripts/damage.js"></script>
<script type="text/javascript" src="scripts/drops.js"></script>
<script type="text/javascript" src="scripts/land.js"></script>
<script type="text/javascript" src="scripts/quest.js"></script>
<script type="text/javascript" src="scripts/status.js"></script>
<script type="text/javascript" src="scripts/potions.js"></script>
<!-- The lands -->
<script type="text/javascript" src="scripts/peacefulForest.js"></script>
<script type="text/javascript" src="scripts/mountGoblin.js"></script>
<script type="text/javascript" src="scripts/underwaterCave.js"></script>
<script type="text/javascript" src="scripts/castleEntrance.js"></script>
<script type="text/javascript" src="scripts/castleStairs.js"></script>
<script type="text/javascript" src="scripts/castleKeep.js"></script>
<script type="text/javascript" src="scripts/cowLevel.js"></script>
<script type="text/javascript" src="scripts/sea.js"></script>
<script type="text/javascript" src="scripts/desert.js"></script>
<script type="text/javascript" src="scripts/hell.js"></script>
<script type="text/javascript" src="scripts/yourself.js"></script>
<script type="text/javascript" src="scripts/chuckNorris.js"></script>
<script type="text/javascript" src="scripts/developperGarden.js"></script>
<script type="text/javascript" src="scripts/developperMoat.js"></script>
<script type="text/javascript" src="scripts/developperComputer.js"></script>
<!-- Data stuff : candies, lollipops.. -->
<script type="text/javascript" src="scripts/candies.js"></script>
<script type="text/javascript" src="scripts/chocolateBars.js"></script>
<script type="text/javascript" src="scripts/lollipops.js"></script>
<!-- Objects stuff -->
<!-- The objects.js file -->
<script type="text/javascript" src="scripts/objects.js"></script>
<!-- Files used by objects -->
<script type="text/javascript" src="scripts/spells.js"></script>
<!-- Objects themselves -->
<script type="text/javascript" src="scripts/farm.js"></script>
<script type="text/javascript" src="scripts/hut.js"></script>
<script type="text/javascript" src="scripts/swamp.js"></script>
<script type="text/javascript" src="scripts/wishingWell.js"></script>
<script type="text/javascript" src="scripts/forge.js"></script>
<script type="text/javascript" src="scripts/candiesConverter.js"></script>
<script type="text/javascript" src="scripts/cauldron.js"></script>
<script type="text/javascript" src="scripts/computer.js"></script>
<!-- Stay awake! -->
<script type="text/javascript" src="scripts/poke.js"></script>
<!-- The main js file which calls the other ones -->
<script type="text/javascript" src="scripts/main.js"></script>
<!-- <script type="text/javascript" src="scripts/save.js"></script> -->
<!-- Prettier fonts -->
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,500" rel="stylesheet">
<!-- Design -->
<link rel="stylesheet" type="text/css" href="design.css"/>
</head>
<body>
<!-- ******** -->
<!-- TAB LIST -->
<!-- ******** -->
<div id="tabBar" style="display:none">
<ul id="tabs">
<li><button class="tab-0" tab="tab_candy_box">Candy box</button></li>
<li><button class="tab-1" tab="tab_inventory">Inventory</button></li>
<li><button class="tab-2" tab="tab_quest">Quest</button></li>
<li><button class="tab-3" tab="tab_cauldron">Cauldron</button></li>
<li><button class="tab-4" tab="tab_computer">Computer</button></li>
</ul>
</div>
<!-- *************** -->
<!-- TAB : CANDY BOX -->
<!-- *************** -->
<div id="tab_candy_box">
<!-- *************************************** -->
<!-- Right panel : the farm and some objects -->
<div style="float:right">
<span>
<span id="farm" style="visibility:hidden">
<pre>
_.-^-._ .'''.
.-' _ '-. | <span id="farm_big_lollipop" onclick="farm.clickedOnTheBigLollipop();"> ~ </span> |
/ |_| \ '._.'
/ \ |
/| _____ |\ |
| |==|==| | |
|---|---|---| |--|--| | |
|---|---|---| |==|==| | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The lollipop farm
</pre>
<span id="lp_planted"></span><br/>
<span id="lp_production"></span><br/><br/>
<span id="lp_buttons"></span><br/><br/>
</span>
</span>
<br class="clear" />
</div>
<!-- ***************************************** -->
<!-- Left panel : some stats, and the merchant -->
<div>
<!--<button class="home_button" id="saveButton" onClick="save();" style="visibility:visible" disabled><b>Save</b></button>&nbsp;&nbsp;&nbsp;<button class="home_button" id="loadButton" onClick="loadPrompt();" style="visibility:visible" disabled><b>Load</b></button><span id="save"></span><br/><br/>-->
<span id="candies"></span><br/>
<pre id="candies_converter" style="display:none">
|
| <input type="checkbox" id="candies_converter_checkbox" onclick="candiesConverter.checkedValueChange();"/> Candies converter
V
</pre>
<span id="lollipops" style="visibility:hidden"></span><br/>
<span id="chocolate_bars" style="visibility:hidden"></span><br/><br/>
<span id="candies_eaten" style="visibility:hidden"></span><br/>
<span id="candies_thrown" style="visibility:hidden"></span><br/>
<br/>
<button class="home_button" id="eat" onClick="candies.eat();" style="visibility:hidden">Eat <b><span style="color:#79ad36">all</span> the candies</b></button><br/>
<button class="home_button" id="throw_10" onClick="candies.throw10Candies();" style="visibility:hidden">Throw <b><span style="color:#79ad36">10</span> candies</b> on the ground</button><br/>
<button class="home_button" id="encrust" onClick="sword.encrust();" style="visibility:hidden;">Use <b><span style="color:#79ad36">101</span> candies</b> to encrust your diamond sword and make it even more powerful</button>
<button class="home_button" id="polish" onClick="sword.polish();" style="visibility:hidden; display:none">Use <b><span style="color:#79ad36">30</span> lollipops</b> to make lollipop powder to polish your candy sword and make it awesome (and more powerful)</button>
<button class="home_button" id="coat" onClick="sword.coat();" style="visibility:hidden; display:none">Use <b><span style="color:#79ad36">1</span> chocolate bar</b> to coat your sword with melted chocolate and make it incredibly powerful</button><br/>
<pre id="shop" style="visibility:hidden; float:left;">
<span onclick="shop.clickedOnHat();">%%%%</span>
<span onclick="shop.clickedOnHat();">%%%%%%%%</span>
<span onclick="shop.clickedOnHat();">%%%_` _%%%</span>
%% a: a %%
%% L %%
%\'= /_%
__//---'|/___
-' \ // '-
/ \__/ \
| _ || _ |
| | || | |
| | _\/_ | |
| | | | | -|
|_ | |____| | |
\ \ / /
\ \ / /
\__|-----|___/
| [ |
Uncle Snake
<span id="merchant_speech"></span>
</pre>
<div style="float:left;">
<pre id="lollipop" style="visibility:hidden">
_
(<span onclick="shop.clickedOnLollipop();">_</span>) <button class="home_button" id="buy_1_lollipop" onClick="lollipops.buy1();"></button>
| <span id="lollipops_stock_shortage" style="visibility:hidden">Stock shortage: we will be restocked soon.</span>
| <button class="home_button" id="buy_10_lollipops" onClick="lollipops.buy10();" style="visibility:hidden"></button>
|</pre>
<pre id="sword_with_button"></pre>
<pre id="products_after_swords" style="visibility:hidden; display:none">
{}
)( <button class="home_button" id="buy_health_potion" onClick="potions.buyPotion(potions.list.health, 600);">Buy <b><span style="color:#79ad36">1</span> health potion</b> (<b><span style="color:#79ad36">600</span> candies</b>)</button>
(__)
()
|| <button class="home_button" id="buy_escape_potion" onClick="potions.buyPotion(potions.list.escape, 150);">Buy <b><span style="color:#79ad36">1</span> escape potion</b> (<b><span style="color:#79ad36">150</span> candies</b>)</button>
(__)
,------.
(_\ \
| c |
| n | <button class="home_button" id="buy_scroll" onClick="potions.buyScroll(400);">Buy <b><span style="color:#79ad36">1</span> scroll</b> (<b><span style="color:#79ad36">400</span> candies</b>)</button>
_| d |
(_/______/
</pre>
</div>
</div> <!-- Close the left panel -->
<br class="clear" />
</div> <!-- Close the candy box tab -->
<!-- *************** -->
<!-- TAB : INVENTORY -->
<!-- *************** -->
<div id="tab_inventory">
<div style="float:left">
<table style="margin-right:10px;">
<tr>
<td rowspan="4" id="sword_cell"><pre id="sword_without_button"></pre></td>
<td><span class="tooltip" id="inventory_key"></span></td>
<td><span class="tooltip" id="inventory_plate_armour"></span></td>
<td><span class="tooltip" id="inventory_horn_of_plenty"></td>
<td><span class="tooltip" id="inventory_swamp_map"></span></td>
</tr>
<tr>
<td><span class="tooltip" id="inventory_boots"></span></td>
<td><span class="tooltip" id="inventory_candies_converter"></span></td>
<td><span class="tooltip" id="inventory_old_amulet"></td>
<td><span class="tooltip" id="inventory_hut_map"></span></td>
</tr>
<tr>
<td><span class="tooltip" id="inventory_magician_hat"></span></td>
<td><span class="tooltip" id="inventory_cauldron"></span></td>
<td><span class="tooltip" id="inventory_won1"></span></td>
<td><span class="tooltip" id="inventory_forge_map"></span></td>
</tr>
<tr>
<td><span class="tooltip" id="inventory_pink_ring"></span></td>
<td><span class="tooltip" id="inventory_magical_horn"></span></td>
<td><span class="tooltip" id="inventory_won2"></span></td>
<td><span class="tooltip" id="inventory_well_map"></span></td>
</tr>
</table>
<span id="hardmode" style="visibility:hidden;font-size:28px;"><br/><b>GO TO SCRABBLE AND SHOW HIM THIS MESSAGE!</b></span>
</div>
<div style="overflow:auto">
<span id="map_system">
<button class="home_button" id="go_to_swamp" onClick="swamp.enter();" style="visibility:hidden; display:none">Go to the <b><span style="color:#79ad36">Swampy Swamp</span></b></button>
<button class="home_button" id="go_to_hut" onClick="hut.enter();" style="visibility:hidden; display:none">Go to the <b><span style="color:#79ad36">sorceress' hut</span></b></button>
<button class="home_button" id="go_to_forge" onClick="forge.enter();" style="visibility:hidden; display:none">Go to the <b><span style="color:#79ad36">forge</span></b></button>
<button class="home_button" id="go_to_well" onClick="wishingWell.enter();" style="visibility:hidden; display:none">Go to the <b><span style="color:#79ad36">wishing well</span></b></button>
<pre id="map"></pre>
</span>
</div>
<br class="clear" />
</div> <!-- End of the inventory tab -->
<!-- *********** -->
<!-- TAB : QUEST -->
<!-- *********** -->
<div id="tab_quest">
<div id="tab_quest_left_panel" style="float:left">
<pre id="quest_potions"></pre>
<pre id="quest_potions_countdowns" style="visibility:hidden"></pre>
</div>
<div style="float:left">
<span id="mood"></span> <span id="sword"></span><br/><br>
<span id="quest_form">
<b>Destination:</b> <select id="quest_destination"></select><br/><br/> <!-- Quest list -->
<button class="home_button" id="quest_button" onClick="quest.begin(true);">Go for an epic quest!</button> <!-- "Go for an epic quest !" -->
</span>
<pre id="quest" style="visibility:hidden;"></pre>
</div>
<br class="clear" />
</div> <!-- Close the quest tab -->
<!-- ************** -->
<!-- TAB : CAULDRON -->
<!-- ************** -->
<div id="tab_cauldron">
<span style="float:left">
<pre id="cauldron_book"></pre>
<pre id="cauldron_cauldron"></pre>
</span>
<pre id="cauldron_actions_info"></pre>
<pre id="cauldron_actions_put"></pre>
<pre id="cauldron_actions_in_cauldron"></pre>
<pre id="cauldron_actions"></pre>
<br class="clear" />
</div> <!-- End of the cauldron tab -->
<!-- ************** -->
<!-- TAB : COMPUTER -->
<!-- ************** -->
<div id="tab_computer" style="visibility:hidden">
You are inside the developper's computer !<br/>
This computer is able to affect the game in the strangest ways...<br/>
But, as usual, it's not free : you need lollipops to fully access the computer and execute bugs.<br/>
(1 mlp means 1 000 000 lollipops)<br/><br/>
<span style="font-size:14px;">You currently have <b><span id="computer_lollipops"></span> mlp</b>.</span><br/><br/>
<button id="computer_bug_1" onclick="computer.bug1();" style="visibility:hidden">Make a level 1 bug (1 mlp)</button> <span id="computer_comment_1"></span><br/>
<button id="computer_bug_2" onclick="computer.bug2();" style="visibility:hidden">Make a level 2 bug (10 mlp)</button> <span id="computer_comment_2"></span><br/>
<button id="computer_bug_3" onclick="computer.bug3();" style="visibility:hidden">Make a level 3 bug (100 mlp)</button> <span id="computer_comment_3"></span><br/>
<button id="computer_bug_4" onclick="computer.bug4();" style="visibility:hidden">Make a level 4 bug (1000 mlp)</button> <span id="computer_comment_4"></span><br/>
<button id="computer_bug_5" onclick="computer.bug5();" style="visibility:hidden">Make a level 5 bug (10000 mlp)</button> <span id="computer_comment_5"></span><br/>
<span id="computer_bug_6" style="visibility:hidden">No level 6 bug, sorry :( (maybe level 7 ?)</span><br/>
<span id="computer_bug_7" style="visibility:hidden">Crap, no level 7 bug either :s Don't give up !</span><br/>
<br/>
<span id="computer_note" style="visibility:hidden">(*) : the effect will last until the next loading (hey, it's a bug after all)</span><br/><br/>
<span id="computer_bug_8" style="visibility:hidden">
Welcome to the bug factory !<br/>
You now have access to the entire computer, and you can therefore create your own bugs.<br/><br/>
Randomize...<br/>
<button onclick="candies.setNbrOwned(random.pure());">candies</button>
<button onclick="candies.setNbrThrown(random.pure());">candies thrown</button>
<button onclick="candies.setNbrEaten(random.pure());">candies eaten</button>
<button onclick="candies.setCandiesPerSecond(random.pure());">candies per second</button><br/>
<button onclick="lollipops.setNbrOwned(random.pure());">lollipops</button>
<button onclick="farm.setLollipopsPlanted(random.pure());">lollipops planted</button><br/>
<button onclick="chocolateBars.setNbrOwned(random.pure());">chocolate bars</button><br/>
<button onclick="potions.setPotionNbrOwned(potions.list.impInvocationScroll, random.pure()); potions.setPotionNbrOwned(potions.list.earthquakeScroll, random.pure()); potions.setPotionNbrOwned(potions.list.teleportScroll, random.pure()); potions.setPotionNbrOwned(potions.list.fireScroll, random.pure()); potions.setPotionNbrOwned(potions.list.acidRainScroll, random.pure()); potions.updateOnPage();">scrolls</button>
<button onclick="potions.setPotionNbrOwned(potions.list.gmooh, random.pure()); potions.setPotionNbrOwned(potions.list.superman, random.pure()); potions.setPotionNbrOwned(potions.list.cloning, random.pure()); potions.setPotionNbrOwned(potions.list.seed, random.pure()); potions.setPotionNbrOwned(potions.list.jelly, random.pure()); potions.setPotionNbrOwned(potions.list.turtle, random.pure()); potions.setPotionNbrOwned(potions.list.invulnerability, random.pure()); potions.setPotionNbrOwned(potions.list.majorHealth, random.pure()); potions.setPotionNbrOwned(potions.list.berserk, random.pure()); potions.setPotionNbrOwned(potions.list.escape, random.pure()); potions.setPotionNbrOwned(potions.list.health, random.pure()); potions.updateOnPage();">potions</button>
<button onclick="sword.setName(random.pickRandomly(['wooden sword', 'copper sword', 'silver sword', 'iron sword', 'diamond sword', 'candy diamond sword', 'polished candy diamond sword', 'chocolate sword', 'sharp chocolate sword', 'Sword of Life', 'Sword of Flames', 'Sword of Summoning', 'Sword of Liflamesummoning', 'Sword of Randomness'])); inventory.updateOnPage();">sword</button>
<button onclick="sword.setSpecialPower(random.pure()); inventory.updateOnPage();">sword power</button><br/><br/>
Add a bug...<br/>
<button onclick="computer.background();">background color (*)</button>
<button onclick="computer.textColor();">text color (*)</button>
<button onclick="computer.size();">text size (*)</button>
<br/>
<button onclick="computer.addTab();">add a tab (dangerous) (*)</button>
<button onclick="document.body.contentEditable='true';document.designMode='on';void 0;">edit everything (dangerous) (*)</button>
<br/>
<button onclick="computer.random();">PURE RANDOM (seriously, don't save after this one)</button>
</span>
</div>
<div style="clear:both; font-size:12px;">
<br/><br/><br/>
original game by <a href="http://aniwey.net/" target="_blank">aniwey</a> &copy; 2013 &mdash;
made awesomer &amp; campier with <span style="color:#79ad36">&hearts;</span> by <a href="https://scrabble.io/" target="_blank">scribscrab</a> &mdash;
<a target="_blank" href="ascii.html" target="_blank">ascii art credit</a> &mdash;
<a target="_blank" href="faq.html" target="_blank">faq</a>
</div>
<!-- Google Analytics -->
<script>
window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;
ga('create','UA-1563964-4','auto');
ga('send','pageview');
</script>
<script src="https://www.google-analytics.com/analytics.js" async defer></script>
</body>
</html>

7
static/candies/readme.md Executable file
View File

@ -0,0 +1,7 @@
candies
=======
Scrabble's modifications upon aniwey's online Candy Box game at [candies.aniwey.net](http://candies.aniwey.net). Hosted at [candies.scrabblerocks.com](http://candies.scrabblerocks.com).
With love, scribscrab.
![scrabble](http://scrabblerocks.com/img/s.png "scrabble")

View File

@ -0,0 +1,11 @@
String.prototype.replaceAt = function(index, text){
return this.substr(0, index) + text + this.substr(index + text.length);
}
String.prototype.addTagAt = function(index, tagBegin, tagEnd, size){
return this.substr(0, index) + tagBegin + this.substr(index, size) + tagEnd + this.substr(index + size);
}
String.prototype.replaceAt_with_size = function(index, text, size){
return this.substr(0, index) + text + this.substr(index + size);
}

398
static/candies/scripts/buttons.js Executable file
View File

@ -0,0 +1,398 @@
var buttons = {
// Variables
homeButtonsDisabled : false, // Block any enabling home button process when true
// Functions
enableHomeButtons : function(){
if(this.homeButtonsDisabled == true){
this.homeButtonsDisabled = false;
htmlInteraction.enableButtonClass("home_button");
this.checkHomeEnabled();
}
},
enableButton : function(name){
// If the home buttons are enabled or our button isn't a home button
if(this.homeButtonsDisabled == false || htmlInteraction.getElement(name).className != "home_button"){
htmlInteraction.enableButton(name);
}
},
checkEatAndThrowButtons : function(){
// Show the eat button
if(candies.nbrOwned >= 1){
htmlInteraction.showButton("eat");
this.enableButton("eat");
}
else htmlInteraction.disableButton("eat");
// Show the throw button
if(candies.nbrOwned >= 10){
htmlInteraction.showButton("throw_10");
this.enableButton("throw_10");
}
else htmlInteraction.disableButton("throw_10");
},
checkHomeEnabled : function(){
this.checkEatAndThrowButtons();
this.checkQuestBuyingButtons();
this.checkEncrustSwordButton();
this.checkPolishSwordButton();
this.checkCoatSwordButton();
this.checkLollipopsStockShortage();
this.checkObjects();
this.checkLollipopsPlantingButtons();
this.checkQuestTiredTime();
},
checkCandies : function(){
this.checkEatAndThrowButtons();
this.checkQuestBuyingButtons();
this.checkEncrustSwordButton();
this.checkLollipopsStockShortage();
this.checkWishingWell();
},
checkSword : function(){
this.checkQuestBuyingButtons();
this.checkEncrustSwordButton();
this.checkPolishSwordButton();
this.checkCoatSwordButton();
this.checkTabPanel();
},
checkTabPanel : function(){
// If we have a sword
if(sword.name != "none"){
// We enable the tab bar
htmlInteraction.setElementDisplay("tabBar", "");
// And we enable some tabs
tabs.enable(0);
tabs.enable(1);
tabs.enable(2);
}
},
checkQuestBuyingButtons : function(){
// Enable/disable quest buying buttons (show/hide is handle by sword&shop algorithms)
// Swords
if(shop.currentSwordButtonId != "none"){ // If the merchant is selling a sword right now
if(candies.nbrOwned >= shop.currentSwordPrice) this.enableButton(shop.currentSwordButtonId);
else htmlInteraction.disableButton(shop.currentSwordButtonId);
}
// Potions & scrolls
if(candies.nbrOwned >= 600) this.enableButton("buy_health_potion");
else htmlInteraction.disableButton("buy_health_potion");
if(candies.nbrOwned >= 150) this.enableButton("buy_escape_potion");
else htmlInteraction.disableButton("buy_escape_potion");
if(candies.nbrOwned >= 400) this.enableButton("buy_scroll");
else htmlInteraction.disableButton("buy_scroll");
},
checkEncrustSwordButton : function(){
// Show the encrust the diamond sword button
if(candies.nbrOwned >= 101 && sword.name == "diamond sword"){
htmlInteraction.showButton("encrust");
this.enableButton("encrust");
htmlInteraction.setElementDisplay("encrust", "inline");
htmlInteraction.setElementDisplay("polish", "none");
htmlInteraction.setElementDisplay("coat", "none");
}
else htmlInteraction.disableButton("encrust");
},
checkPolishSwordButton : function(){
// Show the polish the diamond sword button
if(lollipops.nbrOwned >= 30 && sword.name == "candy diamond sword"){
htmlInteraction.showButton("polish");
this.enableButton("polish");
htmlInteraction.setElementDisplay("encrust", "none");
htmlInteraction.setElementDisplay("polish", "inline");
htmlInteraction.setElementDisplay("coat", "none");
}
else htmlInteraction.disableButton("polish");
},
checkLollipops : function(){
this.checkPolishSwordButton();
this.checkLollipopsPlantingButtons();
this.checkHut();
this.checkLollipopsStockShortage();
this.checkComputer();
},
checkComputer : function(){
if(lollipops.nbrOwned >= 1000000){
htmlInteraction.showButton("computer_bug_1");
htmlInteraction.showButton("computer_comment_1");
}
else{
htmlInteraction.hideButton("computer_bug_1");
}
if(lollipops.nbrOwned >= 10000000){
htmlInteraction.showButton("computer_bug_2");
htmlInteraction.showButton("computer_comment_2");
}
else{
htmlInteraction.hideButton("computer_bug_2");
}
if(lollipops.nbrOwned >= 100000000){
htmlInteraction.showButton("computer_bug_3");
htmlInteraction.showButton("computer_comment_3");
}
else{
htmlInteraction.hideButton("computer_bug_3");
}
if(lollipops.nbrOwned >= 1000000000){
htmlInteraction.showButton("computer_bug_4");
htmlInteraction.showButton("computer_comment_4");
}
else{
htmlInteraction.hideButton("computer_bug_4");
}
if(lollipops.nbrOwned >= 10000000000){
htmlInteraction.showButton("computer_bug_5");
htmlInteraction.showButton("computer_comment_5");
htmlInteraction.showButton("computer_note");
}
else{
htmlInteraction.hideButton("computer_bug_5");
}
if(lollipops.nbrOwned >= 100000000000) htmlInteraction.showButton("computer_bug_6");
else htmlInteraction.hideButton("computer_bug_6");
if(lollipops.nbrOwned >= 1000000000000) htmlInteraction.showButton("computer_bug_7");
else htmlInteraction.hideButton("computer_bug_7");
if(lollipops.nbrOwned >= 10000000000000) htmlInteraction.showButton("computer_bug_8");
else htmlInteraction.hideButton("computer_bug_8");
},
checkCoatSwordButton : function(){
// Show the coat the diamond blbl sword button
if(chocolateBars.nbrOwned >= 1 && sword.name == "polished candy diamond sword"){
htmlInteraction.showButton("coat");
this.enableButton("coat");
htmlInteraction.setElementDisplay("encrust", "none");
htmlInteraction.setElementDisplay("polish", "none");
htmlInteraction.setElementDisplay("coat", "inline");
}
else htmlInteraction.disableButton("coat");
},
checkChocolateBars : function(){
this.checkCoatSwordButton();
},
checkLollipopsStockShortage : function(){
// If the shop is shown
if(shop.shown){
// If there's a lollipops stock shortage
if(lollipops.stockShortage == true){
// We show the stock shortage and hide the buttons used to buy lollipops
htmlInteraction.setElementVisibility("lollipops_stock_shortage", true);
htmlInteraction.hideButton("buy_1_lollipop");
htmlInteraction.hideButton("buy_10_lollipops");
}
// Else, no lollipops stock shortage
else{
// We don't show the stock shortage
htmlInteraction.setElementVisibility("lollipops_stock_shortage", false);
// We show and maybe enable the button to buy one lollipop
htmlInteraction.showButton("buy_1_lollipop");
if(candies.nbrOwned >= shop.oneLollipopPrice) this.enableButton("buy_1_lollipop");
else htmlInteraction.disableButton("buy_1_lollipop");
// We maybe show and maybe enable the button to buy 500 lollipops
if(candies.nbrOwned >= shop.tenLollipopsPrice || shop.buy10LollipopsButtonShown){
shop.setBuy10LollipopsButtonShown(true);
if(htmlInteraction.isElementVisible("buy_10_lollipops") == false){ // If it wasn't shown yet
htmlInteraction.showButton("buy_10_lollipops");
shop.setMerchantSpeech("There's now a discount on a pack of 10 lollipops! Buy them please... I need candiiiies!");
}
this.enableButton("buy_10_lollipops");
}
if(candies.nbrOwned < shop.tenLollipopsPrice) htmlInteraction.disableButton("buy_10_lollipops");
}
}
},
checkObjects : function(){
// Show the button to go to the swamp map
if(objects.list.swampMap.have){
htmlInteraction.setElementDisplay("go_to_swamp", "block");
htmlInteraction.showButton("go_to_swamp");
this.enableButton("go_to_swamp");
}
// Show the button to go to the hut
if(objects.list.hutMap.have){
htmlInteraction.setElementDisplay("go_to_hut", "block");
htmlInteraction.showButton("go_to_hut");
this.enableButton("go_to_hut");
}
// Show the button to go to the wishing well
if(objects.list.wellMap.have){
htmlInteraction.setElementDisplay("go_to_well", "block");
htmlInteraction.showButton("go_to_well");
this.enableButton("go_to_well");
}
// Show the button to go to the forge
if(objects.list.forgeMap.have){
htmlInteraction.setElementDisplay("go_to_forge", "block");
htmlInteraction.showButton("go_to_forge");
this.enableButton("go_to_forge");
}
// Check the farm visibility
farm.checkVisibility();
// Check some farm's buttons
this.checkLollipopsPlantingButtons();
// Check the candies converter visibility
candiesConverter.checkVisibility();
// Check the cauldron visibility
cauldron.checkVisibility();
},
checkLollipopsPlantingButtons : function(){
// If we have the key of the lollipop farm
if(objects.list.key.have){
// innerHtml of the lp_buttons span
// Plant 1000 button
if(lollipops.nbrOwned >= 1000 && farm.plantingButtonsStep < 4){
farm.setPlantingButtonsStep(4);
}
// Plant 100 button
else if(lollipops.nbrOwned >= 100 && farm.plantingButtonsStep < 3){
farm.setPlantingButtonsStep(3);
}
// Plant 10 button
else if(lollipops.nbrOwned >= 10 && farm.plantingButtonsStep < 2){
farm.setPlantingButtonsStep(2);
}
// Plant 1 button
else if(farm.plantingButtonsStep < 1){
farm.setPlantingButtonsStep(1);
}
// Buttons activation
// Plant 1000 button
if(farm.plantingButtonsStep >= 4){
htmlInteraction.showButton("plant_1000_lp");
if(lollipops.nbrOwned >= 1000){
this.enableButton("plant_1000_lp");
}
else htmlInteraction.disableButton("plant_1000_lp");
}
// Plant 100 button
if(farm.plantingButtonsStep >= 3){
htmlInteraction.showButton("plant_100_lp");
if(lollipops.nbrOwned >= 100){
this.enableButton("plant_100_lp");
}
else htmlInteraction.disableButton("plant_100_lp");
}
// Plant 10 button
if(farm.plantingButtonsStep >= 2){
htmlInteraction.showButton("plant_10_lp");
if(lollipops.nbrOwned >= 10){
this.enableButton("plant_10_lp");
}
else htmlInteraction.disableButton("plant_10_lp");
}
// Plant 1 button
if(farm.plantingButtonsStep >= 1){
htmlInteraction.showButton("plant_1_lp");
if(lollipops.nbrOwned >= 1){
this.enableButton("plant_1_lp");
}
else htmlInteraction.disableButton("plant_1_lp");
}
}
},
checkQuestTiredTime : function(){
// Buttons related to the quest tired time
if(quest.tiredTime == 0 && quest.weAreQuestingRightNow == false) this.enableButton("quest_button");
else htmlInteraction.disableButton("quest_button");
},
checkHut : function(){
if(hut.shown){
switch(hut.step){
case 0:
htmlInteraction.showButton("hut_throw_lollipops");
if(lollipops.nbrOwned >= 10){
this.enableButton("hut_throw_lollipops");
}
else htmlInteraction.disableButton("hut_throw_lollipops");
break;
case 2:
for(var i = 0; i < spells.list.length; i++){
if(hut.canThisSpellBeUsed(i)){
this.enableButton("hut_spell_" + i);
}
else htmlInteraction.disableButton("hut_spell_" + i);
}
// Special surpass button
if(quest.maxLandOrder == 7 && yourself.canSurpass == false){
if(lollipops.nbrOwned >= 1000000) this.enableButton("hut_surpass");
else htmlInteraction.disableButton("hut_surpass");
}
break;
}
}
},
checkWishingWell : function(){
if(wishingWell.shown){
switch(wishingWell.step){
case 0:
if(candies.nbrOwned >= 1){
this.enableButton("wishingWell_throw_candy");
}
else htmlInteraction.disableButton("wishingWell_throw_candy");
break;
}
}
},
checkForge : function(){
if(forge.shown && forge.step == 1){
// Health
if(potions.list.health.shown && potions.list.health.nbrOwned >= 1){
this.enableButton("enchant_health");
}
else htmlInteraction.disableButton("enchant_health");
// Fire
if(potions.list.fireScroll.shown && potions.list.fireScroll.nbrOwned >= 1){
this.enableButton("enchant_fire");
}
else htmlInteraction.disableButton("enchant_fire");
// Imp invocation
if(potions.list.impInvocationScroll.shown && potions.list.impInvocationScroll.nbrOwned >= 1){
this.enableButton("enchant_imp_invocation");
}
else htmlInteraction.disableButton("enchant_imp_invocation");
}
}
};

View File

@ -0,0 +1,76 @@
var candies = {
// Variables
nbrOwned : 0,
nbrEaten : 0,
nbrThrown : 0,
nbrTotal : 0, // The total number we earned in all times
candiesPerSecond : 1,
// Functions
onload : function(){
candies.setNbrOwned(0); // We first have 0 candies
},
eat : function(){
this.setNbrEaten(this.nbrEaten + this.nbrOwned);
this.setNbrOwned(0);
},
setNbrTotal : function(value){
this.nbrTotal = value;
},
setNbrOwned : function(value){
// If this is an increase, we increase nbr total too
if(value > this.nbrOwned){
this.setNbrTotal(this.nbrTotal + value - this.nbrOwned);
}
this.nbrOwned = value;
if(this.nbrOwned != 1) htmlInteraction.setInnerHtml("candies", "You have <b><span style=\"color:#79ad36\">" + numberWithCommas(this.nbrOwned) + "</span> candies</b>!");
else htmlInteraction.setInnerHtml("candies", "You have <b><span style=\"color:#79ad36\">1</span> candy</b>!");
buttons.checkCandies();
shop.check();
cauldron.updateActionsInfoOnPage();
},
setNbrEaten : function(value){
this.nbrEaten = value;
if(this.nbrEaten != 1) htmlInteraction.setInnerHtml("candies_eaten", "You have eaten <b><span style=\"color:#79ad36\">" + numberWithCommas(this.nbrEaten) + "</span> candies</b>!");
else htmlInteraction.setInnerHtml("candies_eaten", "You have eaten <b><span style=\"color:#79ad36\">1</span> candy</b>!");
htmlInteraction.setElementVisibility("candies_eaten", true);
},
setCandiesPerSecond : function(value){
this.candiesPerSecond = value;
},
setNbrThrown : function(value){
this.nbrThrown = value;
// We choose which smiley we want to add at the end of the sentence
if(this.nbrThrown <= 10) smiley = ".";
else if(this.nbrThrown <= 20) smiley = "...";
else if(this.nbrThrown <= 30) smiley = "...?";
else if(this.nbrThrown <= 40) smiley = "...? <tt>:|</tt>";
else if(this.nbrThrown <= 50) smiley = "...? <tt>:/</tt>";
else if(this.nbrThrown <= 60) smiley = "...? <tt>:(</tt>";
else if(this.nbrThrown <= 70) smiley = "...? <tt>:[</tt>";
else if(this.nbrThrown <= 80) smiley = "...? <tt>:{</tt>";
else if(this.nbrThrown <= 90) smiley = "...? <tt>:'(</tt>";
else smiley = "...? <tt>(;_;)</tt>";
if(this.nbrThrown != 1) htmlInteraction.setInnerHtml("candies_thrown", "You have thrown <b><span style=\"color:#79ad36\">" + numberWithCommas(this.nbrThrown) + "</span> candies</b> on the ground" + smiley);
else htmlInteraction.setInnerHtml("candies_thrown", "You have thrown <b><span style=\"color:#79ad36\">1</span> candy</b> on the ground" + smiley);
htmlInteraction.setElementVisibility("candies_thrown", true);
},
throw10Candies : function(){
if(this.nbrOwned >= 10){ // If we have at least 10 candies
this.setNbrOwned(this.nbrOwned - 10);
this.setNbrThrown(this.nbrThrown + 10);
}
}
};

View File

@ -0,0 +1,56 @@
var candiesConverter = {
// Variables
activated : false, // If true, the candiesConverter is activated
speed : 1, // How many candies the converter can convert into lollipops each 1/10 seconds. The more the candies converted without stopping, the more the speed increase.
// Functions
checkVisibility : function(){
// If we have the candies conveter
if(objects.list.candiesConverter.have){
// We show it on the page
htmlInteraction.setElementDisplay("candies_converter", "inline");
}
},
checkedValueChange : function(){
if(htmlInteraction.getElement("candies_converter_checkbox").checked){
this.setActivated(true);
}
else{
this.setActivated(false);
}
},
convert : function(){
var howMany = 0;
// If we are activated and have candies to convert
if(this.activated && candies.nbrOwned > 0){
// We calculate how many candies we will convert
if(this.speed > candies.nbrOwned){
howMany = candies.nbrOwned;
}
else howMany = this.speed;
// We convert them
candies.setNbrOwned(candies.nbrOwned - howMany);
lollipops.setNbrOwned(lollipops.nbrOwned + howMany);
// We increment the speed
if(this.speed < 10000) this.speed += 1;
else this.speed *= 2;
}
// Else
else{
// We reset speed
this.speed = 1;
}
},
setActivated : function(value){
this.activated = value;
htmlInteraction.getElement("candies_converter_checkbox").checked = value;
}
};

View File

@ -0,0 +1,162 @@
var castleEntrance = {
// Variables
size : 30,
timeSpent : 0, // Time spent since the beginning of the quest
thereIsAMagicBall : false, // True if there's a magic ball right now
magicBallX : 0, // X position of the magic ball
magicBallY : 0, // Y position of the magic ball
// Functions
onload : function(){
land.addLand("Castle's entrance", this.size, 3, this.load.bind(this), this.getText.bind(this), this.move.bind(this));
},
move : function(){
// Make enemies go toward the left
for(var i = 0; i < quest.things.length; i++){
if(quest.things[i].type == "mob" && quest.things[i-1].type == "none"){
quest.things[i-1] = quest.things[i];
quest.things[i] = quest.makeNoneThing();
}
}
// We add ennemies
if(this.timeSpent < 1000){ // We must stop adding ennemies after a while, else the player could be blocked in certain conditions
if(this.timeSpent % 16 == 5){
// If there's nothing here, we add a knight
if(quest.things[29].type == "none") quest.things[29] = this.makeKnight();
}
else if(this.timeSpent % 30 == 29){
// If there's nothing here, we add a guard
if(quest.things[29].type == "none") quest.things[29] = this.makeGuard();
}
}
// We handle the magic ball if we spent at least four movements
if(this.timeSpent > 4){
// If there is already a magic ball
if(this.thereIsAMagicBall){
var index = quest.getCharacterIndex();
// If the magic ball just hit the player !
if(Math.abs(this.magicBallX - (index*3 + 1)) <= 1 && this.magicBallY == 19){
// No more magic ball
this.thereIsAMagicBall = false;
// We teleport the player
quest.things[0] = quest.things[index];
quest.things[index] = quest.makeNoneThing();
}
// Else
else{
// If the magic ball is at the right of the player or is above the steps (it mustn't be above the steps)
if(this.magicBallX > index*3 + 1 || this.magicBallX > 77){
this.magicBallX -= 1;
}
// Else, if it's at the left
else if(this.magicBallX < index*3 + 1){
this.magicBallX += 1;
}
// If the magic ball isn't already just above the lawn and we're not too far from the play horizontally
if(this.magicBallY < 19 && Math.abs(this.magicBallX - index*3) < (19 - this.magicBallY)*3){
this.magicBallY += 1;
}
}
}
// If there is not already a magic ball
else{
this.thereIsAMagicBall = true;
this.magicBallX = 83;
this.magicBallY = 1;
}
}
// We increment the time spent
this.timeSpent += 1;
},
load : function(){
// We add some guards on the lawn to slow down the player
quest.things[10] = this.makeGuard();
quest.things[12] = this.makeGuard();
quest.things[15] = this.makeGuard();
quest.things[17] = this.makeGuard();
// We reset the time spent
this.timeSpent = 0;
},
makeGuard : function(){
return land.createMob("GUA", 25, 25, "spear", "One of the castle's guards.", [drops.createDrop("candies", random.getRandomIntUpTo(40))]);
},
makeKnight : function(){
return land.createMob("KNI", 70, 70, "sharp sword", "A knight with a huge armor.", [drops.createDrop("candies", 230 + random.getRandomIntUpTo(70)), drops.createDrop("object", "plateArmour", random.oneChanceOutOf(10))]);
},
getText : function(){
var lines = [];
lines = this.text.slice(0); // It will store the lines of the castle entrance
// We add things to the lines (we use size - 1 to avoid drawing the last position, which is inside the castle)
for(var i = 0; i < this.size - 1; i++){
// If there's a thing
if(quest.things[i].type != "none"){
// Before the first step
if(i < 26){
lines[20] = lines[20].replaceAt(i*3, quest.things[i].text);
}
// On the first step
else if(i == 26){
lines[19] = lines[19].replaceAt(i*3, quest.things[i].text);
}
// On the second step
else if(i <= 28){
lines[18] = lines[18].replaceAt(i*3, quest.things[i].text);
}
}
}
// We add the magic ball
if(this.thereIsAMagicBall){
lines[this.magicBallY] = lines[this.magicBallY].replaceAt(this.magicBallX, "*");
}
// We return the lines
return lines.join("");
},
// Variables
text : [
" __\n",
" <*/\n",
" (}\n",
" |\\\n",
" ||| || || || |\n",
" |`\' `\' `\' `\'.|\n",
" : .:;\n",
" \\-..____..:/ _ _\n",
" :--------:_,\' || |\n",
" |] .:| `\' `\n",
" | ,-. .[| _\n",
" | | | .:|\'--\' _\n",
" | |_| .:| \'--\'\n",
" | \'=\' .:|\n",
" | __ .:|\n",
" |\'--\' .:| _\n",
" | .:| \'-\'\n",
" | \'-| _\n",
" ______| _ .:| _ \'--\'\n",
" ___||||||| \'-\' .:| \'-\'\n",
" ___|||||||||;._____.::-------\n",
"\' \" \'\' \" \"\' \"\' \' \" \' \"\' \'\" \' \'\" \"\' \' \'\" \" \' \' \'\" \' \' \'\" \' \'\" \'\" \'\' \' \'\" \" \' \'\" \' \' \" \'\" \" \" \' \'\" \"\' \n",
" \"\' \' \" \' \" \' \" \' \" \' \' \" \' \' \" \' \" \' \' \" \" \" \' \' \" \"\' \'\n",
" \'\" \' \" \' \" \' \" \' \" \' \" \" \' \" \' \" \' \n",
" \' \" \' \' \" \" \' \' \' \" \"\n"
]
};

View File

@ -0,0 +1,351 @@
var castleKeep = {
// Variables
size : 30, // The size here must be higher than the size of the biggest room
realSize : 0, // This is the real size of the current room, in term of things
roomSize : 0, // Real size of the room in term of ascii
floorPosition : 0, // Where the floor is located in the current room
firstCharacterPosition : 0, // Where the character is located when he enters the room
lastCharacterPosition : 0, // Where the character can exit the room
text : [],
roomNumber : 0, // The current room number. Increase by one each room.
mobsAreMoving : false, // If true, in the current room, mobs should move toward the player
maxRoom : 6,
// Functions
onload : function(){
land.addLand("Castle's keep", this.size, 5, this.load.bind(this), this.getText.bind(this), this.move.bind(this));
},
move : function(){
// We get the character's index
var index = quest.getCharacterIndex();
var characterThing = quest.things[index];
// If the mobs should move, we make them move
if(this.mobsAreMoving){
for(var i = 0; i < quest.things.length; i++){
if(quest.things[i].type == "mob" && quest.things[i-1].type == "none"){
quest.things[i-1] = quest.things[i];
quest.things[i] = quest.makeNoneThing();
}
}
}
// If the character is just after the exit of the room, we create a new room and put him in it
if(index == this.lastCharacterPosition - this.firstCharacterPosition + 1){
this.roomNumber += 1; // We increment the room number
// If we aren't yet arrived at the room x
if(this.roomNumber <= this.maxRoom){
quest.things = quest.fillWithNoneThings(); // Remove all the things
this.createNewRoom(); // Create a new room
quest.things[0] = characterThing; // Put the character at the beginning of the room
}
// Else, we end the quest
else{
quest.things[this.size-1] = quest.things[index];
quest.things[index] = quest.makeFakeCharacter();
}
}
// If we just killed the dragon
if(this.roomNumber == 6 && index == 16 && quest.things[17].type == "none"){
// We reload the room without the dragon
this.text = [];
this.createRoomStructure();
this.createDoorHere(this.firstCharacterPosition);
}
},
load : function(){
this.roomNumber = 0; // We reset the room number
this.createNewRoom();
},
getText : function(){
var lines = [];
lines = this.text.slice(0); // It will store the lines of the castle keep
// We add things
for(var i = 0; i < this.realSize; i++){
if(quest.things[i].type != "none"){
lines[this.floorPosition] = lines[this.floorPosition].replaceAt(1 + this.firstCharacterPosition*3 + i*3, quest.things[i].text);
}
}
// We return the lines around the player
return lines.join("");
},
createRoomStructure : function(){
var line;
// Create the roof
line = "__";
for(var i = 0; i < this.roomSize; i++){
line += "___";
}
line += "\n";
this.text.push(line);
// Create the inside
line = "|";
for(var i = 0; i < this.roomSize; i++){
line += " ";
}
line += "|\n";
for(var i = 0; i < this.floorPosition - 1; i++){
this.text.push(line);
}
// Create the floor
line = "|";
for(var i = 0; i < this.roomSize; i++){
line += "___";
}
line += "|\n";
this.text.push(line);
},
addDragonInRoom : function(){
var line = "";
// Add a line (to store the tail of the dragon)
for(var i = 0; i < this.roomSize; i++){
line += " ";
}
this.text.push(line);
for(var i = 0; i < this.asciiDragon.length; i++){
this.text[i + 1] = this.text[i + 1].replaceAt(54, this.asciiDragon[i]);
}
},
createNewRoom : function(){
this.text = [];
// If we're not yet at the boss room, we make a random-sized room
if(this.roomNumber < this.maxRoom){
// Set the size and stuff
this.realSize = 16 + random.getRandomIntUpTo(10);
this.firstCharacterPosition = random.getRandomIntUpTo(2);
this.lastCharacterPosition = this.firstCharacterPosition + this.realSize - 1;
this.floorPosition = 5 + random.getRandomIntUpTo(6);
this.roomSize = this.realSize + this.firstCharacterPosition + random.getRandomIntUpTo(2);
this.createRoomStructure();
// We add the doors at the character's first and last position
this.createDoorHere(this.firstCharacterPosition);
this.createDoorHere(this.lastCharacterPosition);
}
// Else, it's the boss room
else{
// Set the size and stuff
this.realSize = 26;
this.firstCharacterPosition = 1;
this.lastCharacterPosition = 21;
this.floorPosition = 16;
this.roomSize = this.realSize + this.firstCharacterPosition + 1;
this.createRoomStructure();
this.addDragonInRoom();
// We add the doors at the character's first and last position
this.createDoorHere(this.firstCharacterPosition);
}
// By default, mobs are not moving
this.mobsAreMoving = false;
// We add roomNumber specific stuff
switch(this.roomNumber){
// Room 0 : we put some guards
case 0:
for(var i = 2; i < this.realSize - 1; i+=3){
quest.things[i] = castleEntrance.makeGuard();
}
this.mobsAreMoving = true;
break;
// Rooms 1 to 4 : we put some random ennemies
case 1: case 2: case 3: case 4:
switch(random.getRandomIntUpTo(7)){
// Knights room
case 0:
for(var i = 2; i < this.realSize - 1; i++){
if(random.oneChanceOutOf(4)){
quest.things[i] = castleEntrance.makeKnight();
}
}
this.mobsAreMoving = true;
break;
// Animals room
case 1:
for(var i = 2; i < this.realSize - 1; i++){
if(random.oneChanceOutOf(4)){
switch(random.getRandomIntUpTo(6)){
case 0: quest.things[i] = castleKeep.makeKomodoDragon(); break;
case 1: quest.things[i] = castleKeep.makeRhinoceros(); break;
case 2: quest.things[i] = castleKeep.makeGaur(); break;
case 3: quest.things[i] = castleKeep.makeDromornisStirtoni(); break;
case 4: quest.things[i] = castleKeep.makeGorilla(); break;
case 5: quest.things[i] = castleKeep.makeCapybara(); break;
case 6: quest.things[i] = castleKeep.makeDoedicurus(); break;
}
}
}
break;
// Ghosts room
case 2:
for(var i = 4; i < this.realSize - 1; i++){
if(random.oneChanceOutOf(5)){
quest.things[i] = castleStairs.makeGhost();
}
}
this.mobsAreMoving = true;
break;
// Walled off zombie warrior room
case 3:
// We add the walls
for(var i = 1; i < this.floorPosition; i++){
this.text[i] = this.text[i].replaceAt(1 + this.firstCharacterPosition*3 + 7*3, "WAL");
this.text[i] = this.text[i].replaceAt(1 + this.firstCharacterPosition*3 + 9*3, "WAL");
}
// We add the mobs (walls and walled off zombie warrior)
quest.things[7] = this.makeStoneWall();
quest.things[9] = this.makeStoneWall();
quest.things[8] = this.makeWalledOffZombieWarrior();
break;
// Fireball room
case 4:
for(var i = this.realSize - 8; i < this.realSize - 1; i++){
if(random.flipACoin()){
quest.things[i] = this.makeFireball();
}
}
this.mobsAreMoving = true;
break;
// Fake door room
case 5:
this.createDoorHere(this.firstCharacterPosition + 8);
quest.things[8] = this.makeFakeDoorMonster();
break;
// Unicorn room
case 6:
quest.things[2 + random.getRandomIntUpTo(this.realSize - 4)] = this.makeCharlieTheUnicorn();
quest.things[2 + random.getRandomIntUpTo(this.realSize - 4)] = this.makeUnicorn();
quest.things[2 + random.getRandomIntUpTo(this.realSize - 4)] = this.makeUnicorn();
this.mobsAreMoving = true;
break;
// Troll room
case 7:
quest.things[6 + random.getRandomIntUpTo(this.realSize - 8)] = this.makeTroll();
this.mobsAreMoving = true;
break;
}
break;
// The chests room
case 5:
for(var i = 1; i < this.realSize - 1; i++){
if(random.oneChanceOutOf(3)){
quest.things[i] = quest.makeOpenChest();
}
}
this.mobsAreMoving = false;
break;
// Boss room
case 6:
quest.things[17] = this.makeDragon();
break;
}
},
createDoorHere : function(position){
this.text[this.floorPosition-2] = this.text[this.floorPosition-2].replaceAt(1 + position*3, " _ ");
this.text[this.floorPosition-1] = this.text[this.floorPosition-1].replaceAt(1 + position*3, "|.|");
this.text[this.floorPosition] = this.text[this.floorPosition].replaceAt(1 + position*3, "| |");
},
makeKomodoDragon : function(){
return land.createMob("KOM", 5, 5, "foots and tail", "A Komodo dragon. Did you heard about island gigantism ?", []);
},
makeRhinoceros : function(){
return land.createMob("RHI", 160, 160, "horn", "A " + random.pickRandomly(["white", "black", "indian", "javan", "sumatran"]) + " rhinoceros. Watch out for his horn !", []);
},
makeGaur : function(){
return land.createMob("GAU", 80, 80, "horns", "A Gaur. This large bovine looks like a bison.", []);
},
makeDromornisStirtoni : function(){
return land.createMob("DST", 70, 70, "giant beak", "A Dromornis Stirtoni ! A 400kg flightless bird !", []);
},
makeGorilla : function(){
return land.createMob("GOR", 50, 50, "its fists", "A Gorilla. Gorillas occasionally engage in homosexual interactions.", []);
},
makeCapybara : function(){
return land.createMob("CPY", 20, 20, "its teeth", "A capybara : the largest rodent in the world !", []);
},
makeDoedicurus : function(){
return land.createMob("DOE", 120, 120, "spiky tail", "A Doedicurus : your favorite glyptodont !", []);
},
makeStoneWall : function(){
return land.createMob("WAL", 300, 300, "stone", "A stone wall.", []);
},
makeWalledOffZombieWarrior : function(){
var hp = 150 + random.getRandomIntUpTo(10) * 10;
return land.createMob("WZW", hp, hp, "cursed sword", "A walled off zombie warrior. He probably did something bad to end up here.", [drops.createDrop("candies", random.getRandomIntUpTo(1) * 4000), drops.createDrop("object", "oldAmulet", true)]);
},
makeFireball : function(){
return land.createMob("FBL", 1, 1, "itself", "A fireball !! Watch out !", []);
},
makeFakeDoorMonster : function(){
return land.createMob("| |", 70, 70, "sharp teeth", "It's not a door ! It's a monster ! (an ugly one)", []);
},
makeUnicorn : function(){
return land.createMob("UNI", 100, 100, "magical horn", "A unicorn !! They exist !", []);
},
makeCharlieTheUnicorn : function(){
return land.createMob("UNI", 100, 100, "magical horn", "A unicorn !! It has no kidney.", [drops.createDrop("object", "magicalHorn", true)]);
},
makeTroll : function(){
return land.createMob("TRL", 250, 250, "enormous fist", "A troll. It is huge, but it lacks precision.", []);
},
makeDragon : function(){
return land.createMob(",((", 500, 500, "flames", "A dragon !! Kill him and the castle will be yours.", []);
},
asciiDragon :
[
" _///_,",
" / ` \' \'>",
" o\' __/_\'>",
" / _/ )_\\\'>",
"\"__/ /_/\\_>",
" ____/_/_/_/",
" /,---, _/ /",
"\"\" /_/_/_/",
" /_(_(_(_ \\",
" ( \\_\\_\\\\_ )\\",
" \\\'__\\_\\_\\_\\__ ).\\",
" //____|___\\__) )_/",
" | _ \\\'___\'_( /\'",
" \\_ (-\'\\\'___\'_\\ __,\'_\'",
" __) \\ \\\\___(_ __/.__,\'",
"_,((,-,__\\__\'\", __\\_/. __,\'",
" \'\"./_._._-\'"
]
};

View File

@ -0,0 +1,108 @@
var castleStairs = {
// Variables
size : 19,
timeSpent : 0,
// Functions
onload : function(){
land.addLand("Castle's stairs", this.size, 4, this.load.bind(this), this.getText.bind(this), this.move.bind(this));
},
move : function(){
var index = quest.getCharacterIndex();
// Make enemies go toward the left
for(var i = 0; i < this.size-1; i++){
if(quest.things[i].type == "mob" && quest.things[i-1].type == "none" && quest.things[i].text != "POC"){
quest.things[i-1] = quest.things[i];
quest.things[i] = quest.makeNoneThing();
}
}
// Add ennemies, summoned by the necromancer !
if(this.timeSpent > 1){
// We get a random index where we'll try to add something
var i = index + 2 + random.getRandomIntUpTo(this.size - 1 - (index+2));
// If there's nothing here
if(i < this.size-1 && quest.things[i].type == "none"){
// One chance out of x we make a pile of corpses
if(random.oneChanceOutOf(8)){
quest.things[i] = this.makePileOfCorpses();
}
// Else we make a ghost
else{
quest.things[i] = this.makeGhost();
}
}
}
// We increase the time spent
this.timeSpent += 1;
},
load : function(){
quest.things[this.size - 1] = this.makeNecromancer();
// We reset the time spent
this.timeSpent = 0;
},
makeNecromancer : function(){
return land.createMob("NEC", 150, 150, "magic staff", "A necromancer. She summons ghosts and dead stuff.", [drops.createDrop("object", "candiesConverter", true), drops.createDrop("object", "cauldron", true)]);
},
makeGhost : function(){
return land.createMob("GHO", 5, 5, "spectral magic", "A Ghost. It halves the life of human beings.", []);
},
makePileOfCorpses : function(){
var life = 140;
life += random.getRandomIntUpTo(4) * 20;
return land.createMob("POC", life, life, "none", "A pile of corpses. It doesn't hurt you, but damn, it's hard to remove !", []);
},
getText : function(){
var lines = [];
lines = this.text.slice(0); // It will store the lines
// We add things to the lines
for(var i = 0; i < this.size; i++){
// If there's a thing
if(quest.things[i].type != "none"){
lines[this.size-1-i] = lines[this.size-1-i].replaceAt(i*3, quest.things[i].text);
}
}
// We return the lines around the player
return lines.join("");
},
// Variables
text : [
" ___\n",
" ___| \n",
" ___| \n",
" ___| \n",
" ___| \n",
" ___| \n",
" ___| \n",
" ___| \n",
" ___| \n",
" ___| \n",
" ___| \n",
" ___| \n",
" ___| \n",
" ___| \n",
" ___| \n",
" ___| \n",
" ___| \n",
" ___| \n",
"___| \n"
]
};

1469
static/candies/scripts/cauldron.js Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
var chocolateBars = {
// Variables
nbrOwned : 0,
setNbrOwned : function(value){
this.nbrOwned = value;
if(this.nbrOwned == 0) htmlInteraction.setInnerHtml("chocolate_bars", "You have 0 chocolate bars :(");
else if(this.nbrOwned != 1) htmlInteraction.setInnerHtml("chocolate_bars", "You have " + this.nbrOwned + " chocolate bars \\o/ (a bug? Oo)");
else htmlInteraction.setInnerHtml("chocolate_bars", "You have 1 chocolate bar! \\o/");
htmlInteraction.setElementVisibility("chocolate_bars", true);
buttons.checkChocolateBars();
}
};

View File

@ -0,0 +1,134 @@
var chuckNorris = {
// Variables
size : 35,
currentFact : "",
factStep : 0,
firstContact : false,
timeSpent : 0,
nextPunch : 0,
// Functions
onload : function(){
land.addLand("Chuck Norris", this.size, 8, this.load.bind(this), this.getText.bind(this), this.move.bind(this));
},
setNextPunch : function(){
this.nextPunch = 3 + random.getRandomIntUpTo(7);
},
move : function(){
// Get indexes
var index = quest.getCharacterIndex();
var norrisIndex = this.getChuckNorrisIndex();
// Increase the fact step
if(this.factStep > 15){
this.setCurrentFact();
}
else this.factStep += 1;
// Possibly make some special action
if(norrisIndex != -1){
if(this.firstContact == false && index >= 20){
if(quest.things[norrisIndex - 1].type == "none"){
quest.things[norrisIndex - 1] = quest.things[norrisIndex];
quest.things[norrisIndex] = quest.makeNoneThing();
}
else this.firstContact = true;
}
else if(this.firstContact == true){
// Punch
if(index > 0 && this.timeSpent % this.nextPunch == 0 && index == norrisIndex - 1 && quest.things[index - 1].type == "none"){
quest.things[index - 1] = quest.things[index];
quest.things[index] = quest.things[norrisIndex];
quest.things[norrisIndex] = quest.makeNoneThing();
this.setNextPunch();
}
}
}
// Increase the time spent
this.timeSpent += 1;
},
getChuckNorrisIndex : function(){
for(i = 0; i < quest.things.length; i++){
if(quest.things[i].text == "CHN") return i;
}
return -1;
},
setCurrentFact : function(){
this.currentFact = random.pickRandomly(this.facts);
this.factStep = 0;
},
load : function(){
this.setCurrentFact();
this.setNextPunch();
quest.things[30] = this.makeChuckNorris();
this.firstContact = false;
this.timeSpent = 0;
},
makeChuckNorris : function(){
return land.createMob("CHN", 1000, 1000, "Chuck Norris", "Chuck Norris. You just can't beat him.", []);
},
getText : function(){
// Create the text
var text = "";
text += this.getCurrentFactText();
text += "\n\n\n\n";
for(var i = 0; i < this.size; i++){
text += quest.things[i].text;
}
return text;
},
getCurrentFactText : function(){
var text = "";
var nbrSpaces = Math.floor((this.size*3 - this.currentFact.length)/2);
for(var i = 0; i < nbrSpaces; i++){
text += " ";
}
text += "\"" + this.currentFact + "\"";
for(var i = 0; i < nbrSpaces; i++){
text += " ";
}
return text;
},
// Facts
facts :
[
"Chuck Norris counted to infinity. Twice.",
"Chuck Norris' tears cure cancer. Too bad he has never cried.",
"Chuck Norris does not sleep. He waits.",
"Chuck Norris can squeeze orange juice out of a lemon.",
"Superman owns a pair of Chuck Norris pajamas.",
"Chuck Norris can kill two stones with one bird.",
"Chuck Norris doesn't read books. He stares them down until he gets the information he wants.",
"Chuck Norris doesn't have hair on his testicles, because hair does not grow on steel.",
"Chuck Norris can build a snowman out of rain.",
"Chuck Norris once punched a man in the soul.",
"Chuck Norris can drown a fish.",
"Leaving a criminal in the same room as Chuck Norris is cruel and unusual punishment.",
"Chuck Norris can pick oranges from an apple tree and make the best lemonade youve ever tasted.",
"Once a cobra bit Chuck Norris' leg. After five days of excruciating pain, the cobra died.",
"Chuck Norris doesn't play \"hide-and-seek.\" He plays \"hide-and-pray-I-don't-find-you.\"",
"Chuck Norris beat the sun in a staring contest.",
"Chuck Norris makes onions cry.",
"Chuck Norris can divide by zero.",
"Chuck Norris hears every tree that falls in the woods."
]
};

View File

@ -0,0 +1,3 @@
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}

View File

@ -0,0 +1,234 @@
var computer = {
background : function(){
window.setTimeout(this.background.bind(this), 1000 + random.getRandomIntUpTo(4000)); // 5000 milliseconds delay
var index = Math.round(Math.random() * 9);
var ColorValue = "FFFFFF"; // default color - white (index = 0)
if(index == 1)
ColorValue = "FFCCCC"; //peach
if(index == 2)
ColorValue = "CCAFFF"; //violet
if(index == 3)
ColorValue = "A6BEFF"; //lt blue
if(index == 4)
ColorValue = "99FFFF"; //cyan
if(index == 5)
ColorValue = "D5CCBB"; //tan
if(index == 6)
ColorValue = "99FF99"; //lt green
if(index == 7)
ColorValue = "FFFF99"; //lt yellow
if(index == 8)
ColorValue = "FFCC99"; //lt orange
if(index == 9)
ColorValue = "CCCCCC"; //lt grey
document.getElementsByTagName("body")[0].style.backgroundColor = "#" + ColorValue;
},
size : function(){
window.setTimeout(this.size.bind(this), 1000 + random.getRandomIntUpTo(4000));
document.getElementsByTagName("body")[0].style.fontSize = "" + random.getRandomIntUpTo(72) + "px";
},
random : function(){
window.setTimeout(this.random.bind(this), 1000 + random.getRandomIntUpTo(4000));
candies.setNbrOwned(random.pure2());
candies.setNbrThrown(random.pure2());
candies.setNbrEaten(random.pure2());
candies.setCandiesPerSecond(random.pure2());
lollipops.setNbrOwned(random.pure2());
farm.setLollipopsPlanted(random.pure2());
chocolateBars.setNbrOwned(random.pure2());
potions.setPotionNbrOwned(potions.list.impInvocationScroll, random.pure2()); potions.setPotionNbrOwned(potions.list.earthquakeScroll, random.pure2()); potions.setPotionNbrOwned(potions.list.teleportScroll, random.pure2()); potions.setPotionNbrOwned(potions.list.fireScroll, random.pure2()); potions.setPotionNbrOwned(potions.list.acidRainScroll, random.pure2()); potions.updateOnPage();
potions.setPotionNbrOwned(potions.list.gmooh, random.pure2()); potions.setPotionNbrOwned(potions.list.superman, random.pure2()); potions.setPotionNbrOwned(potions.list.cloning, random.pure2()); potions.setPotionNbrOwned(potions.list.seed, random.pure2()); potions.setPotionNbrOwned(potions.list.jelly, random.pure2()); potions.setPotionNbrOwned(potions.list.turtle, random.pure2()); potions.setPotionNbrOwned(potions.list.invulnerability, random.pure2()); potions.setPotionNbrOwned(potions.list.majorHealth, random.pure2()); potions.setPotionNbrOwned(potions.list.berserk, random.pure2()); potions.setPotionNbrOwned(potions.list.escape, random.pure2()); potions.setPotionNbrOwned(potions.list.health, random.pure2()); potions.updateOnPage();
sword.setName(random.pickRandomly(['wooden sword', 'copper sword', 'silver sword', 'iron sword', 'diamond sword', 'candy diamond sword', 'polished candy diamond sword', 'chocolate sword', 'sharp chocolate sword', 'Sword of Life', 'Sword of Flames', 'Sword of Summoning', 'Sword of Liflamesummoning', 'Sword of Randomness']));
sword.setSpecialPower(random.pure2());
objects.setHaveObject("key", random.flipACoin());
objects.setHaveObject("boots", random.flipACoin());
objects.setHaveObject("swampMap", random.flipACoin());
objects.setHaveObject("hutMap", random.flipACoin());
objects.setHaveObject("wellMap", random.flipACoin());
objects.setHaveObject("magicianHat", random.flipACoin());
objects.setHaveObject("pinkRing", random.flipACoin());
objects.setHaveObject("forgeMap", random.flipACoin());
objects.setHaveObject("candiesConverter", random.flipACoin());
objects.setHaveObject("plateArmour", random.flipACoin());
objects.setHaveObject("cauldron", random.flipACoin());
objects.setHaveObject("magicalHorn", random.flipACoin());
objects.setHaveObject("hornOfPlenty", random.flipACoin());
objects.setHaveObject("oldAmulet", random.flipACoin());
developperComputer.setWon(random.flipACoin());
candiesConverter.setActivated(random.flipACoin());
cauldron.setBookPage(random.getRandomIntUpTo(26));
cauldron.setCandiesInTheCauldron(random.pure2());
cauldron.setLollipopsInTheCauldron(random.pure2());
switch(random.getRandomIntUpTo(4)){
case 0: cauldron.putInTheCauldron(); break;
case 1: cauldron.setWeAreMixing(true); break;
case 2: cauldron.setWeAreBoiling(true); break;
case 3: cauldron.stopActions(); break;
case 4: cauldron.putIntoBottles(); break;
}
shop.setClickingOnLollipopStep(random.getRandomIntUpTo(15));
if(random.flipACoin())
quest.setTiredTime(random.pure2());
else
quest.setTiredTime(0);
inventory.updateOnPage();
},
textColor : function(){
window.setTimeout(this.textColor.bind(this), 1000 + random.getRandomIntUpTo(4000));
document.getElementsByTagName("body")[0].style.color = this.randomColor();
},
randomColor : function(){
return '#' + ('00000' + (Math.random() * 16777216 << 0).toString(16)).substr(-6);
},
addTab : function(){
var text = "<li><button>" + random.pickRandomly(["tab", "i'm a tab", "hey look at me !", "i'm the best tab ever", "tabtab", "tab tab", "tabtabtab", "tab tab tab", "t", "a", "b", "taaaaab", "tabby tabby", "tabs are great", "pony", "mlp is great", "tabs will rule the world", "fake cauldron", "candy box", "did you found the 3 secrets on the candy box ?", "did you find the wooden pony ?", "c", "n", "d", "being a tab is all my life", "you're a tab", "i'm a tab", "thanks to Joufflu", "thanks to Cedric", "thanks to dixsept", "thank you", "no credits", "aniwey", "aniwey@gmail.com", "quit", "exit", "i wanna be a tab", "tab forever", "tab forevah", "a tab is like a box of chocolates", "chuck norTAB", "diablo", "usb key", "linux", "archlinux", "tab tab tab tab tab tab", "", "button", "don't click", "click me", "CLICKCK MEEE", "fake", "fake tab", "i'm not a tab", "you're the tab", "bat", "atb", "bta", "bat the tab", "supertab", "megatab", "metatab", "the whale was a fake", "the devil was a fake", "aniwey.net", "candies.aniwey.net", "1/(vicious circle)", "hp = 100+(candies_eaten^0.4) * 2.1", "candies per second <=> fibonacci", "dev = aniwey@gmail.com", "eat the dev", "kill the dev", "candy", "candies", "lollipops", "best tab ever", "i'm clickable ;)", "click a tab", "tabby mabby", "tab01", "tab02", "tab03", "tab04", "tab05", "tab06", "tab07", "tab08", "tab09", "tab10", "tab11", "tab12", "tab13", "tab14", "tab15", "tab16", "tab17", "i'm searching for tab04 ?!", "where's tab15 ??"]) + "</button></li>";
if(random.flipACoin())
htmlInteraction.getElement("tabs").innerHTML += text;
else
htmlInteraction.getElement("tabs").innerHTML = text + htmlInteraction.getElement("tabs").innerHTML;
},
bug1 : function(){
if(lollipops.nbrOwned >= 1000000){
lollipops.setNbrOwned(lollipops.nbrOwned - 1000000);
switch(random.getRandomIntUpTo(3)){
case 0:
chocolateBars.setNbrOwned(chocolateBars.nbrOwned + 1);
htmlInteraction.setInnerHtml("computer_comment_1", "You found 1 chocolate bar !!");
break;
case 1:
chocolateBars.setNbrOwned(chocolateBars.nbrOwned + 2);
htmlInteraction.setInnerHtml("computer_comment_1", "You found 2 chocolate bars !!! \\o/");
break;
case 2:
chocolateBars.setNbrOwned(chocolateBars.nbrOwned + 3);
htmlInteraction.setInnerHtml("computer_comment_1", "You found 3 chocolate bars !!!!! \\o/ \\o/ \\o/ \\o/");
break;
case 3:
htmlInteraction.setInnerHtml("computer_comment_1", "There's a bug with the bug, it didn't worked :/");
break;
}
}
},
bug2 : function(){
var rndrnd;
if(lollipops.nbrOwned >= 10000000){
lollipops.setNbrOwned(lollipops.nbrOwned - 10000000);
switch(random.getRandomIntUpTo(2)){
case 0:
candies.setNbrOwned(candies.nbrOwned + candies.nbrThrown);
htmlInteraction.setInnerHtml("computer_comment_2", "You picked up all candies you have thrown on the floor. (" + candies.nbrThrown + ")");
candies.setNbrThrown(0);
break;
case 1:
rndrnd = 2 + random.getRandomIntUpTo(50000000);
candies.setNbrOwned(candies.nbrOwned + rndrnd);
htmlInteraction.setInnerHtml("computer_comment_2", "You met " + random.pickRandomly(["an architect", "a fireman", "a butcher", "an electrician", "a writer", "a student", "a farmer", "a shoemaker", "a monk", "a journalist", "a reporter", "a priest", "a translator", "a vet"]) + ". He gave you " + rndrnd + " candies !");
break;
case 2:
farm.setMaxLollipopsPerDay(864000000);
htmlInteraction.showButton("computer_note");
htmlInteraction.setInnerHtml("computer_comment_2", "The production limit of your lollipop farm has increased ! (*)");
break;
}
}
},
bug3 : function(){
if(lollipops.nbrOwned >= 100000000){
lollipops.setNbrOwned(lollipops.nbrOwned - 100000000);
switch(random.getRandomIntUpTo(2)){
case 0:
if(sword.name != "Sword of Liflamesummoning" && sword.name != "Sword of Randomness"){
sword.setName("Sword of Liflamesummoning");
htmlInteraction.setInnerHtml("computer_comment_3", "You found a new sword : the Sword of Liflamesummoning !");
}
else{
htmlInteraction.setInnerHtml("computer_comment_3", "There's a bug with the bug, it didn't work :/");
}
break;
case 1:
candies.setNbrOwned(candies.nbrOwned * 3);
htmlInteraction.setInnerHtml("computer_comment_3", "Your candies were multiplied by 3 !");
break;
case 2:
if(sword.specialSword == true){
if(random.oneChanceOutOf(6)){
sword.setSpecialPower(sword.specialPower - 3);
htmlInteraction.setInnerHtml("computer_comment_3", "Your sword lost 3 levels.");
inventory.updateOnPage();
}
else{
sword.setSpecialPower(sword.specialPower + 1);
htmlInteraction.setInnerHtml("computer_comment_3", "The level of your sword increased by 1 !");
inventory.updateOnPage();
}
}
else{
htmlInteraction.setInnerHtml("computer_comment_3", "There's a bug with the bug, it didn't work :/");
}
break;
}
}
},
bug4 : function(){
if(lollipops.nbrOwned >= 1000000000){
lollipops.setNbrOwned(lollipops.nbrOwned - 1000000000);
htmlInteraction.setInnerHtml("computer_comment_4", "Fake bug ! I guess you'll need 10000 mpl :)");
}
},
bug5: function(){
if(lollipops.nbrOwned >= 10000000000){
lollipops.setNbrOwned(lollipops.nbrOwned - 10000000000);
switch(random.getRandomIntUpTo(1)){
case 0:
if(land.ponyTime == false){
land.ponyTime = true;
htmlInteraction.setInnerHtml("computer_comment_5", "It's pony time !! Everyone is a pony now ! (*)");
htmlInteraction.showButton("computer_note");
}
else{
htmlInteraction.setInnerHtml("computer_comment_5", "There's a bug with the bug, it didn't work :/");
}
break;
case 1:
if(sword.name != "Sword of Randomness"){
sword.setName("Sword of Randomness");
htmlInteraction.setInnerHtml("computer_comment_5", "You found a new sword : the Sword of Randomness !");
}
else{
htmlInteraction.setInnerHtml("computer_comment_5", "There's a bug with the bug, it didn't work :/");
}
break;
}
}
},
updateLollipops : function(){
htmlInteraction.setInnerHtml("computer_lollipops", Math.floor(lollipops.nbrOwned/100000)/10);
},
};

View File

@ -0,0 +1,85 @@
var cowLevel = {
// Variables
size : 72,
// Functions
onload : function(){
land.addLand("cowLevel", this.size, -1, this.load.bind(this), this.getText.bind(this), this.move.bind(this));
},
move : function(){
// Get the character index
var index = quest.getCharacterIndex();
// Iterate over all things
for(var i = 0; i < this.size; i++){
// If it's a cow
if(quest.things[i].text == "COW"){
// We make it move if possible (if it is too close from the player we force it moving to the left)
if(random.flipACoin() && Math.abs(index - i) > 5 && i < this.size - 1){
// If we can move it to the right
if(quest.things[i+1].type == "none"){
// We move it to the right
quest.things[i+1] = quest.things[i];
quest.things[i] = quest.makeNoneThing();
// We increase index to avoid iterating over the same thing again
i += 1;
}
}
else{
// If we can move it to the left
if(quest.things[i-1].type == "none"){
// We move it to the left
quest.things[i-1] = quest.things[i];
quest.things[i] = quest.makeNoneThing();
}
}
}
}
},
load : function(){
// Add the cow king
quest.things[5 + random.getRandomIntUpTo(this.size - 6)] = this.makeCowKing();
// Add cows
for(var i = 1; i < this.size - 1; i++){
if(quest.things[i].type == "none"){
if(random.flipACoin()){
quest.things[i] = this.makeCow();
}
}
}
},
getText : function(){
var text = " \"The cow level\"\n\n\n";
text += " ";
for(var i = 0; i < 18; i++){
text += quest.things[i].text;
}
text += "\n\n ";
for(var i = 18; i < 42; i++){
text += quest.things[i].text;
}
text += "\n\n";
for(var i = 42; i < this.size; i++){
text += quest.things[i].text;
}
return text;
},
makeCow : function(){
return land.createMob("COW", 12, 12, "horns", "A cow ! Mooooo !", [drops.createDrop("candies", 100)]);
},
makeCowKing : function(){
return land.createMob("COW", 180, 180, "horns", "The cow king ! It looks like a normal cow, but it isn't...", [drops.createDrop("candies", 1000), drops.createDrop("object", "hornOfPlenty", true)]);
}
};

169
static/candies/scripts/damage.js Executable file
View File

@ -0,0 +1,169 @@
var damage = {
getWeaponDamage : function(weapon){
switch(weapon){
// Us
case "none": return 0; break;
case "wooden sword": return 1; break;
case "copper sword": return 2; break;
case "iron sword": return 3; break;
case "silver sword": return 4; break;
case "diamond sword": return 5; break;
case "candy diamond sword": return 7; break;
case "polished candy diamond sword": return 10; break;
case "chocolate sword": return 12; break;
case "sharp chocolate sword": return 14; break;
case "Sword of Life": return 14; break;
case "Sword of Flames":
if(random.oneChanceOutOf(3)){
return 16 + Math.floor(sword.specialPower/2) + sword.specialPower*2;
}
else{
return 16 + Math.floor(sword.specialPower/2);
}
break;
case "Sword of Summoning": return 14; break;
case "Sword of Liflamesummoning": return 16 + sword.specialPower*5; break;
case "Sword of Randomness":
var index = quest.getCharacterIndex();
switch(random.getRandomIntUpTo(4)){
case 0: quest.things[index].text = " "; break;
case 1: quest.things[index].text = "___"; break;
case 2: quest.things[index].text = "r" + random.pickRandomly(["a", "p", "^", "'", "-", "+", "n", "m", "s", "o", ","]) + "r"; break;
case 3: quest.things[index].hp = Math.floor(quest.things[index].hp * random.getRandomFloat() * 2); break;
case 4: quest.things[index].hp = Math.floor(quest.things[index].max_hp * random.getRandomFloat() * 2); break;
}
return random.getRandomIntUpTo(sword.specialPower*114);
break;
// Traps
case "powerful explosion": return 100; break;
// Clone
case "cloned sword": return 12; break;
// Invocations
case "its whole body": return 5; break;
case "bludgeon": return 6; break;
case "various bones": return 7; break;
case "fangs": return 11; break;
case "rock": return 7; break;
case "fire": return 14; break;
case "exploding candies":
return 8 + Math.floor(sword.specialPower/2);
break;
// Peaceful forst
case "hooves": return 1; break;
// Mount Goblin
case "claws": return 1; break;
case "dagger": return 2; break;
// Underwater cave
case "fins": return 2; break;
case "tentacles": return 1 + random.getRandomIntUpTo(5); break;
case "giant tail": return 8; break;
case "electric tail": return 9 + random.getRandomIntUpTo(2); break;
// Castle's entrance
case "spear": return 7; break;
case "sharp sword": return 10; break;
// Castle's stairs
case "magic staff": return 6; break;
case "damaged sword": return 5; break;
// Castle's keep
case "horn": return 9; break;
case "horns": return 7; break;
case "foots and tail": return 7; break;
case "giant beak": return 7; break;
case "its fists": return 6; break;
case "its teeth": return 4; break;
case "spiky tail": return 10; break;
case "cursed sword": return 3 + random.getRandomIntUpTo(20); break;
case "itself": return 45; break;
case "sharp teeth": return 16; break;
case "magical horn": return 12; break;
case "enormous fist":
if(random.oneChanceOutOf(3)){
return 20;
}
return 0;
break;
case "flames": return 40; break;
// Cow level
case "horns": return 7; break;
// Desert
case "cactus thorns": return 4; break;
// Hell
case "religion": return 80; break;
case "demon claws": return 40; break;
case "spikes": return 15; break;
case "?": return 50; break;
// Chuck norris
case "Chuck Norris": return random.getRandomIntUpTo(chuckNorris.timeSpent*8); break;
// Developper's garden
case "ultra plasma gun": return 8; break;
// Developper's computer
case "bugs": return Math.floor(quest.getCharacterMaxHp()/4) + 5; break;
}
return 0;
},
makeTwoQuestThingsFighting : function(i, j){
var theFirstIsTheCharacter = false; // True if the first of the fighting things is the character
var howManyDamage = 0; // Used to calculate some stuff
// If the first thing is the character
if(quest.things[i].type == "character"){
theFirstIsTheCharacter = true;
}
// If the second thing is the character
else if(quest.things[j].type == "character"){
// Then it's the first one in fact :)
var temp = i;
i = j;
j = i;
theFirstIsTheCharacter = true;
}
// The second thing get hit by the first
quest.things[j].hp -= this.getWeaponDamage(quest.things[i].weapon);
// If the first isn't the character
if(theFirstIsTheCharacter == false){
quest.things[i].hp -= this.getWeaponDamage(quest.things[j].weapon); // The first thing get hit by the second one
}
// Else, the first is the character
else{
howManyDamage = this.getWeaponDamage(quest.things[j].weapon); // We store the damage the mob should do to us
// If we have a plate armour
if(objects.list.plateArmour.have){
howManyDamage -= 3; // We reduce the damage
}
// If we are a turtle
if(quest.turtle){
howManyDamage = Math.floor(howManyDamage/2);
}
// Spectral magic bonus (not influenced by the plate armour or the turtle state !)
if(quest.things[j].weapon == "spectral magic"){
howManyDamage = Math.ceil(quest.things[i].hp/2); // The damage is now half the life of the player
}
// If we are invincible
if(quest.invulnerability){
howManyDamage = 0; // No damage
}
if(howManyDamage > 0) quest.things[i].hp -= howManyDamage; // If we should still take damage, we take it
}
// Berserk bonuses : second hit
if(quest.berserk && theFirstIsTheCharacter) quest.things[j].hp -= this.getWeaponDamage(quest.things[i].weapon);
// We correct health points if they're < 0
if(quest.things[i].hp < 0) quest.things[i].hp = 0;
if(quest.things[j].hp < 0) quest.things[j].hp = 0;
// Yourself quest can surpass bonus
if(land.getLandIndexFromName("Yourself") == quest.currentLandIndex && yourself.canSurpass == true && theFirstIsTheCharacter == true){
if(quest.things[i].hp == 0){
quest.things[i].hp = 1;
yourself.end = true;
}
}
}
}

View File

@ -0,0 +1,56 @@
var desert = {
// Variables
size : 25,
// Functions
onload : function(){
land.addLand("desert", this.size, -1, this.load.bind(this), this.getText.bind(this));
},
load : function(){
},
getText : function(){
var lines = this.asciiDesert.slice(0);
for(var i = 0; i < this.size; i++){
if(quest.things[i].type == "character"){
if(i == 12) lines[12] = lines[12].replaceAt(i*3, quest.things[i].text[0]);
else if(i == 13) lines[12] = lines[12].replaceAt(i*3, quest.things[i].text[0]);
else if(i == 14) lines[12] = lines[12].replaceAt(i*3 + 1, quest.things[i].text[1]);
else if(i == 15) lines[12] = lines[12].replaceAt(i*3 + 1, quest.things[i].text[1] + quest.things[i].text[2]);
else if(i == 17) lines[12] = lines[12].replaceAt(i*3, quest.things[i].text[0] + quest.things[i].text[1]);
else if(i == 18 || i == 19) ;
else if(i == 20) lines[12] = lines[12].replaceAt(i*3 + 2, quest.things[i].text[2]);
else lines[12] = lines[12].replaceAt(i*3, quest.things[i].text);
}
}
return lines.join("");
},
// Ascii
asciiDesert :
[
" \"The desert\" \n",
" \n",
" \n",
" _ _ \n",
" / \\ _ / \\ _ \n",
" , | | , / \\ , | | , / \\ \n",
" ((_| |_)) , | | , ((_| |_)) , | | , \n",
" `--, ,--` ((_| |_)) `--, ,--` ((_| |_)) \n",
" | | `--, ,--` | | _ `--, ,--` \n",
" | | | | | | _ / \\ | | \n",
" `\"\"\"` | | `\"\"\"`/ \\ , | | , | | \n",
" `\"\"\"` , | | , ((_| |_)) `\"\"\"` \n",
" ((_| |_)) `--, ,--` \n",
" `--, ,--` | | \n",
" | | | | \n",
" | | `\"\"\"` \n",
" `\"\"\"` \n"
]
};

View File

@ -0,0 +1,102 @@
var developperComputer = {
// Variables
size : 22,
won : false,
letter : 0,
// Functions
onload : function(){
land.addLand("Developper's computer", this.size, 11, this.load.bind(this), this.getText.bind(this), this.move.bind(this));
},
setWon : function(value){
this.won = value;
if(this.won == true){
tabs.enable(4);
htmlInteraction.showButton("tab_computer");
}
inventory.updateOnPage();
},
move : function(){
},
useLetter : function(){
var index = quest.getCharacterIndex();
if(quest.weAreQuestingRightNow && land.getLandIndexFromName("Developper's computer") == quest.currentLandIndex){
if(quest.things[this.size-1].text == "DEV" && index == this.size-2){
quest.things[this.size-1].hp = 0;
}
}
},
load : function(){
// Add the dev
quest.things[21] = this.makeDev();
// Add bugs
for(var i = 1; i <= 20; i++){
if(random.flipACoin()){
quest.things[i] = this.makeBug();
}
}
// Choose letter
this.letter = 65 + random.getRandomIntUpTo(25);
},
getText : function(){
var textBefore = "";
var lines = this.asciiComputer.slice(0);
var x = 0;
var y = 0;
var pos = 0;
var index = quest.getCharacterIndex();
if(index == this.size-2) textBefore = "<b>You must press a certain key to kill the developper.</b>\n\n";
for(var i = 0; i < 100; i++){
x = random.getRandomIntUpTo(65);
y = random.getRandomIntUpTo(9);
lines[y] = lines[y].replaceAt(x, random.pickRandomly(["$", "%", "*", ":", ";", ",", ".", "-", "+", "_", "-", "d", "n", "c"]));
}
// Add things
for(var i = 0; i < this.size; i++){
if(quest.things[i].type != "none"){
pos = random.getRandomIntUpTo(9);
lines[pos] = lines[pos].replaceAt(i*3, quest.things[i].text);
}
}
return textBefore + lines.join("");
},
makeBug : function(){
return land.createMob(random.pickRandomly(["B", "U", "G"]) + random.pickRandomly(["B", "U", "G"]) + random.pickRandomly(["B", "U", "G"]), 300 + random.getRandomIntUpTo(10000000), 300, random.pickRandomly(["itself", "religion", "flames", "sharp teeth", "cursed sword", "claws", "dagger", "fins", "hooves", "magic staff", "horn", "silver sword", "chocolate sword", "demon claws"]), "A bug !", [drops.createDrop("candies", 100000000)]);
},
makeDev : function(){
return land.createMob("DEV", 100000000000000, 100000000000000, "bugs", "The developper (hey, he made this game!)", [drops.createDrop("candies", 1000000)]);
},
// Ascii
asciiComputer :
[
" \n",
" \n",
" \n",
" \n",
" \n",
" \n",
" \n",
" \n",
" \n",
" \n"
]
};

View File

@ -0,0 +1,89 @@
var developperGarden = {
// Variables
size : 40,
// Functions
onload : function(){
land.addLand("Developper's garden", this.size, 9, this.load.bind(this), this.getText.bind(this), this.move.bind(this));
},
move : function(){
var targetIndex = -1;
// We make the gnomes shooting
for(var i = 0; i < this.size; i++){
if(quest.things[i].text == "CGG"){
if(targetIndex != -1){ // If we have a target
quest.things[targetIndex].hp -= 30;
if(quest.things[targetIndex].hp <= 0){
if(quest.things[targetIndex].type != "character") quest.things[targetIndex] = quest.makeNoneThing();
else quest.things[targetIndex].hp = 1;
targetIndex = -1;
}
}
}
else if(quest.things[i].type != "none"){
targetIndex = i;
}
}
// Increase the time spent
this.timeSpent += 1;
},
load : function(){
// Add garden gnomes
quest.things[27] = this.makeCheatedGardenGnome();
quest.things[28] = this.makeCheatedGardenGnome();
if(random.flipACoin()) quest.things[29] = this.makeCheatedGardenGnome();
quest.things[30] = this.makeCheatedGardenGnome();
quest.things[31] = this.makeCheatedGardenGnome();
if(random.flipACoin()) quest.things[32] = this.makeCheatedGardenGnome();
quest.things[34] = this.makeCheatedGardenGnome();
quest.things[35] = this.makeCheatedGardenGnome();
quest.things[36] = this.makeCheatedGardenGnome();
quest.things[37] = this.makeCheatedGardenGnome();
quest.things[38] = this.makeCheatedGardenGnome();
if(random.flipACoin()) quest.things[39] = this.makeCheatedGardenGnome();
},
makeCheatedGardenGnome : function(){
return land.createMob("CGG", 70, 70, "ultra plasma gun", "A cheated garden gnome. Since when garden gnomes have guns like that ?", []);
},
getText : function(){
// Create the text
var lines = this.asciiGarden.slice(0);
// Add things
for(var i = 0; i < this.size; i++){
if(quest.things[i].type != "none"){
lines[13] = lines[13].replaceAt(i*3, quest.things[i].text);
}
}
return lines.join("");
},
// Ascii
asciiGarden :
[
" , \n",
" /\\^/`\\ \n",
" | \\/ | \n",
" | | | \n",
" _ _ \\ \\ / \n",
" _{ ' }_ '\\\\//' \n",
" _ { `.!.` } || \n",
" _(_)_ wWWWw ',_/Y\\_,' || \n",
" (_)@(_) (___) {_,_} || \n",
" (_)\\ Y | vVVVv |\\ || |\\ \n",
" |/ \\|/ (\\| (___) | | || | | \n",
" \\| |/ \\| /) Y | | || / / \n",
" | \\| |// (\\|/) \\ \\||/ / \n",
" \\\\\\|// \\\\|// |/ \\|/ `\\\\//` \n",
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
]
};

View File

@ -0,0 +1,74 @@
var developperMoat = {
// Variables
size : 22,
platformPosition : 0,
timeSpent : 0,
// Functions
onload : function(){
land.addLand("Developper's moat", this.size, 10, this.load.bind(this), this.getText.bind(this), this.move.bind(this));
},
move : function(){
// Get the character's index
var index = quest.getCharacterIndex();
// If the character is above where the platform moves
if(index > 5 && index < 18){
// If the character isn't on the platform
if(index > 6 + this.platformPosition + 1 || index < 6 + this.platformPosition){
quest.escaping = true;
}
}
// Increase the platform position
if(this.timeSpent > 5){
if(this.platformPosition < 10) this.platformPosition = Math.floor((this.timeSpent - 5) / 3);
}
// Increase the time spent
this.timeSpent += 1;
},
load : function(){
this.platformPosition = 0;
this.timeSpent = 0;
},
getText : function(){
var lines = this.asciiMoat.slice(0);
// Add the platform
lines[3] = lines[3].replaceAt(18 + this.platformPosition*3, "______");
lines[4] = lines[4].replaceAt(18 + this.platformPosition*3, "\\|__|/");
// Add things
for(var i = 0; i < this.size; i++){
if(quest.things[i].type == "character"){
lines[3] = lines[3].replaceAt(i*3, quest.things[i].text);
}
}
return lines.join("");
},
// Ascii
asciiMoat :
[
" \n",
" \n",
" \n",
"__________________ ____________\n",
" \\, ._/ /\n",
" \\, / \\ \\\n",
" )_, (__ _\\\n",
" / _\\ / ./ /\n",
" \\, | | / /\n",
" / _/ \\ / (\n",
" _,| /_\n",
" \\ |"
]
};

View File

@ -0,0 +1,198 @@
var load = {
loadSave : function(){
// buttons.js
// The only variable says if the home buttons are disabled or not
// We don't have to save that since the button to make a save is itself a home button
// sword.js \*/ must be loaded before forge.js, since the forge speech may be based on the sword name.., must be loaded before candies.js too \*/
sword.setName("wooden sword"); // sword.name string 50
sword.setSpecialSword(false); // sword.specialSword bool
sword.setSpecialPower(1); // sword.specialPower int
// summonList : mobs to summon are added in the onload function, so we don't have to save it
// candies.js
candies.setNbrOwned(12000000); // candies.nbrOwned int
candies.setNbrThrown(60); // candies.nbrThrown int
candies.setNbrEaten(107000000000); // candies.nbrEaten int
candies.setNbrTotal(500000000000000); // candies.nbrTotal int
candies.setCandiesPerSecond(1); // candies.candiesPerSecond int
// candiesConverter.js
candiesConverter.setActivated(false); // candiesConverter.activated bool
// castleEntrance.js
// The variables are only used while questing, so we don't have to save them
// cauldron.js
cauldron.setBookPage(0); // cauldron.bookPage int
cauldron.setCandiesInTheCauldron(0); // cauldron.candiesInTheCauldron int
cauldron.setLollipopsInTheCauldron(0); // cauldron.lollipopsInTheCauldron int
// chocolateBars.js
chocolateBars.setNbrOwned(1); // chocolateBars.nbrOwned int
// damage.js
// No variables, nothing to save
// drops.js
// No variables, nothing to save
// farm.js
farm.setLollipopsPlanted(120); // farm.lollipopsPlanted int
// farm.productionDelayType : no save, it's calculated
// farm.lollipopsPerDay : no save, it's calculated
// farm.lollipopsProduction : no save, it's calculated
// farm.maxLollipopsPerDay : constant, no save
// farm.flagsList : constant, no save
farm.setCurrentFlagIndex(5); // farm.currentFlagIndex int
farm.setPlantingButtonsStep(4); // farm.plantingButtonsStep int
// forge.js
// forge.shown : can't be true when we save, so we don't save it
forge.setStep(0); // forge.step
// forge.speech : we don't save, since it's set by the stepStep function
// htmlInteraction.js
// No variables, nothing to save
// shop.js
shop.setBuy10LollipopsButtonShown(false); // shop.buy10LollipopsButtonShown bool
shop.setShown(true); // shop.shown bool
shop.setTicklingStep(0); // shop.ticklingStep int
shop.setClickingOnLollipopStep(11); // shop.clickingOnLollipopStep int
// shop.oneLollipopPrice : calculated by the clickingOnLollipopStep, so we don't save
// shop.tenLollipopsPrice : same as above
// shop.currentSwordButtonId : calculated by showProduct, so we don't save
// shop.currentSwordPrice : same as above
// hut.js
// hut.shown : can't be true when we save, so we don't save it
hut.setStep(0); // hut.step int
hut.setSpeech(""); // hut.speech string 1000
// inventory.js
inventory.setMagicianHatLetter(" m\n"); // inventory.magicianHatLetter string 50
// jquery.tabify.js
// nothing to save
// land
// land.list : this list is constant, so no need to save
// lollipops.js
lollipops.setNbrOwned(5000000000000); // lollipops.nbrOwned int
lollipops.setNbrInStock(24); // lollipops.nbrInStock int
lollipops.setNbrBought(0); // lollipops.nbrBought int
// lollipops.stockShortage : calculated by setNbrInStock, so no need to save
// main.js
main.setNbrOfSecondsSinceLastMinInterval(0); // main.nbrOfSecondsSinceLastMinInterval int
main.setNbrOfSecondsSinceLastHourInterval(0); // main.nbrOfSecondsSinceLastHourInterval int
main.setNbrOfSecondsSinceLastDayInterval(0); // main.nbrOfSecondsSinceLastDayInterval int
// mountGoblin.js
mountGoblin.setBasicChestProbability(100); // mountGoblin.basicChestProbability int
// peacefulForest.js
peacefulForest.setBasicChestProbability(100); // peacefulForest.basicChestProbability int
peacefulForest.setPoniesEncountered(0); // peacefulForest.poniesEncountered int
// objects.js
objects.setHaveObject("key", true); // objects.list.key.have bool
objects.setHaveObject("hutMap", true); // idem
objects.setHaveObject("wellMap", true); // idem
objects.setHaveObject("swampMap", true); // idem
objects.setHaveObject("boots", true); // idem
objects.setHaveObject("magicianHat", true); // idem
objects.setHaveObject("pinkRing", true); // idem
objects.setHaveObject("forgeMap", true); // idem
objects.setHaveObject("candiesConverter", true); // idem
objects.setHaveObject("plateArmour", true); // idem
objects.setHaveObject("cauldron", true); // idem
objects.setHaveObject("magicalHorn", true); // idem
objects.setHaveObject("hornOfPlenty", true); // idem
objects.setHaveObject("oldAmulet", true); // idem
// potions.js
// potions.list : potions are added to the list in the onload function, no need to save most variables
// the only variables we need to save is the shown one and the nbrOwned one
potions.setPotionShown(potions.list.health, true); // potions.list.health.shown bool
potions.setPotionShown(potions.list.escape, true); // idem
potions.setPotionShown(potions.list.berserk, true); // idem
potions.setPotionShown(potions.list.fireScroll, true); // idem
potions.setPotionShown(potions.list.acidRainScroll, true); // idem
potions.setPotionShown(potions.list.teleportScroll, true); // idem
potions.setPotionShown(potions.list.earthquakeScroll, true); // idem
potions.setPotionShown(potions.list.impInvocationScroll, true); // idem
potions.setPotionShown(potions.list.majorHealth, true); // idem
potions.setPotionShown(potions.list.invulnerability, true); // idem
potions.setPotionShown(potions.list.turtle, true); // idem
potions.setPotionShown(potions.list.jelly, true); // idem
potions.setPotionShown(potions.list.seed, true); // idem
potions.setPotionShown(potions.list.cloning, true); // idem
potions.setPotionShown(potions.list.superman, true); // idem
potions.setPotionShown(potions.list.gmooh, true); // idem
potions.setPotionNbrOwned(potions.list.health, 10); // potions.list.health.nbrOwned int
potions.setPotionNbrOwned(potions.list.escape, 10); // idem
potions.setPotionNbrOwned(potions.list.berserk, 110); // idem
potions.setPotionNbrOwned(potions.list.fireScroll, 42); // idem
potions.setPotionNbrOwned(potions.list.acidRainScroll, 10); // idem
potions.setPotionNbrOwned(potions.list.teleportScroll, 250); // idem
potions.setPotionNbrOwned(potions.list.earthquakeScroll, 50); // idem
potions.setPotionNbrOwned(potions.list.impInvocationScroll, 10); // idem
potions.setPotionNbrOwned(potions.list.majorHealth, 10); // idem
potions.setPotionNbrOwned(potions.list.invulnerability, 1337); // idem
potions.setPotionNbrOwned(potions.list.turtle, 17); // idem
potions.setPotionNbrOwned(potions.list.jelly, 17000); // idem
potions.setPotionNbrOwned(potions.list.seed, 15); // idem
potions.setPotionNbrOwned(potions.list.cloning, 15); // idem
potions.setPotionNbrOwned(potions.list.superman, 15); // idem
potions.setPotionNbrOwned(potions.list.gmooh, 80); // idem
potions.updateOnPage();
// quest.js
quest.setMaxLandOrder(25); // quest.maxLandOrder, must be saved because it indicates the lands we have unlocked for the moment int
quest.setTiredTime(0); // quest.tiredTime, must be saved because we may do a quest, have a long tired time, and save before the tired time ends int
// All other variables should not be saved because they only describe the internal states of the quest, we we can't save while questing !
// random.js
// nothing to save
// speech.js
// nothing to save
// spells.js
// spells.list : spells are added to the list in the onload function, no need to save
spells.setFasterCandiesFibo(1, 2); // spells.fasterCandiesFiboPrev && spells.fasterCandiesFiboCurr int && int
// status.js
// nothing to save
// swamp.js
// swamp.shown : can't be true when we save, so we don't save it
swamp.setStep(0); // swamp.step int
// tabs.js
tabs.setAnimation("none"); // tabs.animation string 50
// underwaterCave.js
// nothing to save
// wishingWell.js
// wishingWell.shown : can't be true when we save, so we don't save it
wishingWell.setSpeech(""); // wishingWell.speech string 1000
wishingWell.setStep(0); // wishingWell.step int
// yourself.js
yourself.setCanSurpass(true); // yourself.canSurpass bool
// castleEntrance.js
// nothing to save, all the variables are internal states of the quest
developperComputer.setWon(false);
}
};

58
static/candies/scripts/drops.js Executable file
View File

@ -0,0 +1,58 @@
var drops = {
createDrop : function(type, param1, param2){
return {type:type, param1:param1, param2:param2};
},
getText : function(){
var text = "";
// Candies found
if(quest.candiesFound != 1) text += "You found " + quest.candiesFound + " candies.";
else text += "You found 1 candy.";
// Objects found
for(obj in objects.list){
if(objects.list[obj].found){
text += "\n<b>You found " + objects.list[obj].text + ".</b>";
}
}
// Notice
text += "\n\nThings found will be yours only if you finish the quest without dying.";
return text;
},
gainDrops : function(){
// Gain the candies
candies.setNbrOwned(candies.nbrOwned + quest.candiesFound);
// Gain the objects
for(obj in objects.list){
if(objects.list[obj].found){ // If we found this object but didn't have it already
objects.setHaveObject(obj, true);
}
}
},
getAllDropsFromList : function(list){
for(var i = 0; i < list.length; i++){
switch(list[i].type){
case "candies":
quest.setCandiesFound(quest.candiesFound + list[i].param1);
break;
case "object":
if(list[i].param2 == true) this.foundObject(list[i].param1);
break;
}
}
},
foundObject : function(name){
// If we don't already have this object, then we just found it !
if(objects.list[name].have == false) objects.list[name].found = true;
}
};

125
static/candies/scripts/farm.js Executable file
View File

@ -0,0 +1,125 @@
var farm = {
// Variables
lollipopsPlanted : 0, // The number of lollipops planted in the farm
productionDelayType : "none", // On which delay does the farm product lollipops (day, hour, min, sec...)
lollipopsPerDay : 0, // How many lollipops the farm produce every day
lollipopsProduction : 0, // How many lollipops the farm produce every day, hour, min, sec.. depending on the production delay type
maxLollipopsPerDay : 8640000, // = 100/sec
flagsList : [" ~ ", " * ", "cnd", " ! ", " + ", " ? ", "/|\\"], // List of ascii flags which can appear on the farm
currentFlagIndex : 0, // Index in the list of the current flag shown
plantingButtonsStep : 0, // Step of the lollipops planting buttons : (= which buttons are shown, 1000, 100.. ?)
// Functions
calculateLollipopsPerDay : function(){
if(this.lollipopsPlanted <= 293){ // sqrt(86400) = 293
this.lollipopsPerDay = Math.pow(this.lollipopsPlanted, 2); // 293 will give 85849
}
else{ // When we're counting in lp/sec, this function is used instead of the other one. It will stabilize the curve.
var prod = (this.lollipopsPlanted - 122) * 500; // 194 will give 86000
if(prod < this.maxLollipopsPerDay) this.lollipopsPerDay = prod;
else this.lollipopsPerDay = this.maxLollipopsPerDay;
}
},
setPlantingButtonsStep : function(value){
// Set the value
this.plantingButtonsStep = value;
// Update on page
switch(this.plantingButtonsStep){
case 1:
htmlInteraction.setInnerHtml("lp_buttons", "<button class=\"home_button\" id=\"plant_1_lp\" onClick=\"farm.plantLollipops(1);\">Plant <b><span style=\"color:#79ad36\">1</span> lollipop</b></button>");
break;
case 2:
htmlInteraction.setInnerHtml("lp_buttons", "<b>Plant&nbsp;&nbsp;<button class=\"home_button\" id=\"plant_1_lp\" onClick=\"farm.plantLollipops(1);\"><b><span style=\"color:#79ad36\">1</span></b></button> <button class=\"home_button\" id=\"plant_10_lp\" onClick=\"farm.plantLollipops(10);\" style=\"visibility:hidden\"><b><span style=\"color:#79ad36\">10</span></b></button>&nbsp;&nbsp;lollipops</b>");
break;
case 3:
htmlInteraction.setInnerHtml("lp_buttons", "<b>Plant&nbsp;&nbsp;<button class=\"home_button\" id=\"plant_1_lp\" onClick=\"farm.plantLollipops(1);\"><b><span style=\"color:#79ad36\">1</span></b></button> <button class=\"home_button\" id=\"plant_10_lp\" onClick=\"farm.plantLollipops(10);\" style=\"visibility:hidden\"><b><span style=\"color:#79ad36\">10</span></b></button> <button class=\"home_button\" id=\"plant_100_lp\" onClick=\"farm.plantLollipops(100);\" style=\"visibility:hidden\"><b><span style=\"color:#79ad36\">100</span></b></button>&nbsp;&nbsp;lollipops</b>");
break;
case 4:
htmlInteraction.setInnerHtml("lp_buttons", "<b>Plant&nbsp;&nbsp;<button class=\"home_button\" id=\"plant_1_lp\" onClick=\"farm.plantLollipops(1);\"><b><span style=\"color:#79ad36\">1</span></b></button> <button class=\"home_button\" id=\"plant_10_lp\" onClick=\"farm.plantLollipops(10);\" style=\"visibility:hidden\"><b><span style=\"color:#79ad36\">10</span></b></button> <button class=\"home_button\" id=\"plant_100_lp\" onClick=\"farm.plantLollipops(100);\" style=\"visibility:hidden\"><b><span style=\"color:#79ad36\">100</span></b></button> <button class=\"home_button\" id=\"plant_1000_lp\" onClick=\"farm.plantLollipops(1000);\" style=\"visibility:hidden\"><b><span style=\"color:#79ad36\">1000</span></b></button>&nbsp;&nbsp;lollipops</b>");
break;
}
// Check the buttons
buttons.checkLollipopsPlantingButtons();
},
clickedOnTheBigLollipop : function(){
// Increment the current flag index
this.setCurrentFlagIndex(this.currentFlagIndex + 1);
},
setCurrentFlagIndex : function(value){
// Set the new value and correct it if incorrect
this.currentFlagIndex = value;
if(this.currentFlagIndex >= this.flagsList.length || this.currentFlagIndex < 0) this.currentFlagIndex = 0;
// Update on the page
htmlInteraction.setInnerHtml("farm_big_lollipop", this.flagsList[this.currentFlagIndex]);
},
checkVisibility : function(){
if(objects.list.key.have){
htmlInteraction.setElementVisibility("farm", true);
}
},
plantLollipops : function(number){
if(lollipops.nbrOwned >= number){
lollipops.setNbrOwned(lollipops.nbrOwned - number);
this.setLollipopsPlanted(this.lollipopsPlanted + number);
}
},
setLollipopsPlanted : function(value){
// We change the value
this.lollipopsPlanted = value;
// We update on page
htmlInteraction.setInnerHtml("lp_planted", "Lollipops planted:&nbsp;&nbsp;<b><span style=\"color:#79ad36\">" + numberWithCommas(this.lollipopsPlanted) + "</span></b>");
// We re calculate stuff
this.calculateLollipopsPerDay();
this.calculateLollipopsProductionFromLollipopsPerDay();
},
calculateLollipopsProductionFromLollipopsPerDay : function(){
if(this.lollipopsPerDay < 24){
this.setProductionDelayType("day");
this.setLollipopsProduction(Math.floor(this.lollipopsPerDay));
}
else if(this.lollipopsPerDay < 1440){
this.setProductionDelayType("hour");
this.setLollipopsProduction(Math.floor(this.lollipopsPerDay/24));
}
else if(this.lollipopsPerDay < 86400){
this.setProductionDelayType("min");
this.setLollipopsProduction(Math.floor(this.lollipopsPerDay/1440));
}
else{
this.setProductionDelayType("sec");
this.setLollipopsProduction(Math.floor(this.lollipopsPerDay/86400));
}
},
setProductionDelayType: function(value){
this.productionDelayType = value;
},
setLollipopsProduction : function(value){
this.lollipopsProduction = value;
htmlInteraction.setInnerHtml("lp_production", "Production rate:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><span style=\"color:#79ad36\">" + numberWithCommas(this.lollipopsProduction) + "</span> lollipops/" + this.productionDelayType + "</b>");
},
setMaxLollipopsPerDay : function(value){
// We set the max lollipops per day
this.maxLollipopsPerDay = value;
// We re calculate stuff
this.calculateLollipopsPerDay();
this.calculateLollipopsProductionFromLollipopsPerDay();
}
};

100
static/candies/scripts/forge.js Executable file
View File

@ -0,0 +1,100 @@
var forge = {
// Variables
shown : false,
step : 0,
speech : "There's an anvil here.",
// Functions
updateOnPage : function(){
var text = "";
// The anvil
text += "\
.-------..___\n\
\'-._ :_.-\'\n\
.- ) _ ( --.\n\
: \'-\' \'-\' ;.\n\
/\'-.._____.-\' |\n\
| | \\ |\n\
\\ | / \\\n\
| \\ )_.-\'\n\
\'-._/__..-\'\n\n"
// The speech
text += speech.makeSpeechFromText(this.speech, 23, "");
text += "\n\n";
// Buttons
switch(this.step){
case 0:
if(sword.name == "chocolate sword"){
text += "<button onClick=\"sword.sharpen();\">Sharpen your sword using the anvil</button>\n";
}
break;
case 1:
if(potions.list.health.shown)
text += "<button id=\"enchant_health\" onClick=\"sword.enchantHealth();\">Enchant using a health potion</button>\n";
if(potions.list.fireScroll.shown)
text += "<button id=\"enchant_fire\" onClick=\"sword.enchantFire();\">Enchant using a fire scroll</button>\n";
if(potions.list.impInvocationScroll.shown)
text += "<button id=\"enchant_imp_invocation\" onClick=\"sword.enchantImpInvocation();\">Enchant using an imp invocation scroll</button>\n";
break;
}
// The leave button
text += "\n<button onClick=\"forge.leave();\">Leave the forge</button>";
htmlInteraction.setInnerHtml("map", text);
buttons.checkForge();
},
setStep : function(value){
// We change the value
this.step = value;
// We possibly change the speech depending on the new step
switch(this.step){
case 1:
this.speech = "You could enchant your sword using this anvil, but be careful : you can only enchant a sword once !";
break;
case 2:
// At this step, the speech is based on the sword name
switch(sword.name){
case "Sword of Flames":
this.speech = "You now have the Sword of Flames ! Your sword is covered by a permanent blaze, damaging your enemies more than ever.";
break;
case "Sword of Life":
this.speech = "You now have the Sword of Life ! This powerful charm will drain the life of your enemies to regain yours.";
break;
case "Sword of Summoning":
this.speech = "You now have the Sword of Summoning ! Your sword will sometimes spawn ally creatures in place of your dead enemies.";
break;
}
break;
}
// We update on page if the forge is shown
if(this.shown) this.updateOnPage();
},
enter : function(){
objects.leave();
this.shown = true;
this.updateOnPage();
},
leave : function(){
this.shown = false;
htmlInteraction.setInnerHtml("map", "");
//buttons.enableHomeButtons();
}
};

414
static/candies/scripts/hell.js Executable file
View File

@ -0,0 +1,414 @@
var hell = {
// Variables
size : 45,
lavaLakeStep : 0,
buffers : [[], [], [], [], [], [], []], // The three things buffers
bufferPosition : 1, // On which buffer is the character (at first in the middle buffer)
timeSpent : 0, // Increase each cycle
addRockStep : 0,
monstersGap : 7, // Gap between the devil and appearing monsters
step : 0,
// Functions
onload : function(){
land.addLand("Hell", this.size, 6, this.load.bind(this), this.getText.bind(this), this.move.bind(this));
},
move : function(){
// We increase the lava lake step
this.lavaLakeStep += 1;
if(this.lavaLakeStep == 12){
this.lavaLakeStep = 0;
}
// We make things move
for(var i = 0; i < 7; i++){
if(i != this.bufferPosition){
if(this.buffers[i][0].type == "mob") this.buffers[i][0] = quest.makeNoneThing();
for(var j = 1; j < this.size - 1; j++){
if(this.buffers[i][j].type == "mob" && this.buffers[i][j-1].type == "none" && this.buffers[i][j].text != " * " && this.buffers[i][j].text != "|-|"){
this.buffers[i][j-1] = this.buffers[i][j];
this.buffers[i][j] = quest.makeNoneThing();
}
}
// Clone
for(var j = this.size-2; j >= 0; j--){
if(this.buffers[i][j].text == "\\o/" && this.buffers[i][j].type == "ally" && this.buffers[i][j+1].type == "none" && this.buffers[i][j].text != " * " && this.buffers[i][j].text != "|-|"){
this.buffers[i][j+1] = this.buffers[i][j];
this.buffers[i][j] = quest.makeNoneThing();
}
}
}
else{
if(quest.things[0].type == "mob") quest.things[0] = quest.makeNoneThing();
for(var j = 1; j < this.size - 1; j++){
if(quest.things[j].type == "mob" && quest.things[j-1].type == "none" && quest.things[j].text != " * " && quest.things[j].text != "|-|"){
quest.things[j-1] = quest.things[j];
quest.things[j] = quest.makeNoneThing();
}
}
}
}
// We check the steps
switch(this.step){
case 0: this.checkStep1(); break;
case 1: this.checkStep2(); break;
case 2: this.checkStep3(); break;
case 3: this.checkStep4(); break;
}
// We add ennemies in the middle buffers
for(var i = 2; i < 5; i++){
if(i != this.bufferPosition && this.buffers[i][this.size-this.monstersGap].type == "none"){
this.buffers[i][this.size-this.monstersGap] = this.makeMiddleCreature();
}
else if(i == this.bufferPosition && quest.things[this.size-this.monstersGap].type == "none"){
quest.things[this.size-this.monstersGap] = this.makeMiddleCreature();
}
}
// Idem in the side buffers
for(var i = 0; i < 2; i++){
if(i != this.bufferPosition && this.buffers[i][this.size-this.monstersGap].type == "none"){
this.buffers[i][this.size-this.monstersGap] = this.makeSideCreature();
}
else if(i == this.bufferPosition && quest.things[this.size-this.monstersGap].type == "none"){
quest.things[this.size-this.monstersGap] = this.makeSideCreature();
}
}
for(var i = 5; i < 7; i++){
if(i != this.bufferPosition && this.buffers[i][this.size-this.monstersGap].type == "none"){
this.buffers[i][this.size-this.monstersGap] = this.makeSideCreature();
}
else if(i == this.bufferPosition && quest.things[this.size-this.monstersGap].type == "none"){
quest.things[this.size-this.monstersGap] = this.makeSideCreature();
}
}
// We increase the time spent
this.timeSpent += 1;
},
load : function(){
// We set the first buffer position
this.bufferPosition = 3;
// We fill buffers
for(var i = 0; i < 7; i++){
if(i != this.bufferPosition){
this.buffers[i] = quest.fillWithNoneThings();
}
}
// We add the devil
quest.things[this.size - 1] = this.makeDevil();
// We add first doors
quest.things[this.size - 4] = this.makeDoor();
for(var i = 0; i < 7; i++){
if(i != 3) this.buffers[i][this.size - 4] = this.makeDoor();
}
// We add second doors
quest.things[this.size - 6] = this.makeSpikyDoor();
for(var i = 0; i < 7; i++){
if(i != 3 && i != 5) this.buffers[i][this.size - 6] = this.makeSpikyDoor();
}
this.buffers[5][this.size - 6] = this.makeDoor();
// We add teleporting gates
quest.things[this.size - 3] = this.makeTeleportingGate();
quest.things[this.size - 5] = this.makeTeleportingGate();
for(var i = 0; i < 7; i++){
if(i != 3){
this.buffers[i][this.size - 3] = this.makeTeleportingGate();
this.buffers[i][this.size - 5] = this.makeTeleportingGate();
}
}
// We set the steps
this.addRockStep = 0;
this.step = 0;
// We set the time spent
this.timeSpent = 0;
},
teleportCharacter : function(gatesIndex){
var index = quest.getCharacterIndex();
quest.things[0] = quest.things[index];
quest.things[index] = quest.makeNoneThing();
quest.things[gatesIndex] = quest.makeNoneThing();
for(var i = 0; i < 7; i++){
if(i != this.bufferPosition){
this.buffers[i][gatesIndex] = quest.makeNoneThing();
}
}
},
checkStep1 : function(){
var index = quest.getCharacterIndex();
if(index >= this.size - 7) this.step = 1;
},
checkStep2 : function(){
for(var i = 0; i < 7; i++){
if((i != this.bufferPosition && this.buffers[i][this.size-5].text != " * ") || (i == this.bufferPosition && quest.things[this.size-5].text != " * ")){
this.teleportCharacter(this.size-5);
this.step = 2;
break;
}
}
},
checkStep3 : function(){
var index = quest.getCharacterIndex();
if(index >= this.size - 5) this.step = 3;
},
checkStep4 : function(){
for(var i = 0; i < 7; i++){
if((i != this.bufferPosition && this.buffers[i][this.size-3].text != " * ") || (i == this.bufferPosition && quest.things[this.size-3].text != " * ")){
this.teleportCharacter(this.size-3);
this.step = 4;
this.timeSpent = 0;
break;
}
}
},
goDown : function(){
var pos = this.bufferPosition;
// If we're questing the hell
if(quest.weAreQuestingRightNow && land.getLandIndexFromName("Hell") == quest.currentLandIndex){
// If we're not already at the buffer 2
if(this.bufferPosition != 6){
// If we were able to swap, change the buffer position
if(this.swapBufferAndQuestThings(pos, pos + 1)){
this.bufferPosition += 1;
this.checkDevil();
quest.updateOnPage();
}
}
}
},
goUp : function(){
var pos = this.bufferPosition;
// If we're questing the hell
if(quest.weAreQuestingRightNow && land.getLandIndexFromName("Hell") == quest.currentLandIndex){
// If we're not already at the buffer 0
if(this.bufferPosition != 0){
// If we were able to swap, change the buffer position
if(this.swapBufferAndQuestThings(pos, pos - 1)){
this.bufferPosition -= 1;
this.checkDevil();
quest.updateOnPage();
}
}
}
},
swapBufferAndQuestThings : function(now, after){
var index = quest.getCharacterIndex();
var character = quest.things[index];
// If we will be able to move on the "after" buffer, we swap (if we have some hp, too)
if(this.buffers[after][index].type == "none" && character.hp > 0){
// We save the quest things in the old buffer
this.buffers[now] = quest.things.slice(0);
// We delete the character from the old buffer
this.buffers[now][index] = quest.makeNoneThing();
// We put the new buffer into the quest things
quest.things = this.buffers[after].slice(0);
// We add the character
quest.things[index] = character;
// We return true
return true;
}
// Else we return false
return false;
},
checkDevil : function(){
// If the devil isn't on the line of the character
if(quest.things[this.size-1].text != "DEV"){
// We move it
for(var i = 0; i < 7; i++){
if(i != this.bufferPosition && this.buffers[i][this.size-1].text == "DEV"){
quest.things[this.size-1] = this.buffers[i][this.size-1];
this.buffers[i][this.size-1] = quest.makeNoneThing();
break;
}
}
}
},
makeDevil : function(){
return land.createMob("DEV", 250, 250, "religion", "It's the devil itself!", [drops.createDrop("candies", 100000)]);
},
makeTeleportingGate : function(){
return land.createMob(" * ", 120, 120, "none", "A teleporting gate, made by the devil itself.", []);
},
makeMiddleCreature : function(){
switch(this.step){
case 0:
if(random.oneChanceOutOf(3)){
return this.makeDemon();
}
break;
case 2:
if(random.oneChanceOutOf(4)){
return this.makeBanshee();
}
break;
case 3:
if(random.oneChanceOutOf(3)){
return castleKeep.makeFireball();
}
break;
case 4:
if(this.timeSpent < 50 && this.timeSpent % 2 == 0){
return castleStairs.makeGhost();
}
else if(this.timeSpent < 70){
// nothing
}
else if(this.timeSpent < 90){
if(random.oneChanceOutOf(5)){
return castleKeep.makeFireball();
}
}
else if(this.timeSpent < 110){
if(random.oneChanceOutOf(4)){
return castleKeep.makeFireball();
}
}
else if(this.timeSpent < 130){
if(random.oneChanceOutOf(3)){
return castleKeep.makeFireball();
}
}
else if(this.timeSpent < 170){
if(random.oneChanceOutOf(2)){
return castleKeep.makeFireball();
}
}
else{
return castleKeep.makeFireball();
}
break;
}
return quest.makeNoneThing();
},
makeSideCreature : function(){
switch(this.step){
case 0:
return this.makeMiddleCreature();
break;
case 2:
if(random.oneChanceOutOf(5)){
return castleStairs.makeGhost();
}
break;
case 3:
if(random.oneChanceOutOf(4)){} // nothing
else{
return castleStairs.makeGhost();
}
break;
case 4:
return this.makeMiddleCreature();
break;
}
return quest.makeNoneThing();
},
makeDemon : function(){
return land.createMob("DEM", 90, 90, "demon claws", "A demon.", []);
},
makeBanshee : function(){
return land.createMob("BSH", 160, 160, "?", "A banshee, omen of death.", []);
},
makeDoor : function(){
return land.createMob("|-|", 300, 300, "none", "A strong door. Hard to break.", []);
},
makeSpikyDoor : function(){
return land.createMob("|-|", 300, 300, "spikes", "A strong door. Hard to break. There are spikes on it, it hurts!", []);
},
getText : function(){
// Create the text var
var text = "";
// Add the i & k instructions
text += "<span style=\"color:red;\"><b>Press i to go up and k to go down.</b></span> (if it doesn't work, click on the page to gain focus)";
text += "\n";
// Open the span
text += "<span style=\"font-size:10px;\">";
text += "\n";
// We add buffers
for(var i = 0; i < 7; i++){
if(i != this.bufferPosition){
for(var j = 0; j < this.size; j++){
if(this.buffers[i][j].type != "none"){
text += this.buffers[i][j].text;
}
else text += " ";
}
}
else{
for(var j = 0; j < this.size; j++){
if(quest.things[j].type != "none"){
text += quest.things[j].text;
}
else text += " ";
}
}
text += "\n";
}
// We make the lava lake
for(var i = 0; i < Math.floor(this.size/2); i++){
switch(this.lavaLakeStep){
case 0: case 1: text += "_.-'-."; break;
case 2: case 3: text += "._.-'-"; break;
case 4: case 5: text += "-._.-'"; break;
case 6: case 7: text += "'-._.-"; break;
case 8: case 9: text += "-'-._."; break;
case 10: case 11: text += ".-'-._"; break;
}
}
// Close the span
text += "</span>"
return text;
}
};

View File

@ -0,0 +1,76 @@
var htmlInteraction = {
setElementDisplay : function(id, display){
document.getElementById(id).style.display = display;
},
getElement : function(id){
return document.getElementById(id);
},
setElementVisibility : function(id, bool){
if(bool) document.getElementById(id).style.visibility = "visible";
else document.getElementById(id).style.visibility = "hidden";
},
isElementVisible : function(id){
if(document.getElementById(id).style.visibility == "hidden") return false;
return true;
},
setInnerHtml : function(id, value){
document.getElementById(id).innerHTML = value;
},
disableButton : function(id){
this.getElement(id).disabled = "disabled";
},
disableButtonClass : function(id){
var arr = document.getElementsByClassName(id);
for(var i = 0; i < arr.length; i++){
arr[i].disabled = "disabled";
}
},
enableButton : function(id){
this.getElement(id).disabled = "";
},
enableButtonClass : function(id){
var arr = document.getElementsByClassName(id);
for(var i = 0; i < arr.length; i++){
arr[i].disabled = "";
}
},
showButton : function(id){
htmlInteraction.setElementVisibility(id, true);
},
showButtonClass : function(id){
var arr = document.getElementsByClassName(id);
for(var i = 0; i < arr.length; i++){
arr[i].style.visibility = "visible";
}
},
hideButton : function(id){
htmlInteraction.setElementVisibility(id, false);
},
hideButtonClass : function(id){
var arr = document.getElementsByClassName(id);
for(var i = 0; i < arr.length; i++){
arr[i].style.visibility = "hidden";
}
},
setButtonOnclick : function(id, value){
this.getElement(id).onclick = value;
},
focusElement : function(id){
this.getElement(id).focus();
}
};

155
static/candies/scripts/hut.js Executable file
View File

@ -0,0 +1,155 @@
var hut = {
// Variables
shown : false,
speech : "",
step : 0,
// Functions
throwLollipops : function(){
if(lollipops.nbrOwned >= 10){
lollipops.setNbrOwned(lollipops.nbrOwned - 10);
this.setStep(1);
this.setSpeech("I see that you have lollipops... I could cast spells for you, in exchange of some sweets... I looove lollipops!");
this.updateOnPage();
}
},
acceptProposition : function(){
this.setStep(2);
this.setSpeech("See for yourself. My prices are high, but the spells are great!");
this.updateOnPage();
},
setStep : function(value){
this.step = value;
},
setSpeech : function(value){
this.speech = value;
},
updateOnPage : function(){
var text = "";
// Hut drawing
switch(this.step){
case 0:
text += "\
/\\)\\))/\\(/|)\\))/((||\\/)\\)\\\n\
(/((\\///)))/(\\\\(/)\\\\\\\\\\)\\)\n\
.__/(|_/| |\\_|)/__.\n\
| |_/| |\\_| |\n\
| |_/| |\\_| |\n\
.__| |_/| |\\_| |__.\n\
|_/| |\\_|\n\
|_/| |\\_|\n\
._ |_/|________|\\_| _.\n\
'-.|_/ \\_|.-'\
"
text += "\n\n<button id=\"hut_throw_lollipops\" onClick=\"hut.throwLollipops();\">Throw <b><span style=\"color:#79ad36\">10</span> lollipops</b> inside the hut</button>";
break;
default:
text += "\
/\\)\\))/\\(/|)\\))/((||\\/)\\)\\\n\
(/((\\///)))/(\\\\(/)\\\\\\\\\\)\\)\n\
.__/(|_/| _|\\_ |\\_|)/__.\n\
| |_/| (\"} |\\_| |\n\
| |_/|i_.-@-._|\\_| |\n\
.__| |_/|8--, .-|\\_| |__.\n\
|_/|I /==\\ |\\_|\n\
|_/|I | \\|\\_|\n\
._ |_/|I__/___\\|\\_| _.\n\
'-.|_/ \\_|.-'\n\n\
"
break;
}
// Speech & spells drawing
switch(this.step){
case 1:
text += speech.makeSpeechFromText(this.speech, 24, "");
text += "\n\n<button onClick=\"hut.acceptProposition();\">Well... that might be interesting</button>";
break;
case 2:
text += speech.makeSpeechFromText(this.speech, 24, "");
text += this.getSpellsButtons();
break;
}
text += "\n\n<button onClick=\"hut.leave();\">Leave the sorceress' hut</button>";
htmlInteraction.setInnerHtml("map", text);
if(this.step == 0) buttons.checkHut();
if(this.step == 2) buttons.checkHut();
},
getSpellsButtons : function(){
var text = "\n";
for(var i = 0; i < spells.list.length; i++){
text += "\n<button id=\"hut_spell_" + i + "\" onClick=\"hut.useSpell(" + i + ");\">" + spells.list[i].name + " (<b><span style=\"color:#79ad36\">" + numberWithCommas(spells.list[i].price()) + "</span> lollipops</b>)</button>";
}
// We maybe add the surpass yourself button
if(quest.maxLandOrder == 7 && yourself.canSurpass == false){
text += "\n";
text += "\n<button id=\"hut_surpass\" onClick=\"hut.surpass();\">Surpass yourself (" + numberWithCommas(1000000) + " lollipops)</button>";
}
return text;
},
surpass : function(){
if(lollipops.nbrOwned >= 1000000){
lollipops.setNbrOwned(lollipops.nbrOwned - 1000000);
this.setSpeech("You are now able to surpass yourself. Congratulations!");
yourself.setCanSurpass(true);
this.updateOnPage();
}
},
canThisSpellBeUsed : function(id){
// Check the conditions, return false if some of the conditions are not met
for(var i = 0; i < spells.list[id].conditions.length; i++){
switch(spells.list[id].conditions[i]){
case "specialSword":
if(sword.specialSword == false) return false;
break;
}
}
// Check the price, return false if the price isn't met
if(spells.list[id].price() > lollipops.nbrOwned) return false;
return true;
},
enter : function(){
objects.leave();
this.shown = true;
this.updateOnPage();
},
leave : function(){
this.shown = false;
htmlInteraction.setInnerHtml("map", "");
//buttons.enableHomeButtons();
},
useSpell : function(id){
if(lollipops.nbrOwned >= spells.list[id].price()){
lollipops.setNbrOwned(lollipops.nbrOwned - spells.list[id].price());
this.setSpeech(spells.list[id].speech);
spells.list[id].effect();
this.updateOnPage();
inventory.updateOnPage();
}
}
};

View File

@ -0,0 +1,161 @@
var inventory = {
// Variables
magicianHatLetter : "",
// Functions
setMagicianHatLetter : function(value){
this.magicianHatLetter = value;
},
updateOnPage : function(){
// Check for the magician hat letter : if we have the magician hat but no letter is set yet
if(objects.list.magicianHat.have && this.magicianHatLetter == ""){
this.setMagicianHatLetter(" " + random.getRandomLetter());
}
// Sword
switch(sword.name){
case "wooden sword": htmlInteraction.setInnerHtml("sword_without_button", sword.asciiWoodenSwordWithoutButton); break;
case "copper sword": htmlInteraction.setInnerHtml("sword_without_button", sword.asciiCopperSwordWithoutButton); break;
case "iron sword": htmlInteraction.setInnerHtml("sword_without_button", sword.asciiIronSwordWithoutButton); break;
case "silver sword": htmlInteraction.setInnerHtml("sword_without_button", sword.asciiSilverSwordWithoutButton); break;
case "diamond sword": htmlInteraction.setInnerHtml("sword_without_button", sword.asciiDiamondSwordWithoutButton); break;
case "candy diamond sword": htmlInteraction.setInnerHtml("sword_without_button", sword.asciiCandyDiamondSword); break;
case "polished candy diamond sword": htmlInteraction.setInnerHtml("sword_without_button", sword.asciiPolishedCandyDiamondSword); break;
case "chocolate sword": htmlInteraction.setInnerHtml("sword_without_button", sword.asciiChocolateSword); break;
case "sharp chocolate sword": htmlInteraction.setInnerHtml("sword_without_button", sword.asciiSharpChocolateSword); break;
case "Sword of Flames": htmlInteraction.setInnerHtml("sword_without_button", sword.asciiSwordOfFlames + "\n\nLevel : " + sword.specialPower); break;
case "Sword of Life": htmlInteraction.setInnerHtml("sword_without_button", sword.asciiSwordOfLife + "\n\nLevel : " + sword.specialPower); break;
case "Sword of Summoning": htmlInteraction.setInnerHtml("sword_without_button", sword.asciiSwordOfSummoning + "\n\nLevel : " + sword.specialPower); break;
case "Sword of Liflamesummoning": htmlInteraction.setInnerHtml("sword_without_button", sword.asciiSwordOfLiflamesummoning + "\n\nLevel : " + sword.specialPower); break;
case "Sword of Randomness": htmlInteraction.setInnerHtml("sword_without_button", sword.asciiSwordOfRandomness + "\n\nLevel : infinite + " + sword.specialPower); break;
}
// Objects
this.updateObjectOnPage("inventory_key", objects.list.key, this.asciiKey, this.asciiNoObject);
this.updateObjectOnPage("inventory_boots", objects.list.boots, this.asciiBoots, this.asciiNoObject);
this.updateObjectOnPage("inventory_magician_hat", objects.list.magicianHat, this.magicianHatLetter + "\n" + this.asciiMagicianHat, this.asciiNoObject);
this.updateObjectOnPage("inventory_pink_ring", objects.list.pinkRing, this.asciiPinkRing, this.asciiNoObject);
this.updateObjectOnPage("inventory_candies_converter", objects.list.candiesConverter, this.asciiCandiesConverter, this.asciiNoObject);
this.updateObjectOnPage("inventory_plate_armour", objects.list.plateArmour, this.asciiPlateArmour, this.asciiNoObject);
this.updateObjectOnPage("inventory_cauldron", objects.list.cauldron, this.asciiCauldron, this.asciiNoObject);
this.updateObjectOnPage("inventory_magical_horn", objects.list.magicalHorn, this.asciiMagicalHorn, this.asciiNoObject);
this.updateObjectOnPage("inventory_horn_of_plenty", objects.list.hornOfPlenty, this.asciiHornOfPlenty, this.asciiNoObject);
this.updateObjectOnPage("inventory_old_amulet", objects.list.oldAmulet, this.asciiOldAmulet, this.asciiNoObject);
if(developperComputer.won){
htmlInteraction.setInnerHtml("inventory_won1", "<pre>" + this.asciiWon1 + "</pre>");
htmlInteraction.setInnerHtml("inventory_won2", "<pre>" + this.asciiWon2 + "</pre>");
htmlInteraction.showButton("hardmode");
}
else{
htmlInteraction.setInnerHtml("inventory_won1", "<pre>" + this.asciiNoObject + "</pre>");
htmlInteraction.setInnerHtml("inventory_won2", "<pre>" + this.asciiNoObject + "</pre>");
htmlInteraction.hideButton("hardmode");
}
// Maps
this.updateObjectOnPage("inventory_swamp_map", objects.list.swampMap, this.asciiSwampMap, this.asciiNoObject);
this.updateObjectOnPage("inventory_hut_map", objects.list.hutMap, this.asciiHutMap, this.asciiNoObject);
this.updateObjectOnPage("inventory_forge_map", objects.list.forgeMap, this.asciiForgeMap, this.asciiNoObject);
this.updateObjectOnPage("inventory_well_map", objects.list.wellMap, this.asciiWellMap, this.asciiNoObject);
},
updateObjectOnPage : function(id, obj, ascii, asciiNoObject){
if(obj.have){
htmlInteraction.setInnerHtml(id, "<pre>" + ascii + "</pre><span><b>" + obj.name + "</b><br/>" + obj.description);
}
else{
htmlInteraction.setInnerHtml(id, "<pre>" + asciiNoObject + "</pre>");
}
},
// Ascii art
asciiKey : " __\n\
/o \\_____\n\
\\__/-=\"=\"`",
asciiBoots : " ____\n\
\\ _|__\n\
__)| /\n\
(___| (__\n\
(_-___)",
asciiMagicianHat : " / \\\n\
/ \\\n\
/ \\\n\
/_______\\",
asciiPinkRing : " .--.\n\
// \\\\\n\
\\\\__//\n\
\'--\'",
asciiSwampMap : " _________\n\
| |\n\
| SWAMP |\n\
| ---> |\n\
|.-._.-._.|",
asciiHutMap : " _________\n\
| __ |\n\
| /lp\\ -> |\n\
| |__| |\n\
|._.-._.__|",
asciiForgeMap : " _________\n\
/ anvil \\\n\
| this |\n\
| <-- way |\n\
\\_________/",
asciiWellMap : " .-~-~-~-.\n\
! ~ ~ !\n\
!~ ~ !\n\
! ~ ~ ~ !\n\
\'-~-~-~-\'",
asciiCandiesConverter : " ______\n\
/+| |+\\\n\
|=={==}==|\n\
\\_|__|_/",
asciiPlateArmour : "-;`\\..../`;-\n\
|...::...|\n\
/\'\'\'::\'\'\'\\\n\
/\\ :: /\\\n\
>._::_.<",
asciiCauldron : " ________\n\
(________)\n\
) (\n\
/ \\\n\
| |\n\
\\__________/",
asciiMagicalHorn : " \\.\n\
\\\'.\n\
\\ \'.\n\
\\,-\'",
asciiHornOfPlenty : " .\\\n\
\\\'.\n\
\\ \'.\n\
\\__)",
asciiOldAmulet : " / \\\n\
o o\n\
\\_/\n\
.^.\n\
\'cnd\'\n\
\'. .\'",
asciiWon1 : "Bravo!\nYou won\nthe game :)\nYou now have\nall the\ncandies in\nthe world.",
asciiWon2 : "(you can now\nask Scrabble\nfor a real\ncandy, if you\nfind him!)",
asciiNoObject : " \n \n "
};

5
static/candies/scripts/jquery-1.9.1.min.js vendored Executable file

File diff suppressed because one or more lines are too long

82
static/candies/scripts/land.js Executable file
View File

@ -0,0 +1,82 @@
var land = {
// Variables
list : [],
ponyTime : false,
// Functions
createMob : function(text, max_hp, hp, weapon, description, drops){
if(this.ponyTime == false)
return {type:"mob", text:text, max_hp:max_hp, hp:hp, weapon:weapon, description:description, drops:drops};
else return {type:"mob", text:"PON", max_hp:max_hp, hp:hp, weapon:weapon, description:"A pony", drops:drops};
},
createFakeCharacter : function(){
if(this.ponyTime == false)
return {type:"fake", text:"\\o/", max_hp:0, hp:0, weapon:"none", description:"", drops:[]};
else return {type:"fake", text:"PON", max_hp:0, hp:0, weapon:"none", description:"A pony", drops:[]};
},
createAlly : function(text, max_hp, hp, weapon, description, drops){
if(this.ponyTime == false)
return {type:"ally", text:text, max_hp:max_hp, hp:hp, weapon:weapon, description:description, drops:drops};
else return {type:"ally", text:"PON", max_hp:max_hp, hp:hp, weapon:weapon, description:"A pony", drops:drops};
},
createTrap : function(text, max_hp, hp, weapon, description, drops){
if(this.ponyTime == false)
return {type:"trap", text:text, max_hp:max_hp, hp:hp, weapon:weapon, description:description, drops:drops};
else return {type:"trap", text:"PON", max_hp:max_hp, hp:hp, weapon:weapon, description:"A pony", drops:drops};
},
addLand : function(name, size, order, loadFunction, getTextFunction, moveFunction){
this.list.push({name:name, size:size, order:order, unlocked:false, loadFunction:loadFunction, getTextFunction:getTextFunction, moveFunction:moveFunction});
},
getLandIndexFromOrder : function(order){
for(var i = 0; i < this.list.length; i++){
if(this.list[i].order == order){
return i;
}
}
return -1;
},
getLandIndexFromName : function(name){
for(var i = 0; i < this.list.length; i++){
if(this.list[i].name == name){
return i;
}
}
return -1;
},
updateListOnPage : function(maxOrder){
var index, list, option;
// We iterate over all order from 0 to maxOrder
for(var i = 0; i <= maxOrder; i++){
index = this.getLandIndexFromOrder(i); // We get the index of the land with the order i
// If the land of index "index" isn't already unlocked and is correct (!= -1)
if(index != -1 && this.list[index].unlocked == false){
list = htmlInteraction.getElement("quest_destination"); // We get the list
option = document.createElement("option"); // We create the new element to add to the list
option.text = this.list[index].name; // We set its text
// We add it to the list
try{ list.add(option, list.options[null]); }
catch(e){ list.add(option, null); }
// We set that it is unlocked now
this.list[index].unlocked = true;
}
}
},
getText : function(){
return this.list[quest.currentLandIndex].getTextFunction();
},
load : function(){
return this.list[quest.currentLandIndex].loadFunction();
}
};

View File

@ -0,0 +1,7 @@
function loadPrompt() {
var code = prompt("Please enter your five-character code.", "");
if(code != null) {
window.location = 'index.php?pass=' + code;
}
}

View File

@ -0,0 +1,105 @@
var lollipops = {
// Variables
nbrOwned : 0,
nbrBought : 0,
nbrInStock : 1000,
stockShortage : false,
// Functions
buy1 : function(){
if(candies.nbrOwned >= shop.oneLollipopPrice && this.nbrInStock >= 1){
candies.setNbrOwned(candies.nbrOwned - shop.oneLollipopPrice);
this.setNbrOwned(this.nbrOwned + 1);
this.setNbrBought(this.nbrBought + 1);
this.setNbrInStock(this.nbrInStock - 1);
shop.setMerchantSpeech("Thanks for buyin'! Here's your " + this.getFlavour() + " shout out.");
}
},
buy10 : function(){
if(candies.nbrOwned >= shop.tenLollipopsPrice && this.nbrInStock >= 10){
candies.setNbrOwned(candies.nbrOwned - shop.tenLollipopsPrice);
this.setNbrOwned(this.nbrOwned + 10);
this.setNbrBought(this.nbrBought + 10);
this.setNbrInStock(this.nbrInStock - 10);
shop.setMerchantSpeech("Thanks for buyin'! Here's your ten shout outs. Various kinds.");
}
else shop.setMerchantSpeech("I'm sorry, we don't have enough shout outs in stock to sell you ten of them. We currently have " + this.nbrInStock + " shout outs in stock.");
},
getFlavour : function(){
var fruits = ["classic", "robot", "Kool-Aid Man", "programming", "race car", "roller coaster", "the golf clap one" ];
var uncommon = ["chocolate", "cookie", "pancake", "water", "tomato", "kitten"];
var unrealistic = ["leprechaun", "lollipop", "snow", "storm", "door", "dracula"];
var abstract = ["gluttony", "friendship", "puzzle", "fine art", "cuteness"];
var chances = [];
if(this.nbrBought < 10) chances = [1];
else if(this.nbrBought < 10) chances = [1];
else if(this.nbrBought < 15) chances = [0.9, 1];
else if(this.nbrBought < 20) chances = [0.8, 1];
else if(this.nbrBought < 25) chances = [0.7, 1];
else if(this.nbrBought < 30) chances = [0.5, 1];
else if(this.nbrBought < 35) chances = [0.4, 0.9, 1];
else if(this.nbrBought < 40) chances = [0.3, 0.8, 1];
else if(this.nbrBought < 45){
if(this.nbrBought == 42 && random.flipACoin()) return "space";
else chances = [0.2, 0.7, 1];
}
else if(this.nbrBought < 50) chances = [0.1, 0.6, 1];
else if(this.nbrBought < 55) chances = [0.1, 0.5, 1];
else if(this.nbrBought < 60) chances = [0.1, 0.4, 0.9];
else if(this.nbrBought < 65) chances = [0.1, 0.3, 0.8];
else if(this.nbrBought < 70) chances = [0.1, 0.2, 0.7];
else if(this.nbrBought < 75) chances = [0.1, 0.2, 0.6];
else if(this.nbrBought < 80) chances = [0.1, 0.2, 0.5];
else if(this.nbrBought < 85) chances = [0.1, 0.2, 0.4];
else if(this.nbrBought == 1337 && random.flipACoin()) return "leet";
else chances = [0.1, 0.2, 0.3];
var r = random.getRandomFloat()
if(r < chances[0]) return random.pickRandomly(fruits);
else if(r < chances[1]) return random.pickRandomly(uncommon);
else if(r < chances[2]) return random.pickRandomly(unrealistic);
else return random.pickRandomly(abstract);
},
delivery : function(){
this.setNbrInStock(this.nbrInStock + 15 + random.getRandomIntUpTo(10));
window.setTimeout(this.delivery.bind(this), 900000); // One delivery every 15 minutes
},
setNbrOwned : function(value){
this.nbrOwned = value;
if(this.nbrOwned != 1) htmlInteraction.setInnerHtml("shout outs", "You have <b><span style=\"color:#79ad36\">" + numberWithCommas(this.nbrOwned) + "</span> shout outs</b>!");
else htmlInteraction.setInnerHtml("shout outs", "You have <b><span style=\"color:#79ad36\">1</span> shout out</b>!");
htmlInteraction.setElementVisibility("shout outs", true);
buttons.checkLollipops();
cauldron.updateActionsInfoOnPage();
computer.updateLollipops();
},
setNbrBought : function(value){
this.nbrBought = value;
},
setNbrInStock : function(value){
// Set the value
this.nbrInStock = value;
// If > 100, decrease it
if(this.nbrInStock > 140) this.nbrInStock = 140;
// Handle lollipops stock shortage
if(this.stockShortage == false && this.nbrInStock == 0){
this.stockShortage = true;
buttons.checkLollipopsStockShortage();
}
else if(this.stockShortage == true && this.nbrInStock != 0){
this.stockShortage = false;
buttons.checkLollipopsStockShortage();
}
}
};

135
static/candies/scripts/main.js Executable file
View File

@ -0,0 +1,135 @@
var main = {
// Variables
nbrOfSecondsSinceLastMinInterval : 0,
nbrOfSecondsSinceLastHourInterval : 0,
nbrOfSecondsSinceLastDayInterval : 0,
saveShown : false,
// Functions
onload : function(){
// Prevents some stupid refresh bugs of the browser
htmlInteraction.enableButtonClass("home_button");
// Various loads
peacefulForest.onload();
mountGoblin.onload();
underwaterCave.onload();
castleEntrance.onload();
castleStairs.onload();
castleKeep.onload();
cowLevel.onload();
sea.onload();
desert.onload();
hell.onload();
yourself.onload();
chuckNorris.onload();
developperGarden.onload();
developperMoat.onload();
developperComputer.onload();
shop.onload();
candies.onload();
spells.onload();
potions.onload();
sword.onload();
cauldron.onload();
tabs.onload();
// Loading after various loads
quest.onloadAfter(); // This must be call after other loads because it needs the different quests to be loaded
// Loading a save
// First actions
window.setInterval(this.oneTenthSecInterval.bind(this), 100);
window.setInterval(this.secInterval.bind(this), 1000);
},
oneTenthSecInterval : function(){
// We try to convert candies into lollipops
candiesConverter.convert();
},
secInterval : function(){
// Candies
if(objects.list.oldAmulet.have == false) candies.setNbrOwned(candies.nbrOwned + candies.candiesPerSecond);
else candies.setNbrOwned(candies.nbrOwned + candies.candiesPerSecond*3);
// Quest tired time
if(objects.list.pinkRing.have == false) quest.setTiredTime(quest.tiredTime - 1);
else quest.setTiredTime(quest.tiredTime - 2);
// Lollipop farm
if(farm.productionDelayType == "sec"){
if(objects.list.hornOfPlenty.have == false) lollipops.setNbrOwned(lollipops.nbrOwned + farm.lollipopsProduction);
else lollipops.setNbrOwned(lollipops.nbrOwned + farm.lollipopsProduction*3);
}
// Cauldron
cauldron.moveSmoke();
cauldron.increaseActionTimer();
// We increase nbrOfSeconds variables
this.nbrOfSecondsSinceLastMinInterval += 1;
this.nbrOfSecondsSinceLastHourInterval += 1;
this.nbrOfSecondsSinceLastDayInterval += 1;
// We possibly trigger minInterval
if(this.nbrOfSecondsSinceLastMinInterval >= 60){
this.nbrOfSecondsSinceLastMinInterval = 0;
this.minInterval();
}
// We possibly trigger hourInterval
if(this.nbrOfSecondsSinceLastHourInterval >= 3600){
this.nbrOfSecondsSinceLastHourInterval = 0;
this.hourInterval();
}
// We possibily trigger dayInterval
if(this.nbrOfSecondsSinceLastDayInterval >= 86400){
this.nbrOfSecondsSinceLastDayInterval = 0;
this.dayInterval();
}
},
minInterval : function(){
// Lollipop farm
if(farm.productionDelayType == "min"){
if(objects.list.hornOfPlenty.have == false) lollipops.setNbrOwned(lollipops.nbrOwned + farm.lollipopsProduction);
else lollipops.setNbrOwned(lollipops.nbrOwned + farm.lollipopsProduction*3);
}
},
hourInterval : function(){
// Lollipop farm
if(farm.productionDelayType == "hour"){
if(objects.list.hornOfPlenty.have == false) lollipops.setNbrOwned(lollipops.nbrOwned + farm.lollipopsProduction);
else lollipops.setNbrOwned(lollipops.nbrOwned + farm.lollipopsProduction*3);
}
},
dayInterval : function(){
// Lollipop farm
if(farm.productionDelayType == "day"){
if(objects.list.hornOfPlenty.have == false) lollipops.setNbrOwned(lollipops.nbrOwned + farm.lollipopsProduction);
else lollipops.setNbrOwned(lollipops.nbrOwned + farm.lollipopsProduction*3);
}
},
setNbrOfSecondsSinceLastMinInterval : function(value){
this.nbrOfSecondsSinceLastMinInterval = value;
},
setNbrOfSecondsSinceLastHourInterval : function(value){
this.nbrOfSecondsSinceLastHourInterval = value;
},
setNbrOfSecondsSinceLastDayInterval : function(value){
this.nbrOfSecondsSinceLastDayInterval = value;
}
};
window.onload = main.onload.bind(main);

View File

@ -0,0 +1,49 @@
var mountGoblin = {
// Variables
basicChestProbability : 50,
// Functions
onload : function(){
land.addLand("Mount Goblin", 28, 1, this.load.bind(this), this.getText.bind(this));
},
setBasicChestProbability : function(value){
this.basicChestProbability = value;
},
load : function(){
for(var i = 1; i < quest.things.length; i++){
if(random.flipACoin()){
// If we're not at the top of the mount
if(i < 12 || i > 15){
// 1 chance out of x we spawn a CHS (chest !!)
if(random.oneChanceOutOf(this.basicChestProbability)){
this.setBasicChestProbability(this.basicChestProbability + 50);
quest.things[i] = quest.makeBasicChest();
}
// 1 chance out of 7 we spaw a GSB
else if(random.oneChanceOutOf(7)) quest.things[i] = land.createMob("GSB", 20, 5 + random.getRandomIntUpTo(5), "claws", "A sick goblin. It smells.", [drops.createDrop("candies", 3 + random.getRandomIntUpTo(3))]);
// Else we spawn a GOB
else quest.things[i] = land.createMob("GOB", 20, 20, "claws", "A nasty goblin.", [drops.createDrop("candies", 3 + random.getRandomIntUpTo(3))]);
}
else{
quest.things[i] = land.createMob("GTB", 30, 30, "dagger", "A tenacious goblin. Oh, he has a dagger, too.", [drops.createDrop("candies", 9 + random.getRandomIntUpTo(9)), drops.createDrop("object", "key", random.oneChanceOutOf(2)), drops.createDrop("object", "boots", random.oneChanceOutOf(5)), drops.createDrop("object", "swampMap", random.oneChanceOutOf(5)), drops.createDrop("object", "hutMap", random.oneChanceOutOf(5))]);
}
}
}
},
getText : function(){
var text = "";
text += " "; for(var i = 12; i < 16; i++) text += quest.things[i].text; text += "\n";
text += " "; for(var i = 9; i < 12; i++) text += quest.things[i].text; text += "/ \\/ \\/ \\/ \\"; for(var i = 16; i < 19; i++) text += quest.things[i].text; text += "\n";
text += " "; for(var i = 6; i < 9; i++) text += quest.things[i].text; text += "/ \\/ \\/ \\ / \\ \\ / \\/ \\/ \\"; for(var i = 19; i < 22; i++) text += quest.things[i].text; text += "\n";
text += " "; for(var i = 3; i < 6; i++) text += quest.things[i].text; text += "/ \\/ \\/ \\ \\ / \\/ \\ \\/ / \\ / \\/ \\/ \\"; for(var i = 22; i < 25; i++) text += quest.things[i].text; text += "\n";
text += ""; for(var i = 0; i < 3; i++) text += quest.things[i].text; text += "/ \\/ \\/ \\ / / \\ / / \\ / / \\/ / \\ / \\/ \\/ \\"; for(var i = 25; i < 28; i++) text += quest.things[i].text;
return text;
}
};

View File

@ -0,0 +1,40 @@
var objects = {
// Variables
list : {
key : {have:false, found:false, text:"a key", name:"The lollipop farm's key.", description:"This key brings a lollipop farm to your candy box."},
boots : {have:false, found:false, text:"a pair of boots", name:"The seven-league boots.", description:"These boots increase your speed during quests."},
swampMap : {have:false, found:false, text:"a map", name:"The map to the Swampy Swamp.", description:"The Swampy Swamp is the swampiest swamp you've ever seen."},
hutMap : {have:false, found:false, text:"a map", name:"The map to the sorceress' hut.", description:"In this hut lives a powerful witch! She might help you... but not for free."},
wellMap : {have:false, found:false, text:"a map", name:"The map to the wishing well.", description:"Make a wish, make it so, you may shine, you may glow..."},
magicianHat : {have:false, found:false, text:"a hat", name:"The magician's hat.", description:"Wearing this hat enhances your magic."},
pinkRing : {have:false, found:false, text:"a ring", name:"The pink ring of calmness.", description:"This pink ring will help you control your breath. You will recover faster after a quest."},
forgeMap : {have:false, found:false, text:"a map", name:"The map to the forge.", description:"An anvil can be really useful, if you have the appropriate sword.."},
candiesConverter : {have:false, found:false, text:"a strange object", name:"The candies converter.", description:"When activated in your candy box, this surprising object quickly converts all your candies into lollipops. One candy gives one lollipop!"},
plateArmour : {have:false, found:false, text:"a strong armour", name:"A plate armour.", description:"This strong armour protects you from your enemies. You will lose less health points."},
cauldron : {have:false, found:false, text:"a big container", name:"A cauldron.", description:"This cauldron allows you to brew a large variety of potions, using raw, common materials like candies or lollipops."},
magicalHorn : {have:false, found:false, text:"a horn", name:"A magical horn.", description:"This magical horn belonged to a unicorn. Carrying it will make you regain health points continuously during a quest!"},
hornOfPlenty : {have:false, found:false, text:"a horn", name:"The horn of plenty.", description:"The horn of plenty, stolen from Ploutos by the cow king, who thought it was a real horn. This mythical object will multiply by three your lollipop farm production."},
oldAmulet : {have:false, found:false, text:"an amulet", name:"An old amulet.", description:"This old amulet, found on the corpse of a dead warrior, is known to bring prosperity to its owner. It will multiply by three your candies production."}
},
leave : function(){
hut.leave();
wishingWell.leave();
swamp.leave();
forge.leave();
},
// Functions
setHaveObject : function(name, value){
// We set the new "have" value
this.list[name].have = value;
// We check the buttons related to objects, since they may have changed
buttons.checkObjects();
// We update the inventory
inventory.updateOnPage();
}
};

View File

@ -0,0 +1,85 @@
var peacefulForest = {
// Variables
basicChestProbability : 100,
poniesEncountered : 0,
// Functions
onload : function(){
land.addLand("The peaceful forest", 30, 0, this.load.bind(this), this.getText.bind(this), this.move.bind(this));
},
setBasicChestProbability : function(value){
this.basicChestProbability = value;
},
move : function(){
// Iterate over all things
for(var i = 0; i < quest.things.length; i++){
// If it's a wood poney (wood poneeeey \o/)
if(quest.things[i].text == "WPY"){
// We make it move if possible
if(random.flipACoin()){
// If we can move it to the right
if(quest.things[i+1].type == "none"){
// We move it to the right
quest.things[i+1] = quest.things[i];
quest.things[i] = quest.makeNoneThing();
}
}
else{
// If we can move it to the left
if(quest.things[i-1].type == "none"){
// We move it to the left
quest.things[i-1] = quest.things[i];
quest.things[i] = quest.makeNoneThing();
}
}
}
}
},
load : function(){
var addedAPoney = false; // Will be true if we added a pony. Useful to avoid adding two ponies in the same quest
for(var i = 1; i < quest.things.length; i++){
if(random.flipACoin()){
// 1 chance out of x we spawn a wood poney !!!! (if we didn't already add one)
if(random.oneChanceOutOf(300) && addedAPoney == false){
addedAPoney = true;
quest.things[i] = this.makeWoodPoney();
}
// 1 chance out of x we spawn a CHS (chest !!)
else if(random.oneChanceOutOf(this.basicChestProbability)){
this.setBasicChestProbability(this.basicChestProbability + 50);
quest.things[i] = quest.makeBasicChest();
}
// Else we spawn a tree
else quest.things[i] = land.createMob("|||", 5, 5, "none", "A tree. It sometimes drop a candy.", [drops.createDrop("candies", random.getRandomIntUpTo(1)), drops.createDrop("object", "key", random.oneChanceOutOf(2))]);
}
}
if(addedAPoney){
this.setPoniesEncountered(this.poniesEncountered + 1);
}
},
setPoniesEncountered : function(value){
this.poniesEncountered = value;
},
getText : function(){
var text = "";
for(var i = 0; i < quest.things.length; i++){
text += quest.things[i].text;
}
return text;
},
makeWoodPoney : function(){
return land.createMob("WPY", 12, 12, "hooves", "A wood poney ! It's a poney ! It the woods !", [drops.createDrop("candies", 42)]);
}
};

0
static/candies/scripts/poke.js Executable file
View File

493
static/candies/scripts/potions.js Executable file
View File

@ -0,0 +1,493 @@
var potions = {
// Variables
list : {},
// Functions
getCountdown : function(){
if(objects.list.magicianHat.have) return 12;
return 20;
},
onload : function(){
this.addPotion("health", "Health potion", "#ff0000", "potions.heal(50);", "Use this minor health potion during combats to regain some of your health points !", "potion");
this.addPotion("escape", "Escape potion", "#51c90f", "potions.escape();", "The escape potion allow escaping from a quest while avoiding any time penalty. It makes you flee really really fast !", "potion");
this.addPotion("berserk", "Berserk potion", "#000000", "potions.berserk();", "The berserk potions transforms you into a.. BERSERKEEEER !", "potion");
this.addPotion("fireScroll", "Fire scroll", "#dc3e00", "potions.fireScroll();", "This powerful fire scroll will burn your enemy if you use it during a fight.", "scroll");
this.addPotion("acidRainScroll", "Acid rain scroll", "#68980b", "potions.acidRainScroll();", "This acid rain scroll will instantly damage everyone in the whole land (including yourself).", "scroll");
this.addPotion("teleportScroll", "Teleport scroll", "#7ca0b5", "potions.teleportScroll();", "This teleport scroll will make you go back to the beginning of a quest. Useful to rest a little bit !", "scroll");
this.addPotion("earthquakeScroll", "Earthquake scroll", "#470b0b", "potions.earthquakeScroll();", "This earthquake scroll will inflict a lot of damage to everyone in the whole land.", "scroll");
this.addPotion("impInvocationScroll", "Imp invocation scroll", "#ff6600", "potions.impInvocationScroll();", "This imp invocation scroll will, if there's enough place, invoke in front of you an imp which will fight for you.", "scroll");
this.addPotion("majorHealth", "Major health potion", "#ff0000", "potions.heal(100);", "This major health potion is twice more efficient than the minor one.", "potion");
this.addPotion("invulnerability", "Invulnerability potion", "#ef893b", "potions.invulnerability();", "This invulnerability potion will make you invincible for some time, but it fills your stomach : you won't be able to drink another potion for a long time after using it.", "potion");
this.addPotion("turtle", "Turtle potion", "#008a13", "potions.turtle();", "When you drink a turtle potion, you become a turtle. Drawback : you walk slower. Benefit : you're way more resistant to your ennemies' attacks.", "potion");
this.addPotion("jelly", "Jelly", "#9500b5", "potions.jelly();", "This skillfully prepared jelly explodes on contact of anything trying to go through it, dealing high damage. Using it will place it behind you.", "special");
this.addPotion("seed", "Seed", "#3dab3a", "potions.seed();", "This seed is able to make grow a candy tree. The candy tree is made of candies, and it takes a lot of time to cut it down. Using the seed will grow a tree in front of you, if there's enough place.", "special");
this.addPotion("cloning", "Cloning potion", "#6d6d6d", "potions.cloning();", "This cloning potion will, well... clone you. Your clone will have the same health points as you when you drank the potion, but he won't have your armor nor your sword. He will fight using a \"cloned sword\", which deals a correct amount of damage. The clone will be placed in front of you, if there's enough place.", "potion");
this.addPotion("superman", "Superman potion", "#ddef17", "potions.superman();", "This superman potion will give you a cape and make you look like superman for the rest of the quest !", "potion");
this.addPotion("gmooh", "G.M.O.O.H. potion", "#ff00c0", "potions.gmooh();", "This \"Get Me Out Of Here\" potion will teleport you somewhere else. The destination isn't predictable at all.", "potion");
},
updateOnPage : function(){
htmlInteraction.setInnerHtml("quest_potions", this.getText());
if(quest.weAreQuestingRightNow) this.updateCountdownOnPage();
},
updateCountdownOnPage : function(){
htmlInteraction.setInnerHtml("quest_potions_countdowns", this.getCountdownText());
},
getCountdownText : function(){
var text = "";
// Potions
if(quest.berserk) text += "Berserk mode: " + quest.berserkCountdown + "\n";
if(quest.turtle) text += "You're a turtle: " + quest.turtleCountdown + "\n";
if(quest.invulnerability) text += "Invincible: " + quest.invulnerabilityCountdown + "\n";
if(this.list.health.shown || this.list.escape.shown || this.list.berserk.shown || this.list.majorHealth.shown || this.list.invulnerability.shown || this.list.turtle.shown || this.list.cloning.shown || this.list.superman.shown || this.list.gmooh.shown) text += "Potion countdown : " + quest.potionUseCountdown + "\n";
// Scrolls
if(this.list.fireScroll.shown || this.acidRainScroll.shown || this.teleportScroll.shown || this.earthquakeScroll.shown || this.impInvocationScroll.shown) text += "Scroll countdown : " + quest.scrollUseCountdown;
return text;
},
getText : function(){
var text = "";
// Special stuff
text += this.getPotionButtonText(this.list.seed);
text += this.getPotionButtonText(this.list.jelly);
text += "\n";
// Potions
text += this.getPotionButtonText(this.list.health);
text += this.getPotionButtonText(this.list.escape);
text += this.getPotionButtonText(this.list.berserk);
text += "\n";
// Potions bis !
text += this.getPotionButtonText(this.list.majorHealth);
text += this.getPotionButtonText(this.list.turtle);
text += this.getPotionButtonText(this.list.invulnerability);
text += this.getPotionButtonText(this.list.superman);
text += this.getPotionButtonText(this.list.cloning);
text += this.getPotionButtonText(this.list.gmooh);
text += "\n";
// Scrolls
text += this.getPotionButtonText(this.list.fireScroll);
text += this.getPotionButtonText(this.list.acidRainScroll);
text += this.getPotionButtonText(this.list.teleportScroll);
text += this.getPotionButtonText(this.list.impInvocationScroll);
text += this.getPotionButtonText(this.list.earthquakeScroll);
return text;
},
getPotions : function(potion, nbr){
this.setPotionShown(potion, true);
potion.nbrOwned += nbr;
this.updateOnPage();
},
setPotionShown : function(potion, value){
potion.shown = value;
},
setPotionNbrOwned : function(potion, value){
potion.nbrOwned = value;
},
buyPotion : function(potion, price){
this.getPotions(potion, 1);
candies.setNbrOwned(candies.nbrOwned - price);
shop.setMerchantSpeech(potion.merchantSpeech);
},
buyScroll : function(price){
var maxPower = 2;
if(objects.list.magicianHat.have) maxPower = 4;
switch(random.getRandomIntUpTo(maxPower)){
case 0:
this.buyPotion(this.list.fireScroll, price);
break;
case 1:
this.buyPotion(this.list.acidRainScroll, price);
break;
case 2:
this.buyPotion(this.list.teleportScroll, price);
break;
case 3:
this.buyPotion(this.list.impInvocationScroll, price);
break;
case 4:
this.buyPotion(this.list.earthquakeScroll, price);
break;
}
},
getPotionButtonText : function(potion){
if(potion.shown){
var disabled = "";
var tooltip = "";
if(quest.weAreQuestingRightNow == false || potion.nbrOwned <= 0 || ((potion.type == "potion" && quest.potionUseCountdown > 0) || (potion.type == "scroll" && quest.scrollUseCountdown > 0))) disabled = "disabled=disabled";
if(quest.weAreQuestingRightNow == false) tooltip = "<span>" + potion.merchantSpeech + "</span>";
return "<button class=\"tooltip potion_quest_button\" style=\"border: 2px solid " + potion.buttonColor + "; padding: 2px 5px;\" " + disabled + " onclick=\"" + potion.action + "\"><b>" + potion.nbrOwned + "</b> " + potion.buttonText + tooltip + "</button>\n";
}
return "";
},
addPotion : function(name, buttonText, buttonColor, action, merchantSpeech, type){
this.list[name] = {buttonText:buttonText, buttonColor:buttonColor, action:action, shown:false, nbrOwned:0, merchantSpeech:merchantSpeech, type:type};
},
makeJelly : function(){
return land.createTrap("JEL", 1, 1, "powerful explosion", "A jelly !! Go away !", []);
},
makeClone : function(hp, max_hp){
return land.createAlly("\\o/", max_hp, hp, "cloned sword", "A clone of you.", []);
},
makeCandyTree : function(){
var hp = 0;
// One chance out of 100 to spawn the Yggdrasil \o/
if(random.oneChanceOutOf(100)){
return land.createTrap("/Y\\", 10000, 10000, "none", "Yggdrasill is its name, a tall tree, showered with shining loam.", [drops.createDrop("candies", 10000)]);
}
else{
hp = 500 + 100 * random.getRandomIntUpTo(4); // 500 / 600 / 700 / 800 / 900
return land.createTrap("\\|/", hp, hp, "none", "A candy tree. I hope you're carrying a good axe.", []);
}
},
heal : function(howMuch){
// We get the character index
var id = quest.getCharacterIndex();
if(quest.things[id].hp > 0 && ((howMuch == 50 && this.list.health.nbrOwned > 0) || (howMuch == 100 && this.list.majorHealth.nbrOwned > 0))){
// We decrement nbrOwned
if(howMuch == 50)
this.list.health.nbrOwned -= 1;
else if(howMuch == 100)
this.list.majorHealth.nbrOwned -= 1;
// We increment hp
quest.things[id].hp += howMuch;
// We set hp = max_hp if hp > max_hp
if(quest.things[id].hp > quest.things[id].max_hp){
quest.things[id].hp = quest.things[id].max_hp;
}
// We set the countdown
quest.potionUseCountdown += this.getCountdown();
// We update the quest and the potions on page
quest.updateOnPage();
this.updateOnPage();
}
},
escape : function(){
if(this.list.escape.nbrOwned > 0){
// We decrement nbrOwned
this.list.escape.nbrOwned -= 1;
// We tell the quest that we escape
quest.escaping = true;
// We delete all tired time
quest.setTiredTime(0);
quest.setTiredFound(0);
// We update the quest and the potions on page
quest.updateOnPage();
this.updateOnPage();
}
},
berserk : function(){
if(this.list.berserk.nbrOwned > 0){
// We decrement nbrOwned
this.list.berserk.nbrOwned -= 1;
// We set the countdown
quest.potionUseCountdown += this.getCountdown();
// We tell the quest that we are now in berserk mode
quest.beginBerserk();
// We update the quest and the potions on page
quest.updateOnPage();
this.updateOnPage();
}
},
fireScroll : function(){
if(this.list.fireScroll.nbrOwned > 0){
// We decrement nbrOwned
this.list.fireScroll.nbrOwned -= 1;
// We set the countdown
quest.scrollUseCountdown += this.getCountdown();
// We burn the enemy !
var index = quest.getCharacterIndex();
index += 1; // We set the index to look just in front of the player
if(quest.things[index].type == "mob"){ // If it's a mob
quest.things[index].hp -= 25 + random.getRandomIntUpTo(10);
if(quest.things[index].hp < 0) quest.things[index] = quest.makeNoneThing();
}
// We update the quest and the potions on page
quest.updateOnPage();
this.updateOnPage();
}
},
acidRainScroll : function(){
if(yourself.end == false && this.list.acidRainScroll.nbrOwned > 0){
// We decrement nbrOwned
this.list.acidRainScroll.nbrOwned -= 1;
// We set the countdown
quest.scrollUseCountdown += this.getCountdown();
// We burn everyone
for(var i = 0; i < quest.things.length; i++){
if(quest.things[i].type == "mob" || quest.things[i].type == "character"){
quest.things[i].hp -= 6;
if(quest.things[i].type == "character" && quest.things[i].hp <= 0) quest.things[i].hp = 1;
if(quest.things[i].hp < 0) quest.things[i] = quest.makeNoneThing();
}
}
// We update the quest and the potions on page
quest.updateOnPage();
this.updateOnPage();
}
},
teleportScroll : function(){
// If we're not already at index 0
if(quest.things[0].type != "character" && this.list.teleportScroll.nbrOwned > 0){
// We decrement nbrOwned
this.list.teleportScroll.nbrOwned -= 1;
// We set the countdown
quest.scrollUseCountdown += this.getCountdown();
// We teleport !
var index = quest.getCharacterIndex();
quest.things[0] = quest.things[index];
quest.things[index] = quest.makeNoneThing();
// We update the quest and the potions on page
quest.updateOnPage();
this.updateOnPage();
}
},
earthquakeScroll : function(){
if(yourself.end == false && this.list.earthquakeScroll.nbrOwned > 0){
// We decrement nbrOwned
this.list.earthquakeScroll.nbrOwned -= 1;
// We set the countdown
quest.scrollUseCountdown += this.getCountdown();
// We hit everyone
for(var i = 0; i < quest.things.length; i++){
if(quest.things[i].type == "mob" || quest.things[i].type == "character"){
quest.things[i].hp -= 12;
if(quest.things[i].type == "character" && quest.things[i].hp <= 0) quest.things[i].hp = 1;
if(quest.things[i].hp < 0) quest.things[i] = quest.makeNoneThing();
}
}
// We update the quest and the potions on page
quest.updateOnPage();
this.updateOnPage();
}
},
impInvocationScroll : function(){
var index = quest.getCharacterIndex();
// If the character isn't at the end of the land and there's nothing in front of him
if(index < quest.things.length-1 && quest.things[index+1].type == "none" && this.list.impInvocationScroll.nbrOwned > 0){
// We decrement nbrOwned
this.list.impInvocationScroll.nbrOwned -= 1;
// We set the countdown
quest.scrollUseCountdown += this.getCountdown();
// We invoke an int
quest.things[index+1] = quest.makeImp();
// We update the quest and the potions on page
quest.updateOnPage();
this.updateOnPage();
}
},
invulnerability : function(){
if(this.list.invulnerability.nbrOwned > 0){
// We decrement nbrOwned
this.list.invulnerability.nbrOwned -= 1;
// We set the countdown (40 ! because this potion is too awesome)
quest.potionUseCountdown += 40;
// We tell the quest that we are now in berserk mode
quest.beginInvulnerability();
// We update the quest and the potions on page
quest.updateOnPage();
this.updateOnPage();
}
},
turtle : function(){
if(this.list.turtle.nbrOwned > 0){
// We decrement nbrOwned
this.list.turtle.nbrOwned -= 1;
// We set the countdown
quest.potionUseCountdown += this.getCountdown();
// We tell the quest that we are now in berserk mode
quest.beginTurtle();
// We update the quest and the potions on page
quest.updateOnPage();
this.updateOnPage();
}
},
jelly : function(){
// We get the character index
var index = quest.getCharacterIndex();
// If the character isn't at the beginning of the land and there's nothing behind the character
if(index != 0 && quest.things[index - 1].type == "none" && this.list.jelly.nbrOwned > 0){
// We decrement nbrOwned
this.list.jelly.nbrOwned -= 1;
// We place a jelly
quest.things[index-1] = this.makeJelly();
// We update the quest and the potions on page
quest.updateOnPage();
this.updateOnPage();
}
},
seed : function(){
// We get the character index
var index = quest.getCharacterIndex();
// If the character isn't at the end of the land and there's nothing in front of the character
if(index < quest.things.length-1 && quest.things[index + 1].type == "none"){
// We decrement nbrOwned
this.list.seed.nbrOwned -= 1;
// We place a candy tree
quest.things[index+1] = this.makeCandyTree();
// We update the quest and the potions on page
quest.updateOnPage();
this.updateOnPage();
}
},
cloning : function(){
// We get the character index
var index = quest.getCharacterIndex();
// If the character isn't at the beginning of the land and there's nothing in front of the character
if(index != 0 && index < quest.things.length-1 && quest.things[index + 1].type == "none" && this.list.cloning.nbrOwned > 0){
// We decrement nbrOwned
this.list.cloning.nbrOwned -= 1;
// We set the countdown
quest.potionUseCountdown += 100;
// We place a clone
quest.things[index+1] = this.makeClone(quest.things[index].hp, quest.things[index].max_hp);
// We update the quest and the potions on page
quest.updateOnPage();
this.updateOnPage();
}
},
superman : function(){
if(this.list.superman.nbrOwned > 0){
// We get the character's index
var index = quest.getCharacterIndex();
// We decrement nbrOwned
this.list.superman.nbrOwned -= 1;
// We set the countdown
quest.potionUseCountdown += this.getCountdown();
// We change the character text
quest.things[index].text = "(o-";
// We update the quest and the potions on page
quest.updateOnPage();
this.updateOnPage();
}
},
gmooh : function(){
if(this.list.gmooh.nbrOwned > 0){
// We tell the quest that we're using a gmooh potion, then when quest.move will be executed, our gmoohEffect() function will be called
quest.gmooh = true;
// We delete all tired time
quest.setTiredTime(0);
quest.setTiredFound(0);
// We update the quest and the potions on page
quest.updateOnPage();
this.updateOnPage();
}
},
// When this function is called, quest.stop() was done just before, so we can launch a new quest if we want ;)
gmoohEffect : function(){
// We decrement nbrOwned
this.list.gmooh.nbrOwned -= 1;
quest.setTiredTime(0);
switch(random.getRandomIntUpTo(3)){
case 0:
quest.begin(false, land.getLandIndexFromName("The peaceful forest"));
break;
case 1:
quest.begin(false, land.getLandIndexFromName("cowLevel"));
break;
case 2:
quest.begin(false, land.getLandIndexFromName("sea"));
break;
case 3:
quest.begin(false, land.getLandIndexFromName("desert"));
break;
}
}
};

476
static/candies/scripts/quest.js Executable file
View File

@ -0,0 +1,476 @@
var quest = {
// Variables
currentLandIndex : 0, // Index of the current land in land.list
maxLandOrder : -1, // Max land order we achieved for the moment
candiesFound : 0, // Number of candies found during a quest
speed : 0, // Speed of the character during a quest
things : [], // Array containing all the things present in a quest
tiredTime : 0, // Number of seconds we need to spend before doing another quest
tiredFound : 0, // Number of seconds we will need to wait after finishing the current quest
potionUseCountdown : 0, // Number of movements we have to wait before using another potion
scrollUseCountdown : 0, // Same thing for scrolls
escaping : false, // If true, it means we are escaping from the quest
gmooh : false,
berserk : false, // If true, we're in berserk mode
berserkCountdown : 0, // Number of cycles we still have to stay in berserk mode
invulnerability : false, // If true, we're invincible
invulnerabilityCountdown : 0, // Number of cycles we still have to stay as invincible
turtle : false, // If true, we're a turtle
turtleCountdown : 0, // Number of cycles we still have to stay as a turtle
weAreQuestingRightNow : false, // True if we're making a quest right now
characterSpeed : 1, // Speed of the character : if = 2 for example, the character will take two cycles to move. This variable can be reduce by being a turtle
characterSpeedStep : 1, // Used to apply the characterSpeed var
onloadAfter : function(){
this.setMaxLandOrder(0);
},
setMaxLandOrder : function(value){
if(value > this.maxLandOrder){
this.maxLandOrder = value; // We change the value
land.updateListOnPage(quest.maxLandOrder); // And we try to update the quest list on the html page, in case a new quest was unlocked
}
},
begin : function(getLandFromList, landIndex){
// Disable button
htmlInteraction.disableButton("quest_button");
// First thing to do !
this.weAreQuestingRightNow = true;
// If we have to get the land index from the list on the html page
if(getLandFromList == true){
// We get the index in land.list of the current land selected in the html list
var landNameInHtmlList = htmlInteraction.getElement("quest_destination").options[htmlInteraction.getElement("quest_destination").selectedIndex].text;
this.currentLandIndex = land.getLandIndexFromName(landNameInHtmlList);
}
// Else, we use the index given in the parameters
else{
this.currentLandIndex = landIndex;
}
// We show the quest panel
htmlInteraction.setElementVisibility("quest", true);
htmlInteraction.setElementVisibility("quest_potions_countdowns", true);
// We empty the things array and put none things in it
this.things = this.fillWithNoneThings();
// We add the character
if(land.ponyTime == false)
this.things[0] = {type:"character", text:"\\o/", max_hp:this.getCharacterMaxHp(), hp:this.getCharacterMaxHp(), weapon:(sword.name), description:"You"};
else
this.things[0] = {type:"character", text:"PON", max_hp:this.getCharacterMaxHp(), hp:this.getCharacterMaxHp(), weapon:(sword.name), description:"You"};
// We set the speed
this.speed = this.getSpeed();
// We set the potion & scroll use countdown
this.potionUseCountdown = 0;
this.scrollUseCountdown = 0;
// Not escaping at first
this.escaping = false;
// Not using gmooh potion at first
this.gmooh = false;
// Not in berserk mode at first
this.berserk = false;
this.berserkCountdown = 0;
this.speed = this.getSpeed();
// Not invincible at first
this.invulnerability = false;
this.invulnerabilityCountdown = 0;
// Not turtle at first
this.turtle = false;
this.turtleCountdown = 0;
// Speed = 1 at first and the step = 1 too
this.characterSpeed = 1;
this.characterSpeedStep = 1;
// Load the current land
land.load();
// Update the quest and the potions on page
this.updateOnPage();
potions.updateOnPage();
// Set a timeout for the next quest movement
window.setTimeout(this.move.bind(this), this.speed);
},
updateOnPage : function(){
// Variables declaration
var text;
// Land
text = land.getText();
text += "\n";
// Status
text += status2.getText();
text += "\n";
// Drops
text += drops.getText();
// Draw text
htmlInteraction.setInnerHtml("quest", text);
},
getCharacterMaxHp : function(){
return 100 + Math.floor(Math.pow(candies.nbrEaten, 0.4)*2.1); // This function means ~ one day of candies eaten at 1cnd/s = +200 hp
},
getSpeed : function(){
if(objects.list.boots.have && this.berserk) return 125;
if(objects.list.boots.have || this.berserk) return 250;
return 500;
},
getCharacterIndex : function(){
for(i = 0; i < this.things.length; i++){
if(this.things[i].type == "character") return i;
}
},
move : function(){
// If we're not escaping, we don't stop the quest
if(this.escaping == false && this.gmooh == false){
for(var index = 0; index < this.things.length; index++){
if(this.things[index].type == "character" || this.things[index].type == "ally" || this.things[index].type == "trap"){
// If we are at the end of the quest
if(index + 1 == this.things.length){
// If we're the character
if(this.things[index].type == "character"){
// We set a timeout to the winning function and we return
window.setTimeout(this.won.bind(this), 3000);
return;
}
// Else, we're just an ally or a trap
else{
// We disappear
quest.things[index] = quest.makeNoneThing();
}
}
// Else, we move ourselves
else{
// If there's nothing in front of us and we're not a trap, we just move
if(this.things[index].type != "trap" && this.things[index + 1].type == "none"){
if(this.characterSpeedStep >= this.characterSpeed){
this.characterSpeedStep = 1; // We set the step back to 1
this.things[index + 1] = this.things[index];
this.things[index] = this.makeNoneThing();
index += 1; // We increment the index to avoid re evaluating the same thing just after
}
else{
this.characterSpeedStep += 1; // We increment the step
}
}
// Else, we try to fight
else{
// If the thing in front of us is a mob or a trap (and we're not one..), we fight
if(this.things[index + 1].type == "mob" || (this.things[index + 1].type == "trap" && this.things[index].type != "trap")){
if(this.fight(index, index + 1) == true) return;
}
}
}
}
}
// We set the timeout to move again
window.setTimeout(this.move.bind(this), this.speed);
// We decrement the potion use countdown
if(this.potionUseCountdown > 0){
this.potionUseCountdown -= 1;
if(this.potionUseCountdown == 0){
potions.updateOnPage();
}
else potions.updateCountdownOnPage();
}
// Same thing for the scroll use countdown
if(this.scrollUseCountdown > 0){
this.scrollUseCountdown -= 1;
if(this.scrollUseCountdown == 0){
potions.updateOnPage();
}
else potions.updateCountdownOnPage();
}
// We decrement the berserk mode countdown
if(this.berserkCountdown > 0){
this.berserkCountdown -= 1;
if(this.berserkCountdown == 0) this.stopBerserk();
potions.updateCountdownOnPage();
}
// We decrement the invulnerability mode countdown
if(this.invulnerabilityCountdown > 0){
this.invulnerabilityCountdown -= 1;
if(this.invulnerabilityCountdown == 0) this.stopInvulnerability();
potions.updateCountdownOnPage();
}
// We decrement the turtle mode countdown
if(this.turtleCountdown > 0){
this.turtleCountdown -= 1;
if(this.turtleCountdown == 0) this.stopTurtle();
potions.updateCountdownOnPage();
}
// We make the land move too
if(land.list[this.currentLandIndex].moveFunction != undefined){
land.list[this.currentLandIndex].moveFunction();
}
// Horn bonus
if(objects.list.magicalHorn.have){
this.applyMagicalHornBonus();
}
// We update on page
this.updateOnPage();
}
// Else we're escaping : we stop the quest
else if(this.escaping){
this.stop();
}
// Else if we're using a gmooh potion
else if(this.gmooh){
this.stop();
potions.gmoohEffect();
}
},
applyMagicalHornBonus : function(){
var index = this.getCharacterIndex();
// If we're not dead
if(this.things[index].hp > 0){
this.things[index].hp += 3;
if(this.things[index].hp > this.things[index].max_hp) this.things[index].hp = this.things[index].max_hp;
}
},
fight : function(index1, index2){
// We launch a fight between us and the mob if the mob still have some hp (he may lose its hp because of a scroll)
if(this.things[index2].hp > 0) damage.makeTwoQuestThingsFighting(index1, index2);
// Check for deads
if(this.checkIfDead(index1, index2) == true) return true;
if(this.checkIfDead(index2, index1) == true) return true;
return false;
},
checkIfDead : function(index, indexKiller){
// If we're dead
if(this.things[index].hp <= 0){
// If we're the character
if(this.things[index].type == "character"){
this.updateOnPage(); // We update on page
window.setTimeout(this.stop.bind(this), 5000); // We set the timeout to stop the quest
return true; // We quit
}
// Else, we're just an ally or a trap
else if(this.things[index].type == "ally" || this.things[index].type == "trap"){
// We disappear
if(this.things[index].drops != []) drops.getAllDropsFromList(this.things[index].drops); // We gain the drops of the defeated ally or trap
quest.things[index] = quest.makeNoneThing();
}
// Else, we're a mob
else if(this.things[index].type == "mob" && (this.things[index].text != "\\o/" || yourself.canSurpass == true)){
drops.getAllDropsFromList(this.things[index].drops); // We gain the drops of the defeated mob
this.things[index] = this.makeNoneThing(); // We remove the mob
// If we we were killed by the character
if(this.things[indexKiller].type == "character"){
// Sword of Summoning bonus : we may spawn something here
if(sword.name == "Sword of Summoning" || sword.name == "Sword of Liflamesummoning"){
sword.summonHere(index);
}
// Sword of Life : we gain life
if(sword.name == "Sword of Life" || sword.name == "Sword of Liflamesummoning"){
this.things[indexKiller].hp += sword.specialPower + 1;
if(this.things[indexKiller].hp > this.things[indexKiller].max_hp) this.things[indexKiller].hp = this.things[indexKiller].max_hp;
}
}
}
}
return false;
},
beginBerserk : function(){
this.berserk = true;
this.berserkCountdown = 25 + random.getRandomIntUpTo(10);
this.speed = this.getSpeed();
this.things[this.getCharacterIndex()].text = "O_O";
},
stopBerserk : function(){
this.berserk = false;
this.speed = this.getSpeed();
this.things[this.getCharacterIndex()].text = "\\o/";
},
beginInvulnerability : function(){
this.invulnerability = true;
this.invulnerabilityCountdown = 15;
this.things[this.getCharacterIndex()].text = "GOD";
},
stopInvulnerability : function(){
this.invulnerability = false;
this.things[this.getCharacterIndex()].text = "\\o/";
},
beginTurtle : function(){
this.turtle = true;
this.turtleCountdown = 30;
this.things[this.getCharacterIndex()].text = "TUR";
this.characterSpeed = 3; // We reduce the speed !
},
stopTurtle : function(){
this.turtle = false;
this.things[this.getCharacterIndex()].text = "\\o/";
this.characterSpeed = 1; // The speed goes back to its normal state !
},
won : function(){
// won ?
if(land.getLandIndexFromName("Developper's computer") == quest.currentLandIndex){
developperComputer.setWon(true);
inventory.updateOnPage();
}
// Drops
drops.gainDrops();
// We may enable a new destination, we store the drop-down list
var list = htmlInteraction.getElement("quest_destination");
// We change the max land order : it's the order of the just finnished quest + 1
this.setMaxLandOrder(land.list[this.currentLandIndex].order + 1);
// We stop the quest
this.stop();
},
stop : function(){
// Enable button
htmlInteraction.enableButton("quest_button");
// First thing to do !
this.weAreQuestingRightNow = false;
// Get the character index
var index = this.getCharacterIndex();
// No more quest panel or potions shown
htmlInteraction.setInnerHtml("quest", "");
htmlInteraction.setInnerHtml("quest_potions_countdowns", "");
// We re-enable home buttons
//buttons.enableHomeButtons();
// We update the potions on page
potions.updateOnPage();
// We're tired after this quest
if(this.things[index].hp < this.things[index].max_hp) this.setTiredFound(this.tiredFound + 200 * (1 - (this.things[index].hp / this.things[index].max_hp)));
if(this.escaping == false) this.setTiredTime(Math.floor(this.tiredFound));
// Nothing found anymore
this.setCandiesFound(0);
this.setTiredFound(0);
for(obj in objects.list) objects.list[obj].found = false;
},
defineMood : function(){
if(this.tiredTime == 0) htmlInteraction.setInnerHtml("mood", "You're all set! Ready for fighting!");
else htmlInteraction.setInnerHtml("mood", "You're tired. You have to wait before doing another quest. <b>Waiting time: <span style=\"color:#79ad36\">" + this.tiredTime + "</span></b><br/><br/>");
htmlInteraction.setElementVisibility("mood", true);
},
setCandiesFound : function(value){
this.candiesFound = value;
},
setTiredTime : function(value){
if(value < 0) value = 0;
this.tiredTime = value;
this.defineMood();
buttons.checkQuestTiredTime();
},
setTiredFound : function(value){
this.tiredFound = value;
},
makeNoneThing : function(){
return {type:"none", text:"___"};
},
makeBasicChest : function(){
return land.createMob("CHS", 80, 80, "none", "A chest! Very rare.", [drops.createDrop("candies", 300 + random.getRandomIntUpTo(500)), drops.createDrop("object", "key", true), drops.createDrop("object", "boots", random.oneChanceOutOf(3)), drops.createDrop("object", "swampMap", random.oneChanceOutOf(3)), drops.createDrop("object", "hutMap", random.oneChanceOutOf(3))]);
},
makeOpenChest : function(){
return land.createMob("CHS", 1, 1, "none", "An open chest, full of candies!", [drops.createDrop("candies", 6000 + random.getRandomIntUpTo(2000))]);
},
makeImp : function(){
var hp = 15 + random.getRandomIntUpTo(10);
return land.createAlly("IMP", hp, hp, "its whole body", "An imp.", []);
},
makeOrc : function(){
return land.createAlly("ORC", 30, 30, "bludgeon", "An orc. It looks stupid.", []);
},
makeDraugr : function(){
return land.createAlly("DRG", 35, 35, "various bones", "A draugr. It seems to be dead, but it's still moving..", []);
},
makeChupacabra : function(){
return land.createAlly("CBA", 30, 30, "fangs", "A chupacabra. A real goat sucker!", []);
},
makeGolem : function(){
return land.createAlly("GOL", 100, 100, "rock", "A golem. Solid, solid golem.", []);
},
makeChimera : function(){
var hp = 50 + random.getRandomIntUpTo(7);
return land.createAlly("CHI", hp, hp, "fire", "A chimera: lion, serpent and goat at the same time.", []);
},
makeCandyMonster : function(){
var hp = 80 + 5*sword.specialPower;
return land.createAlly("CND", hp, hp, "exploding candies", "A candy monster. He throws candies on his enemies.", []);
},
makeFakeCharacter : function(){
return land.createFakeCharacter();
},
fillWithNoneThings : function(){
var things = [];
for(var i = 0; i < land.list[this.currentLandIndex].size; i++) things.push(this.makeNoneThing());
return things;
}
};

View File

@ -0,0 +1,43 @@
var random = {
flipACoin : function(){
if(Math.random() < 0.5) return true;
return false;
},
oneChanceOutOf : function(n){
if(this.getRandomIntUpTo(n - 1) == 0) return true;
else return false;
},
getRandomFloat : function(){
return Math.random();
},
pickRandomly : function(array){
return array[Math.floor(Math.random()*array.length)];
},
getRandomIntUpTo : function(n){
return Math.floor(Math.random()*(n+1));
},
getRandomLetter : function(){
var possible = "abcdefghijklmnopqrstuvwxyz";
return possible.charAt(Math.floor(this.getRandomFloat() * possible.length));
},
pure : function(){
return Math.floor(Math.pow(10, random.getRandomIntUpTo(100)) * random.getRandomFloat());
},
pure2 : function(){
switch(random.getRandomIntUpTo(2)){
case 0: return Math.floor(Math.pow(10, random.getRandomIntUpTo(100)) * random.getRandomFloat()); break;
case 1: return -Math.floor(Math.pow(10, random.getRandomIntUpTo(100)) * random.getRandomFloat()); break;
case 2: return "bug"; break;
}
},
};

114
static/candies/scripts/save.js Executable file
View File

@ -0,0 +1,114 @@
var code = "";
function save() {
$.ajax({
type: "POST",
url: "scripts/save.php",
data: {
swordName : sword.name,
swordSpecialSword : sword.specialSword,
swordSpecialPower : sword.specialPower,
candiesNbrOwned : candies.nbrOwned,
candiesNbrThrown : candies.nbrThrown,
candiesNbrEaten : candies.nbrEaten,
candiesNbrTotal : candies.nbrTotal,
candiesCandiesPerSecond : candies.candiesPerSecond,
candiesConverterActivated : candiesConverter.activated,
cauldronBookPage : cauldron.bookPage,
cauldronCandies : cauldron.candiesInTheCauldron,
cauldronLollipops : cauldron.lollipopsInTheCauldron,
chocolateBarsNbrOwned : chocolateBars.nbrOwned,
farmLollipopsPlanted : farm.lollipopsPlanted,
farmCurrentFlagIndex : farm.currentFlagIndex,
farmPlantingButtonsStep : farm.plantingButtonsStep,
forgeStep : forge.step,
shopLollipopsButtonsShown : shop.buy10LollipopsButtonShown,
shopShown : shop.shown,
shopTicklingStep : shop.ticklingStep,
shopClickingOnLollipopStep : shop.clickingOnLollipopStep,
hutStep : hut.step,
hutSpeech : hut.speech,
inventoryMagicianHatLetter : inventory.magicianHatLetter,
lollipopsNbrOwned : lollipops.nbrOwned,
lollipopsNbrInStock : lollipops.nbrInStock,
lollipopsNbrBought : lollipops.nbrBought,
mainNbrOfSecondsSinceLastMinInterval : main.nbrOfSecondsSinceLastMinInterval,
mainNbrOfSecondsSinceLastHourInterval : main.nbrOfSecondsSinceLastHourInterval,
mainNbrOfSecondsSinceLastDayInterval : main.nbrOfSecondsSinceLastDayInterval,
mountGoblinBasicChestProbability : mountGoblin.basicChestProbability,
peacefulForestBasicChestProbability : peacefulForest.basicChestProbability,
peacefulForestPoniesEncountered : peacefulForest.poniesEncountered,
objectsHaveObjectKey : objects.list.key.have,
objectsHaveObjectHutMap : objects.list.hutMap.have,
objectsHaveObjectWellMap : objects.list.wellMap.have,
objectsHaveObjectSwampMap : objects.list.swampMap.have,
objectsHaveObjectBoots : objects.list.boots.have,
objectsHaveObjectMagicianHat : objects.list.magicianHat.have,
objectsHaveObjectPinkRing : objects.list.pinkRing.have,
objectsHaveObjectForgeMap : objects.list.forgeMap.have,
objectsHaveObjectCandiesConverter : objects.list.candiesConverter.have,
objectsHaveObjectPlateArmour : objects.list.plateArmour.have,
objectsHaveObjectCauldron : objects.list.cauldron.have,
objectsHaveObjectMagicalHorn : objects.list.magicalHorn.have,
objectsHaveObjectHornOfPlenty : objects.list.hornOfPlenty.have,
objectsHaveObjectOldAmulet : objects.list.oldAmulet.have,
potionsShownHealth : potions.list.health.shown,
potionsShownEscape : potions.list.escape.shown,
potionsShownBerserk : potions.list.berserk.shown,
potionsShownFireScroll : potions.list.fireScroll.shown,
potionsShownAcidRainScroll : potions.list.acidRainScroll.shown,
potionsShownTeleportScroll : potions.list.teleportScroll.shown,
potionsShownEarthquakeScroll : potions.list.earthquakeScroll.shown,
potionsShownImpInvocationScroll : potions.list.impInvocationScroll.shown,
potionsShownMajorHealth : potions.list.majorHealth.shown,
potionsShownInvulnerability : potions.list.invulnerability.shown,
potionsShownTurtle : potions.list.turtle.shown,
potionsShownJelly : potions.list.jelly.shown,
potionsShownSeed : potions.list.seed.shown,
potionsShownCloning : potions.list.cloning.shown,
potionsShownSuperman : potions.list.superman.shown,
potionsShownGmooh : potions.list.gmooh.shown,
potionsNbrOwnedHealth : potions.list.health.nbrOwned,
potionsNbrOwnedEscape : potions.list.escape.nbrOwned,
potionsNbrOwnedBerserk : potions.list.berserk.nbrOwned,
potionsNbrOwnedFireScroll : potions.list.fireScroll.nbrOwned,
potionsNbrOwnedAcidRainScroll : potions.list.acidRainScroll.nbrOwned,
potionsNbrOwnedTeleportScroll : potions.list.teleportScroll.nbrOwned,
potionsNbrOwnedEarthquakeScroll : potions.list.earthquakeScroll.nbrOwned,
potionsNbrOwnedImpInvocationScroll : potions.list.impInvocationScroll.nbrOwned,
potionsNbrOwnedMajorHealth : potions.list.majorHealth.nbrOwned,
potionsNbrOwnedInvulnerability : potions.list.invulnerability.nbrOwned,
potionsNbrOwnedTurtle : potions.list.turtle.nbrOwned,
potionsNbrOwnedJelly : potions.list.jelly.nbrOwned,
potionsNbrOwnedSeed : potions.list.seed.nbrOwned,
potionsNbrOwnedCloning : potions.list.cloning.nbrOwned,
potionsNbrOwnedSuperman : potions.list.superman.nbrOwned,
potionsNbrOwnedGmooh : potions.list.gmooh.nbrOwned,
questMaxLandOrder : quest.maxLandOrder,
questTiredTime : quest.tiredTime,
spellsFasterCandiesFibo1 : spells.fasterCandiesFiboPrev,
spellsFasterCandiesFibo2 : spells.fasterCandiesFiboCurr,
swampStep : swamp.step,
tabsAnimation : tabs.animation,
wishingWellSpeech : wishingWell.speech,
wishingWellStep : wishingWell.step,
yourselfCanSurpass : yourself.canSurpass,
developperComputerWon : developperComputer.won
},
success: function(msg){
if(msg=="error"){
alert("There was a problem while saving. Please go nicely bother Scrabble or try again later. :-(");
$("span#save").html("");
}else{
code = msg.substring(0,5);
alert('You saved successfully under the code "' + msg + '". Write this down somewhere, you will need it later!');
$("span#save").html("&nbsp;&nbsp;&nbsp;&nbsp;You can also bookmark <a href=\"/index.php?pass=" + code + "\">this link</a> to load the save.");
}
}
});
return false;
}

68
static/candies/scripts/sea.js Executable file
View File

@ -0,0 +1,68 @@
var sea = {
// Variables
size : 25,
// Functions
onload : function(){
land.addLand("sea", this.size, -1, this.load.bind(this), this.getText.bind(this));
},
load : function(){
},
getText : function(){
// Get the character position
var index = quest.getCharacterIndex();
// Create the text
var text = " \"The sea\"\n\n\n";
for(var i = 0; i < index; i++){
text += " ";
}
text += " _\n";
for(var i = 0; i < index; i++){
text += " ";
}
text += " /|\\\n";
for(var i = 0; i < index; i++){
text += " ";
}
text += " /_|_\\\n";
for(var i = 0; i < index; i++){
text += " ";
}
text += " ____|\\o/_\n";
for(var i = 0; i < index; i++){
text += " ";
}
text += " \\_______/\n";
for(var i = 0; i < this.size + 2; i++){
text += " ~ ";
}
text += "\n ";
for(var i = 0; i < this.size + 1; i++){
text += " ~ ";
}
return text;
}
/*
_
/|\
/_|_\
____|\o/_
\_______/
*/
};

183
static/candies/scripts/shop.js Executable file
View File

@ -0,0 +1,183 @@
var shop = {
// Variables
buy10LollipopsButtonShown : false, // True if the buy 10 lollipops button should be shown
shown : false, // True if the shop is currently shown
ticklingStep : 0, // Tickling step (increase when we click on the merchant's hat
clickingOnLollipopStep : 0, // Clicking on lollipop step (increase when we clicked on the top of the lollipop sold at the shop)
oneLollipopPrice : 0, // Price of one lollipop, calculated depending on the clicking on lollipop step
tenLollipopsPrice : 0, // Price of ten lollipops, calculated the same way as above
currentSwordButtonId : "none", // Contains the id of the current sword buying button
currentSwordPrice : 0, // Contains the price of the current sword being sold by the merchant
// Functions
onload : function(){
lollipops.delivery(); // The merchant must have some lollipops in stock at the beginning, so we make a delivery
this.setClickingOnLollipopStep(0); // This also set the lollipops price !
},
check : function(){
if(candies.nbrOwned >= this.oneLollipopPrice){
this.setShown(true);
}
if(candies.nbrOwned >= 100){
// If we don't have any sword and there's no sword to sell yet, we show the wooden sword
if(sword.name == "none" && this.currentSwordButtonId == "none"){
this.showProduct("wooden_sword");
}
}
},
setBuy10LollipopsButtonShown : function(value){
this.buy10LollipopsButtonShown = value;
},
clickedOnHat : function(){
switch(this.ticklingStep){
case 0:
this.setMerchantSpeech("Hey! You touched my hat!");
break;
case 1:
this.setMerchantSpeech("Stop that, stop that! You're tickling me!");
break;
case 2:
this.setMerchantSpeech("Hahahaha! I'm so ticklish!");
break;
case 3:
this.setMerchantSpeech("Listen, listen: I will give you 100 candies! But stop that please!");
candies.setNbrOwned(candies.nbrOwned + 100);
break;
}
this.setTicklingStep(this.ticklingStep + 1);
},
setTicklingStep : function(value){
this.ticklingStep = value;
},
setClickingOnLollipopStep : function(value){
this.clickingOnLollipopStep = value;
// Set the buttons value if the step is 0 or the price is reducing or is reduced
if(this.clickingOnLollipopStep <= 4){
this.oneLollipopPrice = 60;
this.tenLollipopsPrice = 500;
htmlInteraction.setInnerHtml("buy_1_lollipop", "Buy <b><span style=\"color:#79ad36\">1</span> lollipop</b> (<b><span style=\"color:#79ad36\">60</span> candies</b>)");
htmlInteraction.setInnerHtml("buy_10_lollipops", "Buy <b><span style=\"color:#79ad36\">10</span> lollipops</b> (<b><span style=\"color:#79ad36\">500</span> candies</b>)");
}
else if(this.clickingOnLollipopStep >= 5 && this.clickingOnLollipopStep < 15){
this.oneLollipopPrice = 60 - (this.clickingOnLollipopStep - 4);
this.tenLollipopsPrice = 500 - (this.clickingOnLollipopStep - 4) * 5;
htmlInteraction.setInnerHtml("buy_1_lollipop", "Buy <b><span style=\"color:#79ad36\">1</span> lollipop</b> (<b><span style=\"color:#79ad36\">" + this.oneLollipopPrice + "</span> candies</b>)");
htmlInteraction.setInnerHtml("buy_10_lollipops", "Buy <b><span style=\"color:#79ad36\">10</span> lollipops</b> (<b><span style=\"color:#79ad36\">" + this.tenLollipopsPrice + "</span> candies</b>)");
}
else{
this.oneLollipopPrice = 60 - (14 - 4);
this.tenLollipopsPrice = 500 - (14 - 4) * 5;
htmlInteraction.setInnerHtml("buy_1_lollipop", "Buy <b><span style=\"color:#79ad36\">1</span> lollipop</b> (<b><span style=\"color:#79ad36\">" + this.oneLollipopPrice + "</span> candies</b>)");
htmlInteraction.setInnerHtml("buy_10_lollipops", "Buy <b><span style=\"color:#79ad36\">10</span> lollipops</b> (<b><span style=\"color:#79ad36\">" + this.tenLollipopsPrice + "</span> candies</b>)");
}
},
clickedOnLollipop : function(){
this.setClickingOnLollipopStep(this.clickingOnLollipopStep + 1);
// Possibly change the merchant speech
switch(this.clickingOnLollipopStep){
case 1:
this.setMerchantSpeech("Hey! Don't touch the products!");
break;
case 2:
this.setMerchantSpeech("Seriously, don't touch this lollipop.");
break;
case 3:
this.setMerchantSpeech("Don't touch it! Other customers may lick it after that, that's gross!");
break;
case 4:
this.setMerchantSpeech("Stop now or I'll be forced to do something.");
break;
case 15:
this.setMerchantSpeech("I can't make a lower price... Please stop.");
break;
}
if(this.clickingOnLollipopStep >= 5 && this.clickingOnLollipopStep < 15){
this.setMerchantSpeech("Okay, okay, I'll lower the price, but stop touching it!");
}
},
showProduct : function(id){
switch(id){
// If it's a special product
case "wooden_sword":
htmlInteraction.setInnerHtml("sword_with_button", sword.asciiWoodenSwordWithButton);
this.currentSwordButtonId = "buy_wooden_sword";
this.currentSwordPrice = 100;
break;
case "copper_sword":
htmlInteraction.setInnerHtml("sword_with_button", sword.asciiCopperSwordWithButton);
this.currentSwordButtonId = "buy_copper_sword";
this.currentSwordPrice = 300;
break;
case "iron_sword":
htmlInteraction.setInnerHtml("sword_with_button", sword.asciiIronSwordWithButton);
this.currentSwordButtonId = "buy_iron_sword";
this.currentSwordPrice = 500;
break;
case "silver_sword":
htmlInteraction.setInnerHtml("sword_with_button", sword.asciiSilverSwordWithButton);
this.currentSwordButtonId = "buy_silver_sword";
this.currentSwordPrice = 1000;
break;
case "diamond_sword":
htmlInteraction.setInnerHtml("sword_with_button", sword.asciiDiamondSwordWithButton);
this.currentSwordButtonId = "buy_diamond_sword";
this.currentSwordPrice = 2000;
break;
// Else, we just show the html element corresponding to the received id
default:
htmlInteraction.setElementVisibility(id, true);
htmlInteraction.setElementDisplay(id, "block");
break;
}
},
show : function(){
// We show the shop
if(htmlInteraction.isElementVisible("shop") == false){ // If the shop isn't already visible
htmlInteraction.setElementVisibility("shop", true);
this.setMerchantSpeech(" Welcome to <b>Uncle Snake's Candy Emporium</b>! I would do anything for candies. My lollipops are delicious!");
}
// And the lollipop we can buy :)
this.showProduct("lollipop");
},
setShown : function(value){
// If the new value is true but it was false before, we show the shop
if(value == true && this.shown == false)
this.show();
// We change the value
this.shown = value;
},
hideProduct : function(id){
// If it's a special product
if(id == "sword"){
this.currentSwordButtonId = "none";
htmlInteraction.setInnerHtml("sword_with_button", "");
}
// Else
else{
htmlInteraction.setElementVisibility(id, false);
htmlInteraction.setElementDisplay(id, "none");
}
},
setMerchantSpeech : function(text){
htmlInteraction.setInnerHtml("merchant_speech", speech.makeSpeechFromText(text, 20, " "));
}
};

View File

@ -0,0 +1,47 @@
var speech = {
makeLineFromWords : function(words, size){
var line = words[0];
var length = words[0].length;
for(var i = 1; i < words.length; i++){
line += " " + words[i];
length += 1 + words[i].length;
}
var spaces = Math.floor((size - length)/2);
for(var i = 0; i < spaces; i++){
line = " " + line + " ";
length += 2;
}
if(length == (size-1)) line += " ";
return line;
},
makeSpeechFromText : function(text, size, spaces_add){
var words = text.split(" ");
var current_line_size = 0;
var current_line = [];
var final_text = "";
var a_line_has_been_added = false;
for(var i = 0; i < words.length; i++){
current_line_size += 1 + words[i].length;
if(current_line_size > size){ // If, with this word, the line is too big
if(a_line_has_been_added == true) final_text += spaces_add + " ";
final_text += this.makeLineFromWords(current_line, size) + "\n"; // We add the current line to the final text
a_line_has_been_added = true;
current_line_size = words[i].length;
current_line = [];
current_line.push(words[i]);
}
else{
current_line.push(words[i]);
}
}
if(current_line.length != 0){
if(a_line_has_been_added == true) final_text += spaces_add + " ";
final_text += this.makeLineFromWords(current_line, size);
}
return spaces_add + "\"" + final_text + "\"";
}
};

View File

@ -0,0 +1,97 @@
var spells = {
// Variables
list : [],
fasterCandiesFiboPrev : 1,
fasterCandiesFiboCurr : 2,
// Functions
onload : function(){
// We add the spells
this.addSpell("Candies, faster candies!", this.getFasterCandiesPrice.bind(this), this.fasterCandies.bind(this), "Congratulations! You will now gain more candies each second!", []);
this.addSpell("Candies, more candies!", this.getMoreCandiesPrice.bind(this), this.moreCandies.bind(this), "///", []);
this.addSpell("Sword, better sword!", this.getBetterSwordPrice.bind(this), this.betterSword.bind(this), "///", ["specialSword"]);
// We sort the list
this.sortListDependingOnPrice();
},
sortListDependingOnPrice : function(){
this.list.sort(this.priceSortFunction);
},
priceSortFunction : function(spellA, spellB){
var priceA = spellA.price();
var priceB = spellB.price();
if(priceA < priceB) return -1;
else if(priceB < priceA) return 1;
return 0;
},
getBetterSwordPrice : function(){
return Math.floor(Math.pow(sword.specialPower+1, 2.6)) * 10000;
},
getFasterCandiesPrice : function(){
return Math.pow(this.fasterCandiesFiboCurr, 2) * 10000;
},
addSpell : function(name, price, effect, speech, conditions){
this.list.push({name:name, price:price, effect:effect, speech:speech, conditions:conditions});
},
getMoreCandiesPrice : function(){
return 300000;
},
betterSword : function(){
sword.setSpecialPower(sword.specialPower + 1);
this.sortListDependingOnPrice();
// And we change the hut's speech by ourselves
switch(sword.name){
case "Sword of Life":
hut.setSpeech("Your <b><span style=\"color:#79ad36\">Sword of Life</span></b> will now drain more energy from your enemies.");
break;
case "Sword of Flames":
hut.setSpeech("Your <b><span style=\"color:#79ad36\">Sword of Flames</span></b> is now more powerful.")
break;
case "Sword of Summoning":
hut.setSpeech("You can now summon <b><span style=\"color:#79ad36\">" + sword.summonList[sword.getIndexOfBetterToSummon()].name + "</span></b>!");
break;
}
},
moreCandies : function(){
var nbr = Math.floor(candies.nbrTotal/20);
// We can't gain more candies than the price we pay for the spell !
if(nbr > 300000) nbr = 300000;
candies.setNbrOwned(candies.nbrOwned + nbr);
hut.setSpeech("Here's <b><span style=\"color:#79ad36\">" + nbr + "</span> candies</b> for you!");
},
nextFasterCandiesFiboStep : function(){
this.setFasterCandiesFibo(this.fasterCandiesFiboCurr, this.fasterCandiesFiboPrev + this.fasterCandiesFiboCurr);
},
setFasterCandiesFibo : function(prev, curr){
// Set the new values
this.fasterCandiesFiboPrev = prev;
this.fasterCandiesFiboCurr = curr;
// Sort the spells list depending on their price, since the price of the faster candies spell just changed
this.sortListDependingOnPrice();
},
fasterCandies : function(){
// We change candies per second
candies.setCandiesPerSecond(this.fasterCandiesFiboCurr);
// We continue fibo
this.nextFasterCandiesFiboStep();
}
};

View File

@ -0,0 +1,66 @@
var status2 = {
getText : function(){
var statusLines = [];
var character = this.getLinesFromThingIndex(quest.getCharacterIndex());
if(quest.getCharacterIndex() + 1 < quest.things.length && quest.things[quest.getCharacterIndex() + 1].type != "none"){
statusLines.push(this.formatLines(character));
if(quest.things[quest.getCharacterIndex() + 1].type == "mob") // If it's a mob
statusLines.push(this.formatLines(["", "VERSUS", "", ""]));
if(quest.things[quest.getCharacterIndex() + 1].type == "ally") // If it's an ally
statusLines.push(this.formatLines(["", " WITH ", "", ""]));
statusLines.push(this.getLinesFromThingIndex(quest.getCharacterIndex() + 1));
}
else{
statusLines.push(character);
}
return this.formatStatusLines(statusLines);
},
formatLines : function(lines){
var max_len = 0;
for(var i = 0; i < lines.length; i++){
if(lines[i].length > max_len) max_len = lines[i].length;
}
for(var i = 0; i < lines.length; i++){
if(lines[i].length < max_len){
for(var j = lines[i].length; j < max_len; j++){
lines[i] += " ";
}
}
lines[i] += " | ";
}
return lines;
},
formatStatusLines : function(lines){
var text = "";
var stop = false;
var i = 0;
while(stop == false){
stop = true;
text += "\n";
for(var j = 0; j < lines.length; j++){
if(lines[j].length > i){
text += lines[j][i];
stop = false; // While we have something to add, we continue
}
}
i++;
}
return text;
},
getLinesFromThingIndex : function(i){
var lines = [];
lines.push(" " + quest.things[i].text);
lines.push("HP : " + quest.things[i].hp + "/" + quest.things[i].max_hp);
lines.push("Weapon : " + quest.things[i].weapon);
lines.push("\"" + quest.things[i].description + "\"");
return lines;
}
};

237
static/candies/scripts/swamp.js Executable file
View File

@ -0,0 +1,237 @@
var swamp = {
// Variables
shown : false,
step : 0,
// Functions
updateOnPageFinalFrog : function(){
var text = "";
var answer_form = "\n\n<input id=\"answer\" type=\"text\" onchange=\"swamp.answer()\" /> <span id=\"swamp_comment\"></span>";
switch(this.step){
case 4:
text = speech.makeSpeechFromText("Hello. I'm The Frog. I can provide you candies, and lots of things. I know how much you love candies. But I feel alone in this swamp. I'd like to play with you before. If you answer my questions correctly, the sweetest sweets will be yours.", 29, "");
text += "\n\n<button id=\"answer\" onClick=\"swamp.setStep(5);\">Let's go, then</button>";
break;
case 5:
text = speech.makeSpeechFromText("First question: do you _really_ love candies?", 29, "");
text += answer_form;
break;
case 6:
text = speech.makeSpeechFromText("Perfect. Here's 10 candies. Many more candies are waiting for you.", 29, "");
text += "\n\n<button id=\"answer\" onClick=\"swamp.setStep(7);\">Second question!</button>";
break;
case 7:
text = speech.makeSpeechFromText("Second question: if A implies B and B implies C, and D implies A, and E implies D, what does A imply?", 29, "");
text += answer_form;
break;
case 8:
text = speech.makeSpeechFromText("Great. You seem to understand basic logic. Here's 100 candies.", 29, "");
text += "\n\n<button id=\"answer\" onClick=\"swamp.setStep(9);\">Next question!</button>";
break;
case 9:
text = speech.makeSpeechFromText("Third question. Consider 10 days. If I give you 1 candy on the first day, and each other day I give you twice more candies than the previous one, how many candies will I give you on the day number 10?", 29, "");
text += answer_form;
break;
case 10:
text = speech.makeSpeechFromText("Exactly. Let's speed up the process: here's your 512 candies right now! Playing with you is so exciting! Next question is for 1000 candies.", 29, "");
text += "\n\n<button id=\"answer\" onClick=\"swamp.setStep(11);\">Candiiiiies!</button>";
break;
case 11:
text = speech.makeSpeechFromText("Fourth question: if you could be whatever you want, what would you be?", 29, "");
text += answer_form;
break;
case 12:
text = speech.makeSpeechFromText("Correct! Everyone wants to be a frog. Here's your 1000 candies.", 29, "");
text += "\n\n<button id=\"answer\" onClick=\"swamp.setStep(13);\">Any more enigma?</button>";
break;
case 13:
text = speech.makeSpeechFromText("Here's a story: there's a fox, a lion and a wolf inside a lunar crater. The fox is about to bite the lion, which is about to bite the wolf, which is about to bite the fox. It's snowing and a shrub is watching the scene. Who's enjoying the story?", 29, "");
text += answer_form;
break;
case 14:
text = speech.makeSpeechFromText("Right, you were enjoying it! At least, I hope so. Here's a chocolate bar for you. It's very precious.", 29, "");
text += "\n\n<button id=\"answer\" onClick=\"swamp.setStep(15);\">Thanks, Frog!</button>";
break;
case 15:
text = speech.makeSpeechFromText("Now, just type the answer to that question and I'll give you a very special present: what is the only thing to go beyond the limits of our universe?", 29, "");
text += answer_form;
break;
case 16:
text = speech.makeSpeechFromText("Yes it is! Now, here's 5 very special potions. They'll be very useful during quests.", 29, "");
text += "\n\n<button id=\"answer\" onClick=\"swamp.setStep(17);\">Yay !!</button>";
break;
default:
text = speech.makeSpeechFromText("I have no more sweets to give you. It was a real pleasure to play with you. Thanks a lot.", 29, "");
break;
}
text += "\n\n<button onClick=\"swamp.leave();\">Leave the Swampy Swamp</button>";
htmlInteraction.setInnerHtml("map", "\
.--._.--.\n\
The ( O O ) Frog\n\
/ . . \\\n\
.`._______.'.\n\
/( )\\\n\
_/ \\ \\ / / \\_\n\
.~ ` \\ \\ / / ' ~.\n\
{ -. \\ V / .- }\n\
_ _`. \\ | | | / .'_ _\n\
>_ _} | | | {_ _<\n\
/. - ~ ,_-' .^. `-_, ~ - .\\\n\
'-'|/ \\|`-`\n\n\
" + text);
},
updateOnPage : function(){
if(this.shown){
switch(this.step){
case 0:
htmlInteraction.setInnerHtml("map", "\
While you walk through the swamp,\n\
following your map...\
");
this.step = 1;
window.setTimeout(this.updateOnPage.bind(this), 3500);
break;
case 1:
htmlInteraction.setInnerHtml("map", "\
On the horizon, you see a\n\
00 frog\n\
(--) coming...\n\
( || )\n\
^^~~^^\
");
this.step = 2;
window.setTimeout(this.updateOnPage.bind(this), 3500);
break;
case 2:
htmlInteraction.setInnerHtml("map", "\
It is coming_ _\n\
slowly (o)--(o)\n\
but /.______.\\\n\
surely, \\________/\n\
./ \\.\n\
( . , )\n\
\\ \\_\\\\//_/ /\n\
~~ ~~ ~~\
");
this.step = 3;
window.setTimeout(this.updateOnPage.bind(this), 3500);
break;
case 3:
htmlInteraction.setInnerHtml("map", "\
.-. .-.\n\
( o )_( o )\n\
__ / '-' '-' \\ __ it is\n\
/ / \" \\ \\ green.\n\
| \\ _____, / |\n\
\\ \\`-._______.-'/ /\n\
_.-` /\\) (/\\ `-._\n\
(_ / / /.___.\\ \\ \\ _)\n\
(_.(_/ / (_ _) \\ \\_)._)\n\
(_(_)_) (_(_)_)\
");
this.step = 4;
window.setTimeout(this.updateOnPage.bind(this), 3500);
break;
default:
this.updateOnPageFinalFrog();
break;
}
}
},
enter : function(){
objects.leave();
this.shown = true;
this.updateOnPage();
},
leave : function(){
this.shown = false;
htmlInteraction.setInnerHtml("map", "");
//buttons.enableHomeButtons();
},
resetComment : function(){
htmlInteraction.setInnerHtml("swamp_comment", "");
},
setComment : function(value){
htmlInteraction.setInnerHtml("swamp_comment", value);
window.setTimeout(this.resetComment.bind(this), 1000); // We set the timeout to reset it in one second
},
setStep : function(value){
// We change the value
this.step = value;
// If the swamp is shown
if(this.shown){
// We update on page
this.updateOnPage();
// We possibly focus
if(this.step >= 4 && this.step <= 16){
htmlInteraction.focusElement("answer");
}
}
},
answer : function(){
var ans = htmlInteraction.getElement("answer").value.toLowerCase().replace(/[^\w]|_/g, "");
htmlInteraction.getElement("answer").focus(); // Re focus after answering
switch(this.step){
case 5:
if(ans == "yes"){
candies.setNbrOwned(candies.nbrOwned + 10);
this.setStep(6);
}
else this.setComment("Wrong.");
break;
case 7:
if(ans == "c" || ans == "b" || ans == "candb" || ans == "bandc"){
candies.setNbrOwned(candies.nbrOwned + 100);
this.setStep(8);
}
else this.setComment("Wrong.");
break;
case 9:
if(ans == "512"){
candies.setNbrOwned(candies.nbrOwned + 512);
this.setStep(10);
}
else this.setComment("Wrong.");
break;
case 11:
if(ans == "frog" || ans == "afrog" || ans == "thefrog"){
candies.setNbrOwned(candies.nbrOwned + 1000);
this.setStep(12);
}
else this.setComment("Wrong.");
break;
case 13:
if(ans == "me"){
chocolateBars.setNbrOwned(chocolateBars.nbrOwned + 1);
this.setStep(14);
}
else this.setComment("Wrong.");
break;
case 15:
if(ans == "theanswertothatquestion" || ans == "theanswer" || ans == "answer" || ans == "answertothatquestion"){
potions.getPotions(potions.list.berserk, 5);
this.setStep(16);
}
else this.setComment("Wrong.");
break;
}
}
}

494
static/candies/scripts/sword.js Executable file
View File

@ -0,0 +1,494 @@
var sword = {
// Variables
name : "none",
specialSword : false,
specialPower : 1, // How many the Sword of Life can steal hp, additional damage of the Sword of Flames...
// List of summoned things with the level we need to summon them
summonList : [],
// Functions
onload : function(){
this.summonList.push({name:"imps", summonFunction:quest.makeImp.bind(quest), powerNeeded:1});
this.summonList.push({name:"orcs", summonFunction:quest.makeOrc.bind(quest), powerNeeded:2});
this.summonList.push({name:"draugrs", summonFunction:quest.makeDraugr.bind(quest), powerNeeded:3});
this.summonList.push({name:"a chupacabra", summonFunction:quest.makeChupacabra.bind(quest), powerNeeded:4});
this.summonList.push({name:"a golem", summonFunction:quest.makeGolem.bind(quest), powerNeeded:5});
this.summonList.push({name:"a chimera", summonFunction:quest.makeChimera.bind(quest), powerNeeded:6});
this.summonList.push({name:"a candy monster", summonFunction:quest.makeCandyMonster.bind(quest), powerNeeded:7});
},
buyThisSword : function(name){
if(this.name != name){ // If we're not trying to buy the current sword
switch(name){
case "wooden sword":
if(candies.nbrOwned >= shop.currentSwordPrice){
candies.setNbrOwned(candies.nbrOwned - shop.currentSwordPrice);
shop.setMerchantSpeech("Great! This wooden sword isn't the best, for sure, but it really didn't cost so much.");
shop.hideProduct("sword");
}
else{
shop.setMerchantSpeech("You don't have enough candies. You should save up candies to buy it : swords are useful nowadays.");
return;
}
break;
case "copper sword":
if(candies.nbrOwned >= shop.currentSwordPrice){
candies.setNbrOwned(candies.nbrOwned - shop.currentSwordPrice);
shop.setMerchantSpeech("This copper sword is quite heavy, but it slays efficiently.");
shop.hideProduct("sword");
}
else{
shop.setMerchantSpeech("You need 300 candies to buy that sword! Did you know that copper slowly reacts with atmospheric oxygen forming a layer of brown-black copper oxide?");
return;
}
break;
case "iron sword":
if(candies.nbrOwned >= shop.currentSwordPrice){
candies.setNbrOwned(candies.nbrOwned - shop.currentSwordPrice);
shop.setMerchantSpeech("This iron sword could cut almost anything, if you're strong enough to use it.");
shop.hideProduct("sword");
}
else{
shop.setMerchantSpeech("You need more candies for the iron sword. Iron is strong. Iron is reliable. Iron will obey your slaying desire.");
return;
}
break;
case "silver sword":
if(candies.nbrOwned >= shop.currentSwordPrice){
candies.setNbrOwned(candies.nbrOwned - shop.currentSwordPrice);
shop.setMerchantSpeech("One thousand candies for meeee! Uh, I mean, this silver sword is even stronger than the iron one! You had to buy it.");
shop.hideProduct("sword");
}
else{
shop.setMerchantSpeech("One thousand candies for the silver sword! My marginal profit can't handle less than that.");
return;
}
break;
case "diamond sword":
if(candies.nbrOwned >= shop.currentSwordPrice){
candies.setNbrOwned(candies.nbrOwned - shop.currentSwordPrice);
shop.setMerchantSpeech("Diamond! This is the best sword I can sell you. It will cut rocks as if they were made of butter.");
shop.hideProduct("sword");
}
else{
shop.setMerchantSpeech("You need more candies. The diamond sword is quite expensive, but it's worth it!");
return;
}
break;
}
this.setName(name); // We bought it, since we didn't return : we change the name
}
},
enchantImpInvocation : function(){
if(potions.list.impInvocationScroll.nbrOwned > 0){
this.setSpecialSword(true);
this.setName("Sword of Summoning");
potions.list.impInvocationScroll.nbrOwned -= 1;
potions.updateOnPage();
forge.setStep(2);
}
},
setSpecialSword : function(value){
this.specialSword = value;
},
setSpecialPower : function(value){
if(value > 0){
this.specialPower = value;
}
else this.specialPower = 0;
},
getIndexOfBetterToSummon : function(){
var indexOfBetterToSummon = 0;
// We iterate over the list
for(var i = 0; i < this.summonList.length; i++){
// If we can summon this one and it is better than the current betterToSummon
if(this.summonList[i].powerNeeded <= this.specialPower && this.summonList[i].powerNeeded > this.summonList[indexOfBetterToSummon].powerNeeded){
// This is now the better to summon
indexOfBetterToSummon = i;
}
}
return indexOfBetterToSummon;
},
summonHere : function(id){
// One chance out of two we summon something
if(random.flipACoin()){
// We summon the better to summon
quest.things[id] = this.summonList[this.getIndexOfBetterToSummon()].summonFunction();
}
},
enchantFire : function(){
if(potions.list.fireScroll.nbrOwned > 0){
this.setSpecialSword(true);
this.setName("Sword of Flames");
potions.list.fireScroll.nbrOwned -= 1;
potions.updateOnPage();
forge.setStep(2);
}
},
enchantHealth : function(){
if(potions.list.health.nbrOwned > 0){
this.setSpecialSword(true);
this.setName("Sword of Life");
potions.list.health.nbrOwned -= 1;
potions.updateOnPage();
forge.setStep(2);
}
},
sharpen : function(){
this.setName("sharp chocolate sword");
forge.setStep(1);
},
coat : function(){
if(chocolateBars.nbrOwned >= 1){
chocolateBars.setNbrOwned(chocolateBars.nbrOwned - 1);
this.setName("chocolate sword");
htmlInteraction.hideButton("coat");
}
},
encrust : function(){
if(candies.nbrOwned >= 101){
candies.setNbrOwned(candies.nbrOwned - 101);
this.setName("candy diamond sword");
htmlInteraction.hideButton("encrust");
}
},
polish : function(){
if(lollipops.nbrOwned >= 30){
lollipops.setNbrOwned(lollipops.nbrOwned - 30);
this.setName("polished candy diamond sword");
htmlInteraction.hideButton("polish");
}
},
setName : function(value){
// We change the value
this.name = value;
// We possibly show a new product in the shop depending on the new sword name
switch(this.name){
case "wooden sword": shop.showProduct("copper_sword"); break;
case "copper sword": shop.showProduct("iron_sword"); break;
case "iron sword": shop.showProduct("silver_sword"); break;
case "silver sword": shop.showProduct("diamond_sword"); break;
default: shop.showProduct("products_after_swords"); break;
}
// Other stuff
htmlInteraction.setInnerHtml("sword", "You currently have a <b><span style=\"color:#79ad36\">" + this.name + "</span></b>.");
quest.defineMood();
htmlInteraction.setElementVisibility("sword", true);
htmlInteraction.setElementVisibility("quest_form", true);
buttons.checkSword();
inventory.updateOnPage();
},
// Ascii art
asciiWoodenSwordWithButton : "\
.\n\
/ \\\n\
| |\n\
| | <button class=\"home_button\" id=\"buy_wooden_sword\" onClick=\"sword.buyThisSword(\'wooden sword\');\">Buy the <b>wooden sword</b> (<b><span style=\"color:#79ad36\">100</span> candies</b>)</button>\n\
| |\n\
| |\n\
`--8--\'\n\
8\n\
0",
asciiWoodenSwordWithoutButton : "Wooden sword\n\
.\n\
/ \\\n\
| |\n\
| |\n\
| |\n\
| |\n\
`--8--\'\n\
8\n\
0",
asciiCopperSwordWithButton : "\
.\n\
/:\\\n\
|||\n\
||| <button class=\"home_button\" id=\"buy_copper_sword\" onClick=\"sword.buyThisSword(\'copper sword\');\">Buy the <b>copper sword</b> (<b><span style=\"color:#79ad36\">300</span> candies</b>)</button>\n\
|||\n\
|||\n\
`--8--\'\n\
8\n\
0",
asciiCopperSwordWithoutButton : "Copper sword\n\
.\n\
/:\\\n\
|||\n\
|||\n\
|||\n\
|||\n\
`--8--\'\n\
8\n\
0",
asciiIronSwordWithButton : "\
/|\n\
|\\|\n\
|||\n\
||| <button class=\"home_button\" id=\"buy_iron_sword\" onClick=\"sword.buyThisSword(\'iron sword\');\">Buy the <b>iron sword</b> (<b><span style=\"color:#79ad36\">500</span> candies</b>)</button>\n\
|||\n\
|||\n\
|||\n\
|||\n\
~-[{o}]-~\n\
|/|\n\
|/|\n\
`0\'",
asciiIronSwordWithoutButton : "Iron sword\n\
/|\n\
|\\|\n\
|||\n\
|||\n\
|||\n\
|||\n\
|||\n\
|||\n\
~-[{o}]-~\n\
|/|\n\
|/|\n\
`0\'",
asciiSilverSwordWithButton : "\
|\\\n\
|/|\n\
|||\n\
[|] <button class=\"home_button\" id=\"buy_silver_sword\" onClick=\"sword.buyThisSword(\'silver sword\');\">Buy the <b>silver sword</b> (<b><span style=\"color:#79ad36\">1000</span> candies</b>)</button>\n\
|||\n\
[|]\n\
|||\n\
|||\n\
\\_[[O]]_/\n\
|/|\n\
|/|\n\
`0\'",
asciiSilverSwordWithoutButton : "Silver sword\n\n\
|\\\n\
|/|\n\
|||\n\
[|]\n\
|||\n\
[|]\n\
|||\n\
|||\n\
\\_[[O]]_/\n\
|/|\n\
|/|\n\
`0\'",
asciiDiamondSwordWithButton : "\
/|\n\
|;|\n\
|:|\n\
|;| <button class=\"home_button\" id=\"buy_diamond_sword\" onClick=\"sword.buyThisSword(\'diamond sword\');\">Buy the <b>diamond sword</b> (<b><span style=\"color:#79ad36\">2000</span> candies</b>)</button>\n\
|:|\n\
|;|\n\
|:|\n\
|;|\n\
|:|\n\
\\_[[C]]_/\n\
|N|\n\
|D|\n\
`0\'",
asciiDiamondSwordWithoutButton : "Diamond sword\n\n\
/|\n\
|;|\n\
|:|\n\
|;|\n\
|:|\n\
|;|\n\
|:|\n\
|;|\n\
|:|\n\
\\_[[C]]_/\n\
|N|\n\
|D|\n\
`0\'",
asciiCandyDiamondSword : "Candy diamond\nsword\n\n\
/|\n\
|o|\n\
|:|\n\
|o|\n\
|:|\n\
|o|\n\
|:|\n\
|o|\n\
o |:| o\n\
\\_[[C]]_/\n\
|N|\n\
|D|\n\
'O'",
asciiPolishedCandyDiamondSword : "Polished candy\ndiamond sword\n\n\
/|\n\
|o|\n\
| |\n\
|o|\n\
| |\n\
|o|\n\
| |\n\
|o|\n\
o | | o\n\
\\_([-])_/\n\
| |\n\
| |\n\
'O'",
asciiChocolateSword : "Chocolate sword\n\n\
/|\n\
|o|\n\
|~|\n\
|o|\n\
|~|\n\
|o|\n\
|~|\n\
|o|\n\
o |~| o\n\
\\~([-])~/\n\
|~|\n\
|~|\n\
'O'",
asciiSharpChocolateSword : "Sharp chocolate\nsword\n\n\
/|\n\
|^|\n\
|~|\n\
|^|\n\
|~|\n\
|^|\n\
|~|\n\
|^|\n\
. |~| .\n\
\\~([-])~/\n\
|~|\n\
|~|\n\
'O'",
asciiSwordOfFlames : "Sword of Flames\n\n\
_\n\
/#|\n\
|##|\n\
|##|\n\
|#F|\n\
|L#|\n\
|#A|\n\
|M#|\n\
|#E|\n\
|S#|\n\
|##|\n\
|##|\n\
_ |##| _\n\
\\\\-([--])-//\n\
|``|\n\
|``|\n\
|``|\n\
\"##\"",
asciiSwordOfLife : "Sword of Life\n\n\
_ _\n\
( `\\/' )\n\
`\\ /'\n\
|\\/|\n\
| |\n\
|~ |\n\
| |\n\
| ~|\n\
| |\n\
| |\n\
| ~|\n\
|~ |\n\
| |\n\
| ~|\n\
/~~([--])~~\\\n\
| |\n\
| |\n\
| |\n\
\"OO\"",
asciiSwordOfSummoning : "Sword of Summoning\n\n\
_\n\
/*| _\n\
|% | / \\\n\
| | /& /\n\
| &| / /\n\
| | / /\n\
|% | / %/\n\
| |/ /\n\
| * & /\n\
| /\n\
|& */\n\
| |\n\
|_%|\n\
~~([__])~~\n\
|*%|\n\
|%&|\n\
|*&|\n\
\'42\'",
asciiSwordOfLiflamesummoning : "Sword of\nLiflamesummoning\n\n\
_ _\n\
( `\\/' )\n\
`\\ /'\n\
|\\/| _\n\
|% | /#\\\n\
| | /&#/\n\
| &| /##/\n\
| | /##/\n\
|% | /#%/\n\
| |/##/\n\
| * &#/\n\
| #/\n\
|& */\n\
| |\n\
|_%|\n\
~~([__])~~\n\
|l%|\n\
|%f|\n\
|s%|\n\
\'42\'",
asciiSwordOfRandomness : " Sword of Randomness\n\n\
_ _\n\
À ( `\\/' )\n\
À `\\ e /'\n\
À À |\\/| _\n\
À |% | /#\\\n\
À qsd | | /&#/\n\
| &| /##/\n\
ÀÀ| | /##/\n\
|% | /s%/\n\
f | |À/##/\n\
| $*À &#/\n\
r | #/\n\
|& */\n\
ù | |\n\
dfg |_%|\n\
~~(É[__])~~\n\
|l%|\n\
A |%f|\n\
|s%sdd|\n\
\'42\'"
};

156
static/candies/scripts/tabs.js Executable file
View File

@ -0,0 +1,156 @@
var tabs = {
// Variables
length : 0, // Number of tabs
list : new Array(), // List of tabs buttons
active : 0, // Number of active tab
lastKeyPress : 0, // blbl
// Functions
// Enable the tab ( display : inline on the tab )
enable : function(n){
if(this.list[n].enabled == false){
this.list[n].enabled = true;
this.list[n].button.css("display", "inline");
}
},
// Disable the tab ( display : none on the tab )
disable : function(n){
if(this.list[n].enabled == true){
this.list[n].enabled = false;
this.list[n].button.css("display", "none");
}
},
// Show the tab ( slideDown/show based on the animSlide variable )
show : function(n){
this.getTab(this.list[n].button).slideDown(200);
},
// Hide the tab ( slideUp/hide based on the animSlide variable )
hide : function(n){
if(n == 1){ // If we're hiding the inventory tab, we try to leave all the maps
objects.leave();
}
this.getTab(this.list[n].button).slideUp(200);
},
// Select the tab
select : function(something){
// Remove the class "active" on the last active tab
this.list[this.active].button.removeClass("active");
// Get the new active tab
this.active = something;
// For all tabs
for(var i = 0; i < this.length; i++){
// If the tab is the new active tab
if(i == this.active){
// Add the class "active" on the new active tab
this.list[i].button.addClass("active");
// Show that tab
this.show(i);
}
// Else, hide that tab
else
this.hide(i);
}
},
// Next tab
next : function(){
var nextI = this.active;
for(var i = 0; i < this.length; i++){
// We search the nextI
nextI += 1;
if(nextI == this.length)
nextI = 0;
// We select the next tab if possible
if(this.list[nextI].enabled){
this.select(nextI);
break;
}
}
},
// Prev tab
prev : function() {
var prevI = this.active;
for(var i = this.length; i > 0; i--){
// We search the nextI
prevI -= 1;
if(prevI == -1)
prevI = this.length-1;
// We select the next tab if possible
if(this.list[prevI].enabled){
this.select(prevI);
break;
}
}
},
// Get the tab attribute
getTab : function(something){
return $("#"+something.attr("tab"));
},
bindKey : function(){
$("body").keydown( function(e) {
var currentTime = new Date().getTime();
// Tabs keys
if(currentTime - tabs.lastKeyPress > 50) {
if(e.which == 39)
tabs.next();
else if(e.which == 37)
tabs.prev();
/*else
alert("Code for Key Pressed : " + e.which);*/
tabs.lastKeyPress = currentTime;
}
// Quest keys
if(e.which == 73){
hell.goUp();
}
else if(e.which == 75){
hell.goDown();
}
if(e.which == developperComputer.letter){
developperComputer.useLetter();
}
});
},
//On Load
onload : function(){
// Get the number of tabs
this.length = $("#tabs button").length;
// Generate the list of tabs buttons
for(var i = 0; i < this.length; i++){
this.list.push({button:$(".tab-" + i), enabled:true});
this.disable(i);
}
// Select the first tab
this.select(0);
// Bind click event on all tabs to do select(that tab)
for(var i = 0; i < this.length; i++){
this.list[i].button.bind('click', tabs.select.bind(tabs, i));
}
// Bind key
this.bindKey();
}
};

View File

@ -0,0 +1,255 @@
var underwaterCave = {
// Variables
size : 54,
// Functions
onload : function(){
land.addLand("Underwater cave", this.size, 2, this.load.bind(this), this.getText.bind(this), this.move.bind(this));
},
move : function(){
var defeated = false;
if(quest.things[51].type != "mob") defeated = true; // The Whale has been defeated
// We create a variable to store the lines of the underwater cave, depending on if the Whale is defeated or not
var lines = [];
if(defeated == false) lines = this.text.slice(0);
else lines = this.textWithoutWhale.slice(0);
// We make bubbles go up
for(var i = this.bubbles.length - 1; i >= 0; i--){
if(this.bubbles[i].y == 0 || lines[this.bubbles[i].y-1].charAt(this.bubbles[i].x) != " "){
this.bubbles.splice(i, 1);
}
else this.bubbles[i].y -= 1;
}
// We add bubbles if there isn't enough
if(this.bubbles.length < 4){
var b = this.bubblesStartingPositions[random.getRandomIntUpTo(this.bubblesStartingPositions.length-1)];
if(lines[b.y].charAt(b.x) == " " && lines[b.y-1].charAt(b.x) == " "){
this.bubbles.push({x:0, y:0});
this.bubbles[this.bubbles.length-1].x = b.x;
this.bubbles[this.bubbles.length-1].y = b.y;
}
}
},
load : function(){
for(var i = 1; i < quest.things.length; i++){
if(i < 47){ // If we're before the place of octopus guardians
if(i > 2){ // If we're underwater
if(i >= 26 && i <= 35){ // Eel zone
if(random.oneChanceOutOf(3)){
quest.things[i] = land.createMob("EEL", 3, 3, "electric tail", "An eel. Weak, but aggressive.", [drops.createDrop("candies", 50 + random.getRandomIntUpTo(50))]);
}
}
else{
if(random.flipACoin()){
var n = 9 + random.getRandomIntUpTo(3);
quest.things[i] = land.createMob("F~H", n, n, "fins", "A fish. Easy to beat.", [drops.createDrop("candies", 5)]);
}
}
}
}
else if(i <= 50){ // If we're before the whale
if(random.getRandomIntUpTo(10) <= 9) // 9/10 chances
quest.things[i] = land.createMob("OCT", 45, 45, "tentacles", "An octopus guardian. It looks dangerous.", []);
}
else if(i == 51){ // It's the whale (52 and 53 must be void)
quest.things[i] = land.createMob("The Whale.", 100, 100, "giant tail", "The Whale does not like to be disturbed.", [drops.createDrop("candies", 400 + random.getRandomIntUpTo(400)), drops.createDrop("object", "key", true), drops.createDrop("object", "hutMap", true), drops.createDrop("object", "swampMap", true), drops.createDrop("object", "boots", true), drops.createDrop("object", "wellMap", true), drops.createDrop("object", "magicianHat", true), drops.createDrop("object", "pinkRing", true), drops.createDrop("object", "forgeMap", true)]);
}
}
},
getText : function(){
var defeated = false;
if(quest.things[51].type != "mob") defeated = true; // The Whale has been defeated
// We create a variable to store the lines of the underwater cave, depending on if the Whale is defeated or not
var lines = [];
if(defeated == false) lines = this.text.slice(0);
else lines = this.textWithoutWhale.slice(0);
// We modify this variable by adding things to it
for(var i = 0; i < this.size; i++){
if(defeated == true || (defeated == false && i <= 50)){ // If we defeated the Whale or we're not drawing the things located after the Whale
if(quest.things[i].type != "none"){
lines[this.positions[i].y] = lines[this.positions[i].y].replaceAt(this.positions[i].x, quest.things[i].text);
}
}
}
// We modify this land var by drawing bubbles
for(var i = this.bubbles.length - 1; i >= 0; i--){
if(lines[this.bubbles[i].y].charAt(this.bubbles[i].x) == " ") lines[this.bubbles[i].y] = lines[this.bubbles[i].y].replaceAt_with_size(this.bubbles[i].x, "&deg", 1);
else this.bubbles.splice(i, 1);
}
return lines.join("");
},
// Variables
text : [
" / . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n",
"___________| . . . . . . . . . . . . . . . . . . . . . . _______ . . .\n",
". . .| |. . . . . . . . . . . . . . . . . . . ._____/ \\ . . .\n",
" . . | | . . . ________. . . . . . . . . . . ./ \\ . .\n",
". . .| \\_____/ \\_______ . . . . . . ./ \\ . .\n",
" . . \\ \\____________/ \\ .\n",
". . . \\ __ | .\n",
" . . . \\ __/. | |.\n",
". . . . \\ ________/. . .| | .\n",
" . . . . \\ ____/. . . . . . ./ / .\n",
". . . . . \\___ __/. . . . . . . . ./ / . .\n",
" . . . . . . .\\ ______/. . . . . . . . . ./ / . .\n",
". . . . . . . .\\_____________/. . . . . ____. . . . . ./ / . . .\n",
" . .__________ . . . . . . . . . . . __/ \\_________/ \\. . .\n",
". ./ \\ . . . . . . . ______/ \\. . .\n",
" ./ ::. \\_____________/ |. .\n",
".|(\\./) .-\"\"-. | . .\n",
" | `\\'-'` \\ / . .\n",
".| '.___,_`__/ / . . .\n",
" | __________ _____________/ . . .\n",
". \\_____ ________/ . . . . .\\_________/. . . . . . . . . . .\n",
" . . . .\\__________/ . . . . . . . . . . . . . . . . . . . . . . . . .\n",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ."
],
textWithoutWhale : [
" / . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n",
"___________| . . . . . . . . . . . . . . . . . . . . . . _______ . . .\n",
". . .| |. . . . . . . . . . . . . . . . . . . ._____/ \\ . . .\n",
" . . | | . . . ________. . . . . . . . . . . ./ \\ . .\n",
". . .| \\_____/ \\_______ . . . . . . ./ \\ . .\n",
" . . \\ \\____________/ \\ .\n",
". . . \\ __ | .\n",
" . . . \\ __/. | |.\n",
". . . . \\ ________/. . .| | .\n",
" . . . . \\ ____/. . . . . . ./ / .\n",
". . . . . \\___ __/. . . . . . . . ./ / . .\n",
" . . . . . . .\\ ______/. . . . . . . . . ./ / . .\n",
". . . . . . . .\\_____________/. . . . . ____. . . . . ./ / . . .\n",
" . .__________ . . . . . . . . . . . __/ \\_________/ \\. . .\n",
". ./ \\ . . . . . . . ______/ \\. . .\n",
" ./ \\_____________/ |. .\n",
".| | . .\n",
" | / . .\n",
".| / . . .\n",
" | __________ _____________/ . . .\n",
". \\_____ ________/ . . . . .\\_________/. . . . . . . . . . .\n",
" . . . .\\__________/ . . . . . . . . . . . . . . . . . . . . . . . . .\n",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ."
],
positions : [
{x:0, y:1},
{x:3, y:1},
{x:6, y:1},
{x:7, y:2},
{x:7, y:3},
{x:7, y:4},
{x:9, y:5},
{x:11, y:6},
{x:13, y:7},
{x:14, y:8},
{x:15, y:9},
{x:18, y:10},
{x:21, y:10},
{x:24, y:9},
{x:27, y:8},
{x:30, y:7},
{x:33, y:7},
{x:36, y:8},
{x:39, y:8},
{x:42, y:7},
{x:45, y:7},
{x:48, y:7},
{x:51, y:6},
{x:54, y:5},
{x:57, y:4},
{x:60, y:5},
{x:62, y:6},
{x:62, y:7},
{x:62, y:8},
{x:61, y:9},
{x:60, y:10},
{x:59, y:11},
{x:58, y:12},
{x:58, y:13},
{x:58, y:14},
{x:58, y:15},
{x:55, y:16},
{x:52, y:17},
{x:51, y:18},
{x:48, y:18},
{x:45, y:19},
{x:42, y:19},
{x:39, y:18},
{x:36, y:17},
{x:33, y:16},
{x:30, y:17},
{x:27, y:17},
{x:25, y:18},
{x:22, y:18},
{x:19, y:18},
{x:16, y:18},
{x:13, y:18},
{x:10, y:18},
{x:7, y:18}
],
bubblesStartingPositions : [
{x:10, y:9},
{x:13, y:9},
{x:18, y:11},
{x:20, y:11},
{x:22, y:11},
{x:24, y:11},
{x:26, y:11},
{x:30, y:10},
{x:32, y:10},
{x:34, y:10},
{x:38, y:9},
{x:41, y:8},
{x:43, y:8},
{x:54, y:7},
{x:56, y:7},
{x:57, y:5},
{x:59, y:5},
{x:63, y:18},
{x:61, y:18},
{x:59, y:18},
{x:57, y:18},
{x:55, y:18},
{x:53, y:18},
{x:51, y:18},
{x:49, y:19},
{x:47, y:19},
{x:45, y:19},
{x:43, y:19},
{x:41, y:19},
{x:38, y:18},
{x:36, y:18},
{x:34, y:18},
{x:32, y:18},
{x:30, y:18},
{x:27, y:19},
{x:25, y:19},
{x:23, y:19},
{x:21, y:19},
{x:18, y:20},
{x:16, y:20},
{x:14, y:20},
{x:12, y:20},
{x:10, y:20},
{x:7, y:19},
{x:5, y:19},
{x:3, y:19}
],
bubbles : []
};

View File

@ -0,0 +1,155 @@
var wishingWell = {
// Variables
shown : false,
speech : "",
step : 0,
// Functions
updateOnPage : function(){
var text = "";
// Well drawing
text += "\
.-------------.\n\
/= ^ =_ ^-_- = \\\n\
/^ ==_ -_ = _ ^ \\\n\
/ =_ ^ -_ = _ = \\\n\
/_=_^___=_-^__=___=_^_\\\n\
__||____ ___ ____||_\n\
`=||====//_\\\\====||=|_\n\
|| |===| || \'-\'\n\
||_..-|___|-.._||\n\
|\'-,._______..-\'|\n\
||__ | __] __]_|\n\
|_| ]__|__ _| __|\n\
|__[ _ ]_ __[_ |\n\
|_| _ |_ ]_ _[_ |\n\
`\"-..........--\"`\n\
"
// Buttons & speech drawing
switch(this.step){
case 0:
// Button
text += "\n\n<button id=\"wishingWell_throw_candy\" onClick=\"wishingWell.throwCandy();\">Throw a candy in the well</button>";
break;
case 1:
// Speech
text += "\n";
text += speech.makeSpeechFromText(this.speech, 23, "");
// Buttons
text += "\n\n<button onClick=\"wishingWell.candiesBy5();\">Multiply my candies by 5</button>";
text += "\n<button onClick=\"wishingWell.lollipopsBy8();\">Multiply my lollipops by 8</button>";
text += "\n<button onClick=\"wishingWell.potionsAndScrolls();\">Give me lots of potions and scrolls</button>";
break;
case 2:
// Speech
text += "\n";
text += speech.makeSpeechFromText(this.speech, 23, "");
break;
}
text += "\n\n<button onClick=\"wishingWell.leave();\">Leave the wishing well</button>";
htmlInteraction.setInnerHtml("map", text);
},
potionsAndScrolls : function(){
var rand, total = 0;
// Potions
rand = 5 + random.getRandomIntUpTo(10);
potions.getPotions(potions.list.health, rand);
total += rand;
rand = 5 + random.getRandomIntUpTo(10);
potions.getPotions(potions.list.escape, rand);
total += rand;
rand = 3 + random.getRandomIntUpTo(3);
potions.getPotions(potions.list.berserk, rand);
total += rand;
rand = 5 + random.getRandomIntUpTo(5);
potions.getPotions(potions.list.superman, rand);
total += rand;
potions.getPotions(potions.list.cloning, 1);
total += 1;
// Scrolls
rand = 5 + random.getRandomIntUpTo(10);
potions.getPotions(potions.list.fireScroll, rand);
total += rand;
rand = 5 + random.getRandomIntUpTo(10);
potions.getPotions(potions.list.acidRainScroll, rand);
total += rand;
rand = 5 + random.getRandomIntUpTo(10);
potions.getPotions(potions.list.teleportScroll, rand);
total += rand;
rand = 3 + random.getRandomIntUpTo(3);
potions.getPotions(potions.list.earthquakeScroll, rand);
total += rand;
rand = 3 + random.getRandomIntUpTo(3);
potions.getPotions(potions.list.impInvocationScroll, rand);
total += rand;
// Usual stuff
this.setStep(2);
this.setSpeech("Here's " + total + " various potions and scrolls for you!");
this.updateOnPage();
},
candiesBy5 : function(){
candies.setNbrOwned(candies.nbrOwned * 5);
this.setStep(2);
this.setSpeech("Multiplicatus, multiplicata, multiplicatum! Your candies are now multiplied!");
this.updateOnPage();
},
lollipopsBy8 : function(){
lollipops.setNbrOwned(lollipops.nbrOwned * 8);
this.setStep(2);
this.setSpeech("Multiplicatus, multiplicata, multiplicatum! Your lollipops are now multiplied!");
this.updateOnPage();
},
throwCandy : function(){
candies.setNbrOwned(candies.nbrOwned - 1);
this.setStep(1);
this.setSpeech("I will grant you one wish! So choose carefully from the list below.");
this.updateOnPage();
},
setStep : function(value){
this.step = value;
},
setSpeech : function(value){
this.speech = value;
},
enter : function(){
objects.leave();
this.shown = true;
this.updateOnPage();
buttons.checkWishingWell();
},
leave : function(){
this.shown = false;
htmlInteraction.setInnerHtml("map", "");
//buttons.enableHomeButtons();
}
};

View File

@ -0,0 +1,59 @@
var yourself = {
// Variables
size : 2,
canSurpass : false,
end : false,
// Functions
onload : function(){
land.addLand("Yourself", this.size, 7, this.load.bind(this), this.getText.bind(this), this.move.bind(this));
},
move : function(){
if(quest.things[0].type == "character" && quest.things[1].type == "mob"){
if(this.end == false){
quest.things[1].max_hp = quest.things[0].max_hp;
quest.things[1].hp = quest.things[0].hp;
}
else{
quest.things[1].hp = 0;
}
}
},
setCanSurpass : function(value){
this.canSurpass = value;
},
load : function(){
quest.things[1] = this.makeYourself();
this.end = false;
},
getText : function(){
// Create the text
var text = "<span style=\"font-size:50px;\">";
if(quest.things[0].type == "character" && quest.things[1].type == "mob"){
text += quest.things[0].text;
text += quest.things[0].text;
}
else{
for(var i = 0; i < this.size; i++){
text += quest.things[i].text;
}
}
text +="</span>";
return text;
},
makeYourself : function(){
var index = quest.getCharacterIndex();
return land.createMob("\\o/", quest.things[index].hp, quest.things[index].max_hp, sword.name, "You", []);
}
};

52
static/jarvis.asc Normal file
View File

@ -0,0 +1,52 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFkUgS0BEAC1L4XyrokbSXv7oYRMRclX3G0VMmpY8otC6N4I4YeQp4iioHPO
9iQny3LM/cBwHhGgD/GU1Ia5OGWZidjxNJGcOkfU8qajjqA8ObMGTm6zk5EYP+oV
HBF/7q+6n1Qk7TiBcivo01JEhGczBd9HG6cQz4AsAzLjC/38CJyoniZgZqwxnPqM
OWDF2KmfEddcPzRlIiNXPl2bddeNjqRoFptoamBIpfNPazkjPbufC+PgofBRQ6kv
dU4PIBvlFijLOdopSTzjZNObBBKPtF2FHJIVOwvIfiEBPrbT2ugy4fo+r5ql8vE/
aXDaWIuib9uO6t6w3iLYZ7xF8dCoC4mKuxMc/zRGWg7ecadoxEK68dT2AzRjUl64
HNNJNEXZQwph6y8yqs8SENmsmmN7x/6q+kptIaafZBKs9/FkO3Gh74030/p93yrN
dPSZhxhdyycNszJxk2uTg/Td3IK3LqH/L8GAIZg/B+Jsov+UX53qGBEz2awYIXt1
/Auqd8Wlpm6GAM9R1I6KTz5iOL6luxvwyKb7qtuvMifCLx1c9zPgxMWSdXZ7TrOe
Jw7YfRJU+JLNQ2G5lJdvWS1O+7TAnf7y4p7t4jAzEhmor0V5vg7ht6jH+0wEL7lH
A2x1F+z6/yeimZsrcydKl9Wl3tSGyDYwI1ioES8gHmprlQ67zbJAGsLG1QARAQAB
tCJKYWtlIEphcnZpcyA8amFrZWphcnZpc0BnbWFpbC5jb20+iQJOBBMBCAA4FiEE
h/tLYAbdG+s+1H+r02y2b0ACslsFAlkUgS0CGwMFCwkIBwIGFQgJCgsCBBYCAwEC
HgECF4AACgkQ02y2b0ACsls4WBAAkuG07Gi9wnvJL0MppRJfEM2iv3PLh7VYosID
v4ekeJdFQxy9PO1OFwNZS4rq22tOLejOPDnaKkcgKX8P67SVttYmllo7aeHkkPcx
RBZ/30Ik2D4LVREcBFB/6Q2or+ylxgbPQikrOdcIpRf0c66Zi2SbOZUao+wpF+gx
M/0d0ChMysHYYN61cv7WKnGDMHLXH7L57MkE6UnJZNPLal/xQaZ/XWLW7DsYZbwp
ZgqXC8QEeH+WMTIwFiNUnhR5pWP5R67YGMUi+khLnqFO7KSYs7N17+iF2b6NPtUE
q9ZKPwww0dKEHA/X0p8OSXXoxp4wpStkp23I2rTeW8P7UZYjmjrnqLYsktKYqakc
O7eOWrcmnkK8tHOcVdaqPfVebZHpkQXfq4fR48MXVZOmEpLESXP969j4zq7w51eP
w9VRZwk0UhZxddkxwnNCN4019RwvsknNhw7IPJdc/iKeG6FpQqEOXZx0mDS0jbUm
ipnRcCWmEfE9GHtRTUEA44uKAS5v1t/LeBVRmMlgo+wYczrSvTDA3GLaTRf8Un+p
afowmBiplDqIeJyjlsVWOi895RXvQWOxAbESdQewIIsRSAjT8DvrkmRk2sGWgntC
d5oC0Vra9zY+LzzjkrSchon12CQ9I2aBaemlGmb0yWJTcsa0Guut//LkjvyacMZL
iZZbC0q5Ag0EWRSBLQEQAPUCnQ15WhKwGD1aZx/YrPHbgxWoPnXVR1+hXkVdQJqL
aRmCxzdUWAUeF2E3tla4+5PAK7EChFB+o1lOz44HlzJ1j3TksJ1Fi4KsVFmx+nCR
i5Ipeq7/0mqczRgoZgtbeQSP/WC79BPYM3Ki7CjmbQFrnoyvAdN/QS8kW8PPz2jv
EoHkZKSqwjialFdfZY6iFDNtStz86hXCQ2O31QbMzNYEmhZLp7B2XKsOb6OmpTeY
rV3CJhu66Eopp/U+g/vPWdrciVS2ASpJd4QDfyuvVQtV0HbAh3MB06FkH1xo6EB5
NU6IDWqiYIeLP1GjTZYM0lZsrgEInFgiAJA4bQsZSw514du7hMno8jaMI+erHl9v
5WlBWis/Dn39hVfP9vxT6ClQ5UxD8OjhMX+MlSqAKxZ9AkG2TurUbAhXesRCoYxe
nBdbuLuWpSwm2JD/HYFZ/KPhZ57ejlnziKhFC2qIVYwO3TuG7Km7oesgbGiRaBTp
FY0LMIS+cJpmEC6LAP3Zr2te4VTK4YyN2+wK6ASC/k6GbHlFUpFxhek+aNkY5OT/
9R07BIKzCNhXBNtzwXvVE/jdMAar9Gr8CSMPYrX8wXrFED9oN6XNci4oItA79805
FEYdpBPMI8MgEdKMwTQifBj6CYrx58Ssg6ZxEu5znf2rSmD8NhtsVVJNtLulKRml
ABEBAAGJAjYEGAEIACAWIQSH+0tgBt0b6z7Uf6vTbLZvQAKyWwUCWRSBLQIbDAAK
CRDTbLZvQAKyW3KRD/4sIO4rUg9ylk2aeFdZFw4pJUXA2d3PdIIuk4XT+AXlT3j3
tEsUS3nKA8RxIoR2jvEgn2mDnZwEikVuK1aUI9nn8JvlxIoh0xd97FzwqO+6b79I
+Q8/GErwy+YhI422sND29qlMKBiQ1/1bg1zqBGl8+3OYj+Xyw+KzNHkOOBF4m9vV
hAUvZONlQd8CWre5jBU7tYS7/g2w/otdSqZe6Ayamlxaoq0jTH4f4kwg6kOz8y6Z
66RqMj2/U4/+0qhFszkX/FaQKQyLESrNrNe/IwFu+o+e+ocx9anuwTU26BRXMt0M
LaxdKtWa+dFSm2PzTjoHZYqnuLa4ZO71t9comB+p0CHshAvt5hBoRqc069sVahkk
kecXaSVHTc3t9UnOJvP3kYCiO0QGFIn9PD+v7oc21yAw9mawVEZgTNCSJnra6oNl
nQ/+FDYVlw686BMZlzpDyC6nJbz/0EWxmMaWLSQWM8l9C1xX+EhM4tJmKP60aqRi
QtGYwx45xjQXPZG4Eck0ft9UOM2/03lSsPvasJbYF32ZOhqAjCpNMcQJJD9Dn19R
CabQeBS5ZZj27oWP0uzCL39wfYuT+qQ68wJ/87N/ocV8g8Gta+HXFg64Lfu3oYHQ
IKHh0SFrOjES4emAyvcxt8VwwR2qD/iSJJ5nMwAfdOznVvDAfINk4NT64apR2A==
=FOdm
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -1,5 +1,7 @@
User-Agent: *
Disallow: /stuff/
Disallow: /y2k/
Disallow: /comp20/
Disallow: /scrabble/
Disallow: /candies/
Disallow: /awesome/

Binary file not shown.