Skip to content

Commit

Permalink
added hardcore mode, 1 death = reset
Browse files Browse the repository at this point in the history
  • Loading branch information
Zertuk committed Jul 5, 2014
1 parent b4bb37a commit cf1ebdb
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 8 deletions.
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

<script src = "locations.js"></script>
<script src = "locationObject.js"></script>
<script src = "options.js"></script>
<script src = "demon.js"></script>
<script src = "factory.js"></script>
<script src = "store.js"></script>
<script src = "reflecting.js"></script>
<script src = "monsters.js"></script>
<script src = "levelObject.js"></script>
<script src = "locationObject.js"></script>
<script src = "level.js"></script>
<script src = "main.js"></script>

Expand All @@ -41,6 +41,7 @@
<button id = "about_button" class = "location_button" value = "About">About</button>
<button id = "inverse_button" onclick = 'inverseColors()'>Inverse</button>
<button id = 'click_button' onclick = "ectoplasmClick(1)">Click</button>
<p id = "hc">HC ON</p>

<p id = "ectoplasm">You have 0 gold</p>
<p id = "blood">?</p>
Expand Down Expand Up @@ -857,6 +858,7 @@ <h2>About</h2>
<p>If you find any bugs/issues you can <a href = "mailto:[email protected]">e-mail</a>
and Ill take care of it. Thanks for playing!</p>
<br>
<button onclick = "HCMode()">Hardcore Mode</button>
<button onclick = 'resetGame()'>Reset Game</button>
</div><!--location_div-->
</div><!--wrapper-->
Expand Down
5 changes: 5 additions & 0 deletions level.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ function battleTime(monster) {
monster.health = monster.maxHealth;
$('#error').html('The ' + monster.name + ' killed you rip ;-;');
$('#error2').html('The ' + monster.name + ' killed you rip ;-;');
if (player.hardcore) {
alert('You have died on hardcore mode! Game will now reset ;-; To turn off hardcore, go to \'About\' and click \'Reset Game\'');
resetGameHC();
player.hardcore = true;
}

}
else if (monster.health <= 0) {
Expand Down
2 changes: 1 addition & 1 deletion levelObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ prison.unlockSave = function() { stuffToShow.tunnel = true };
prison.text = 'Wonder what these guys did';
prison.levelLength = 40;
prison.monster = scientist;
prison.monsterNum = 2;
prison.monsterNum = 1;
prison.specialMonster = jailer;
prison.specialMonsterNum = 3;
prison.ascii = '\n\
Expand Down
32 changes: 28 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ function objectReset() {
riotShield_item: false,
tome_item: false,
end_button: false,
badEnd_button: false
badEnd_button: false,
hc: false
}

inventoryObject = {
Expand Down Expand Up @@ -157,7 +158,8 @@ function objectReset() {
figure: false,
extraMoneyGen: 1,
maximum: 100000,
parts: false
parts: false,
hardcore: false
}
}

Expand All @@ -179,11 +181,21 @@ function resetGame() {
objectReset();
resetLocations();
saveGame();
$('#error').html('Please refresh the window for the entire reset to work');
loadGame();
}
}

function resetGameHC() {
leaveQuest();
objectReset();
resetLocations();
player.hardcore = true;
stuffToShow.hc = true;
saveGame();
loadGame();
locationSwitch(Main);
}


//loads the objects from local storage
function loadObjects() {
Expand Down Expand Up @@ -406,7 +418,7 @@ function mainLoop() {
if (batteryOn == true) {
bloodGenerator(player.batteries);
}

setTimeout(mainLoop, 1000);
}

Expand Down Expand Up @@ -445,6 +457,18 @@ var questLoop = function(monster) {
}, 500);
}

function totalTimer() {
player.timer++
$('#timer').html(player.timer + ' seconds');
}

function HCMode() {
var message = "Warning! This will reset your current game and enable hardcore mode. If you die on hardcore mode, the game will reset!";
if (confirm(message)) {
resetGameHC();
}
}

//checks to see if a spell is active and updates appropriately if active
function activeSpellCheck() {
if (timeFrozen) {
Expand Down
7 changes: 5 additions & 2 deletions store.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ var stuffToShow = {
tome_item: false,
end_button: false,
badEnd_button: false,
fountain_buttons: true
fountain_buttons: true,
hc: false
}

function showStuff() {
Expand Down Expand Up @@ -439,7 +440,9 @@ var player = {
extraMoneyGen: 1,
maximum: 100000,
parts: false,
fountain: false
fountain: false,
hardcore: false,
timer: 0
}

var enchantDmg = 0;
Expand Down
6 changes: 6 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ a:hover {
float: left;
}

#hc {
display: none;
float: right;
margin-top: -1px;
}


pre {
font-size: 14px;
Expand Down

0 comments on commit cf1ebdb

Please sign in to comment.