Skip to content

Instantly share code, notes, and snippets.

@NonrotatedGlobe
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NonrotatedGlobe/ed69dec9d88325d89473 to your computer and use it in GitHub Desktop.
Save NonrotatedGlobe/ed69dec9d88325d89473 to your computer and use it in GitHub Desktop.
// JavaScript Document
//Gumangi Awakens Mod Version 1 by NonrotatedGlobe
//Thanks for playing!
var godName = "Gumangi"; //The god's name.
var godKnowsYouExist = false; //If the god does not know you exist, then it is sleeping
var godPiety = 1; //Determines the god's mood
//An array holding how much piety each item is worth when sacrificed
var itemSP = new Array(401);
itemSP[1] = 4; //Animal Skull
itemSP[8] = 1; //Bone
itemSP[13] = 2.5; //Cooked Meat
itemSP[14] = 0.1; //Earthworm
itemSP[21] = 20; //Gold Coins
itemSP[22] = 14; //Golden Chalice
itemSP[23] = 14; //Golden Ring
itemSP[24] = 14; //Golden Sword
itemSP[30] = 2; //Leather Hide
itemSP[50] = 2; //Raw Meat
itemSP[66] = 2.5; //Tanned Leather
itemSP[79] = 2; //Raw Trout
itemSP[80] = 2; //Cooked Trout
itemSP[91] = 3; //Raw Fish Steak
itemSP[92] = 3.5; //Cooked Fish Steak
itemSP[126] = 0.2; //Rotten Meat
itemSP[128] = 1; //Raw Chicken
itemSP[129] = 1.5; //Cooked Chicken
itemSP[147] = 10; //Old Instructional Scroll
itemSP[148] = 1.5; //Slime Gelatin
itemSP[150] = 1.7; //Cooked Spider
itemSP[151] = 1.5; //Dead Spider
itemSP[164] = 1; //Bones
itemSP[224] = 5; //Ectoplasm
itemSP[235] = 1.2; //Raw Tainted Meat
itemSP[236] = 1.4; //Cooked Tainted Meat
itemSP[238] = 1; //Raw Blind Fish
itemSP[239] = 1.5; //Cooked Blind Fish
//An array of moods that depend on the current range of piety
var godMoods = new Array(10);
godMoods[0] = {pietyMin:"none", pietyMax:-6,text: godName + " is outraged", color:"white"}; //Outraged (-6 and below)
godMoods[1] = {pietyMin:-5, pietyMax:-1,text: godName + " is irritated", color:"white"}; //Irritated (-5 thru -1)
godMoods[2] = {pietyMin:0, pietyMax:0,text: godName + " is neutral", color:"white"}; //Neutral (0)
godMoods[3] = {pietyMin:1, pietyMax:5,text: godName + " is pleased", color:"white"}; //Pleased (1 thru 5)
godMoods[4] = {pietyMin:6, pietyMax:10,text: godName + " is very pleased", color:"white"}; //Very Pleased (6 thru 10)
godMoods[5] = {pietyMin:11, pietyMax:25,text: godName + " is delighted", color:"white"}; //Delighted (11 thru 25)
godMoods[6] = {pietyMin:26, pietyMax:40,text: godName + " is happy", color:"white"}; //Happy (26 thru 40)
godMoods[7] = {pietyMin:41, pietyMax:54,text: godName + " is jubilant", color:"white"}; //Jubilant (41 thru 54)
godMoods[8] = {pietyMin:55, pietyMax:65,text: godName + " is ecstatic", color:"white"}; //Ecstatic (55 thru 65)
godMoods[9] = {pietyMin:66, pietyMax:"none",text: godName + " is exuberant", color:"white"}; //Exuberant (66 and above)
//No mood because the god is sleeping
var godMood_none = {text: godName + " is sleeping", color:"white"};
//Messages
Messages.gumangiMod_sacriMsgNotAltar = "You must be facing a fiery altar to make a sacrifice to " + godName + ".";
Messages.gumangiMod_sacriMsgNoOutfit = "You do not have the right equipment."; //doesn't currently serve any purpose, but may in the future
Messages.gumangiMod_sacriMsgNotNight = "Now is not the time to make a sacrifice, wait until it is midnight.";
Messages.gumangiMod_sacriBlocking = "Something is blocking you from sacrificing your items.";
Messages.gumangiMod_sacriMsgOffendedAtNoOffer = godName + " is irritated by your jokes!";
Messages.gumangiMod_sacriMsgOffendedByOffer = godName + " is irritated by your sacrifice!";
Messages.gumangiMod_sacriMsgIndifferentToOffer = godName + " has no interest in your sacrifice.";
Messages.gumangiMod_sacriMsgEnjoysTheOffer = godName + " is entertained by your sacrifice!";
Messages.gumangiMod_godSleeping = godName + " is sleeping.";
Messages.gumangiMod_godAwakened = godName + " has been awakened!";
Messages.gumangiMod_enoughPiety = godName + " answers your prayers.";
Messages.gumangiMod_notEnoughPiety = godName + " requires more sacrifices.";
Messages.gumangiMod_prayerGeneric = godName + " answers your prayers.";
Messages.gumangiMod_pirateGhostIsImmune = "The ghost is immune!";
//Used for the God Save Code
var encodeVar1 = 19876;
var encodeVar2 = 12345;
hints.GumangiWelcome = {
name: "Gumangi Awakens 1.0",
description: "Thank you for playing Gumangi Awakens 1.0! IMPORTANT: Gumangi's status is not saved each time (don't worry, the map/your inventory/normal wayward stuff saves the same way it would without this mod). Click on 'Get God Save Code' to get the save code, and then next time you play click on 'Enter God Save Code' and enter it to load Gumangi's status."
}
//On click these buttons will call the pray/sacrifice methods
$("#equipmentwindow").append('<button type="button" id="pray">Pray</button>');
$("#equipmentwindow").append('<button type="button" id="sacrifice">Sacrifice</button>');
$("<button/>", {id: "getCode", type: "button", text: "Get God Save Code"}).insertAfter( "#returnToGame" );
$("<button/>", {id: "enterCode", type: "button", text: "Enter God Save Code"}).insertAfter( "#getCode" );
//Attributes box that holds the god's current mood
$("<div/>", {id: "godMoodBox"}).appendTo(".attributes");
$("<span/>", {id: "godMood",text: godMood_none.text,color: godMood_none.color}).appendTo("#godMoodBox");
//Update god status boxes (like the one above)
updateGodStatusBoxes();
//OPEN HINT
ui.hintDisplay("GumangiWelcome");
$("#main-menu").on("click",'#getCode',function(e){
var godStatusCode;
if((godKnowsYouExist) && godPiety === 0){
godStatusCode = "ZEROandAWAKE";
}
else if(!(godKnowsYouExist) && godPiety === 0){
godStatusCode = "ZEROandSLEEP";
}
else{
godStatusCode = "A" + (godPiety + encodeVar1) + "x" + (godPiety + encodeVar2) + "Z";
}
window.prompt("Copy or write down this code for next time",godStatusCode);
});
$("#main-menu").on("click",'#enterCode',function(e){
try{
var godStatusCode = window.prompt("Enter God Save Code to Load God Status","");
if(godStatusCode === "ZEROandAWAKE"){
godPiety = 0;
godKnowsYouExist = true;
updateGodStatusBoxes();
return;
}
else if(godStatusCode === "ZEROandSLEEP"){
godPiety = 0;
godKnowsYouExist = false;
updateGodStatusBoxes();
return;
}
var result1 = "";
var result2 = "";
var xIsAt = 0;
for(var i = 1; i < godStatusCode.length; i++){
try{
if(godStatusCode.charAt(i) === "x"){
xIsAt = i;
result1 = parseFloat(result1);
result1 = (result1 - encodeVar1);
break;
}
result1 = result1.concat(godStatusCode.charAt(i));
}
catch(error){
}
}
for(var i = xIsAt + 1; i < godStatusCode.length; i++){
try{
if(godStatusCode.charAt(i) === "Z"){
result2 = parseFloat(result2);
result2 = (result2 - encodeVar2);
break;
}
result2 = result2.concat(godStatusCode.charAt(i));
}
catch(error){
}
}
if( !(isNan(result1)) && (result1 === result2) ){
godPiety = result1;
godKnowsYouExist= true;
updateGodStatusBoxes();
alert("Status has been loaded");
}
}
catch(error){
}
});
$("#equipmentwindow").on("click",'#pray',function(e){
//If the god knows you exist then you can make a prayer, otherwise you can not
if(godKnowsYouExist){
//Prayers at an altar
if(isFacingAltar()){
try{
//Check to see if there are any tile items to pray with
//if there are not this should cause an error and skip down to the next part
var prayerStack = Object.keys(tile[player.x + player.direction.x][player.y + player.direction.y].tileitems);
if(prayerStack.length == 1){
var pType = tileItems[prayerStack[0]].type;
//Prayer to fill glass bottle with fresh water
if(pType === "glassbottle" || pType === "unpurifiedfreshwaterglassbottle" || pType === "seawaterglassbottle" || pType === "desalinatedwaterglassbottle"){
if(godPiety >= 4.5){
placeItem({type: "purifiedfreshwaterglassbottle", x: player.x + player.direction.x, y: player.y + player.direction.y, durability: "Random"}, 'TILE', false);
removeItem(prayerStack[0], 'TILE', false);
godPiety -= 4.5;
updateGodStatusBoxes();
ui.message("gumangiMod_prayerGeneric", 'normal');
}
else{
ui.message("gumangiMod_notEnoughPiety", 'normal');
}
}
//Prayer to fill waterskin with fresh water
else if(pType === "waterskin" || pType === "unpurifiedfreshwaterwaterskin" || pType === "seawaterwaterskin" || pType === "desalinatedwaterwaterskin"){
if(godPiety >= 4.5){
placeItem({type: "purifiedfreshwaterwaterskin", x: player.x + player.direction.x, y: player.y + player.direction.y, durability: "Random"}, 'TILE', false);
removeItem(prayerStack[0], 'TILE', false);
godPiety -= 4.5;
updateGodStatusBoxes();
ui.message("gumangiMod_prayerGeneric", 'normal');
}
else{
ui.message("gumangiMod_notEnoughPiety", 'normal');
}
}
//Prayer to turn purified water glass bottle into medicinal water glass bottle
else if(pType === "purifiedfreshwaterglassbottle"){
if(godPiety >= 4.5){
placeItem({type: "medicinalwaterglassbottle", x: player.x + player.direction.x, y: player.y + player.direction.y, durability: "Random"}, 'TILE', false);
removeItem(prayerStack[0], 'TILE', false);
godPiety -= 4.5;
updateGodStatusBoxes();
ui.message("gumangiMod_prayerGeneric", 'normal');
}
else{
ui.message("gumangiMod_notEnoughPiety", 'normal');
}
}
//Prayer to turn purified waterskin into medicinal waterskin
else if(pType === "purifiedfreshwaterwaterskin"){
if(godPiety >= 4.5){
placeItem({type: "medicinalwaterwaterskin", x: player.x + player.direction.x, y: player.y + player.direction.y, durability: "Random"}, 'TILE', false);
removeItem(prayerStack[0], 'TILE', false);
godPiety -= 4.5;
updateGodStatusBoxes();
ui.message("gumangiMod_prayerGeneric", 'normal');
}
else{
ui.message("gumangiMod_notEnoughPiety", 'normal');
}
}
//Prayer to turn bones into meat
else if(pType === "bone" || pType === "bones"){
if(godPiety >= 4.5){
placeItem({type: "cookedmeat", x: player.x + player.direction.x, y: player.y + player.direction.y, decay: 1000}, 'TILE', false);
removeItem(prayerStack[0], 'TILE', false);
godPiety -= 4.5;
updateGodStatusBoxes();
ui.message("gumangiMod_prayerGeneric", 'normal');
}
else{
ui.message("gumangiMod_notEnoughPiety", 'normal');
}
}
//Prayer to repair armour
else if( tileItems[prayerStack[0]].mindur <= tileItems[prayerStack[0]].maxdur && (pType === "barkleggings" || pType === "barkshield" || pType === "barktunic" || pType === "leatherbelt" || pType === "leathertunic" || pType === "leatherboots" || pType === "leathercap" ||
pType === "leathergorget" || pType === "leatherpants" || pType === "leathergloves" || pType === "ironbreastplate" || pType === "ironboots" || pType === "ironhelmet" ||
pType === "irongorget" || pType === "irongreaves" || pType === "irongauntlets" || pType === "ironshield" || pType === "wroughtironshield" || pType === "wroughtirongauntlets" ||
pType === "wroughtirongreaves" || pType === "wroughtirongorget" || pType === "wroughtironhelmet" || pType === "wroughtironboots" || pType === "wroughtironbreastplate" || pType === "skullcap")){
if(godPiety >= 10){
tileItems[prayerStack[0]].mindur = tileItems[prayerStack[0]].maxdur;
godPiety -= 10;
updateGodStatusBoxes();
ui.message("gumangiMod_prayerGeneric", 'normal');
}
else{
ui.message("gumangiMod_notEnoughPiety", 'normal');
}
}
//Prayer to repair tools
else if(pType === "fireplough" || pType === "goldensword" || pType === "mortarandpestle" || pType === "stoneaxe" || pType === "stoneshovel" || pType === "woodenspear" || pType === "raft" ||
pType === "spear" || pType === "bow" || pType === "bowdrill" || pType === "fishingnet" || pType === "treevinewhip" || pType === "barktorch" || pType === "handdrill" ||
pType === "spyglass" || pType === "clayblowpipe" || pType === "irontongs" || pType === "stonehammer" || pType === "ironsword" || pType === "animalfattorch" || pType === "ironhammer" ||
pType === "ironhammer" || pType === "ironspear" || pType === "ironshovel" || pType === "irondoubleaxe" || pType === "ironpickaxe" ||pType === "wroughtironpickaxe" || pType === "wroughtirondoubleaxe" ||
pType === "wroughtironshovel" || pType === "wroughtironspear" || pType === "wroughtironhammer" ||pType === "wroughtironsword" ||pType === "fishingrod" ||pType === "woodentongs" ||pType === "wroughtirontongs" ||pType === "sundial" || pType === "shortbow" || pType === "longbow" || pType === "compositebow" || pType === "wroughtironarrow" || pType === "leatherquiver" || pType === "cordedsling" || pType === "leathersling"
){
if(godPiety >= 8){
tileItems[prayerStack[0]].mindur = tileItems[prayerStack[0]].maxdur;
godPiety -= 8;
updateGodStatusBoxes();
ui.message("gumangiMod_prayerGeneric", 'normal');
}
else{
ui.message("gumangiMod_notEnoughPiety", 'normal');
}
}
}
}
catch(error){
//nothing left to check for here
}
}
//Prayers away from an altar
else{
try{
//Check to see if there are any monsters in front of you to turn into a living rock
//if there are not, then this should cause an error and skip on down to the next part
var monsterId = tile[player.x + player.direction.x][player.y + player.direction.y].monster;
var monsterType = game.monsters[monsterId].type;
//Pirate ghosts are immune
if(monsterType === "pirateghost"){
if(godPiety >= 16){
ui.message("gumangiMod_pirateGhostIsImmune", 'normal');
}
else{
ui.message("gumangiMod_notEnoughPiety", 'normal');
}
}
//If the monster is not a living rock, turn it into one
else if(monsterType != "livingrock"){
if(godPiety >= 16){
deleteMonsters(monsterId);
spawnMonster("livingrock", player.x + player.direction.x, player.y + player.direction.y);
godPiety -= 16;
updateGodStatusBoxes();
ui.message("gumangiMod_prayerGeneric", 'normal');
}
else{
ui.message("gumangiMod_notEnoughPiety", 'normal');
}
}
//The only other condition is that the monster is a living rock, in this case there is no reason to turn it into one again
}
catch(error){
try{
//Check for environmental items now
//if there are not any, then this should cause an error and skip on down to the next part
var eIiD = tile[player.x + player.direction.x][player.y + player.direction.y].envItemList[0];
//if the environmental item is a sapling, then replace it with a tree
if(envItems[eIiD].type === "sapling_ground"){
if(godPiety >= 6){
removeItem(eIiD, 'ENV', false);
changeTile({type: "forest"}, player.x + player.direction.x, player.y + player.direction.y, false);
godPiety -= 6;
updateGodStatusBoxes();
ui.message("gumangiMod_prayerGeneric", 'normal');
}
else{
ui.message("gumangiMod_notEnoughPiety", 'normal');
}
}
}
catch(error){
try{
//Check for tile items now
//if there are not any, then this should cause an error and skip on down to the next part
var prayerStack = Object.keys(tile[player.x + player.direction.x][player.y + player.direction.y].tileitems);
var pItem = tileItems[prayerStack[prayerStack.length - 1]];
var pItemId = prayerStack[prayerStack.length - 1];
if(pItem.type === "glassbottle" || pItem.type === "unpurifiedfreshwaterglassbottle" || pItem.type === "seawaterglassbottle" || pItem.type === "desalinatedwaterglassbottle"){
if(godPiety >= 5){
removeItem(pItemId, 'TILE', false);
placeItem({type: "purifiedfreshwaterglassbottle", x: player.x + player.direction.x, y: player.y + player.direction.y, durability: "Random"}, 'TILE', false);
godPiety -= 5;
updateGodStatusBoxes();
ui.message("gumangiMod_prayerGeneric", 'normal');
}
else{
ui.message("gumangiMod_notEnoughPiety", 'normal');
}
}
else if(pItem.type === "waterskin" || pItem.type === "unpurifiedfreshwaterwaterskin" || pItem.type === "seawaterwaterskin" || pItem.type === "desalinatedwaterwaterskin"){
if(godPiety >= 5){
removeItem(pItemId, 'TILE', false);
placeItem({type: "purifiedfreshwaterwaterskin", x: player.x + player.direction.x, y: player.y + player.direction.y, durability: "Random"}, 'TILE', false);
godPiety -= 5;
updateGodStatusBoxes();
ui.message("gumangiMod_prayerGeneric", 'normal');
}
else{
ui.message("gumangiMod_notEnoughPiety", 'normal');
}
}
else if(pItem.type === "bone" || pItem.type === "bones"){
if(godPiety >= 5){
placeItem({type: "cookedmeat", x: player.x + player.direction.x, y: player.y + player.direction.y, decay: 1000}, 'TILE', false);
removeItem(pItemId, 'TILE', false);
godPiety -= 5;
updateGodStatusBoxes();
ui.message("gumangiMod_prayerGeneric", 'normal');
}
else{
ui.message("gumangiMod_notEnoughPiety", 'normal');
}
}
}
catch(err){
//Nothing left to check for here
}
}
}
}
}
//If the god does not know you exist
else{
//If you're next to an altar, the god becomes aware of your existence.
if(isFacingAltar()){
godKnowsYouExist = true;
updateGodStatusBoxes();
ui.message("gumangiMod_godAwakened", 'normal');
}
//Otherwise, you get a message that the god is sleeping.
else{
ui.message("gumangiMod_godSleeping", 'normal');
}
}
//finish
passTurn(true);
try{
e.PreventDefault();
}
catch(error){
}
});
$("#equipmentwindow").on("click",'#sacrifice',function(e){
//You must be facing a fiery altar to make a sacrifice
if(isFacingAltar()){
//You must have a skullcap and a stone knife to make a sacrifice. This feature has not been implemented yet.
if(true){
//It must be late at night to make a sacrifice
if(player.light >= 0.85){
//You can't have anything blocking your sacrifice (including fire from a previous sacrifice)
if(tile[player.x + player.direction.x][player.y + player.direction.y].envItemList === undefined){
try{
//Check for tile items
//if there are not any, this should cause an error and it should skip down to the next part
var sacrificeStack = Object.keys(tile[player.x + player.direction.x][player.y + player.direction.y].tileitems); //the stack of items in front of you
var pietyFromSacrificeStack = 0; //sum of all the item piety added up
//loop through all the items in the stack and add the piety value from each item
for(var i = 0; i < sacrificeStack.length; i++){
//may go out of bounds in the itemSP array, so try/catch errors here
try{
pietyFromSacrificeStack += itemSP[items[tileItems[sacrificeStack[i]].type].id];
}
catch(err){
}
}
//awaken the god if it does not know you exist yet, and then move on to everything else
if(godKnowsYouExist === false){
godKnowsYouExist = true;
updateGodStatusBoxes();
ui.message("gumangiMod_godAwakened", 'normal');
}
//if sum of piety is greater than 0, the god is amused
if(pietyFromSacrificeStack > 0){
try{
for(var i = 0; i < sacrificeStack.length; i++){
removeItem(sacrificeStack[i], 'TILE', false);
}
}
catch(err){
}
ui.message("gumangiMod_sacriMsgEnjoysTheOffer", 'normal');
placeEnvItem({type: "fire", x: player.x + player.direction.x, y: player.y + player.direction.y, mindur: 0, maxdur: 0, quality: ''});
}
//if sum of piety is equal to 0, the god is indifferent
else if(pietyFromSacrificeStack === 0){
ui.message("gumangiMod_sacriMsgIndifferentToOffer", 'normal');
}
//if sum of piety is less than 0, the god is offended
else if(pietyFromSacrificeStack < 0){
ui.message("gumangiMod_sacriMsgOffendedByOffer", 'normal');
}
//add (or subtract) the sum to your god piety
if(pietyFromSacrificeStack != 0){
godPiety += pietyFromSacrificeStack;
updateGodStatusBoxes();
}
}
catch(error){
//if there are no items then it will offend the god
//if the god does not know you exist, wake the god up
if(godKnowsYouExist === false){
godKnowsYouExist = true;
updateGodStatusBoxes();
ui.message("gumangiMod_godAwakened", 'normal');
}
ui.message("gumangiMod_sacriMsgOffendedAtNoOffer", 'normal');
godPiety -= 1;
updateGodStatusBoxes();
}
}
//if something is blocking your sacrifice it tells you
else{
ui.message("gumangiMod_sacriBlocking", 'normal');
}
}
//if it's not late at night it tells you
else{
ui.message("gumangiMod_sacriMsgNotNight", 'normal');
}
}
//if you don't have a skullcap and a stone knife it tells you
else{
ui.message("gumangiMod_sacriMsgNoOutfit", 'normal');
}
}
//if you're not facing a fiery altar it tells you
else{
ui.message("gumangiMod_sacriMsgNotAltar", 'normal');
}
//finish
passTurn(true);
try{
e.PreventDefault();
}
catch(error){
}
});
//Checks to see if you are facing an altar and then returns true or false
//Altars can be configured in directions North, East, South, or West
function isFacingAltar(){
var isFacing = false;
try{
isFacing =
(
(
(
(
tile[player.x + - 1][player.y + (player.direction.y * 2)].type === "stonewall"
&&
tile[player.x][player.y + (player.direction.y * 2)].type === "stonewall"
&&
tile[player.x + 1][player.y + (player.direction.y * 2)].type === "stonewall"
&&
tile[player.x - 1][player.y + player.direction.y].type === "cobblestone"
&&
tile[player.x][player.y + player.direction.y].type === "cobblestone" || tile[player.x][player.y + player.direction.y].type === "ash"
&&
tile[player.x + 1][player.y + player.direction.y].type === "cobblestone"
)
||
(
tile[player.x - 1][player.y + (player.direction.y * 2)].type === "sandstonewall"
&&
tile[player.x][player.y + (player.direction.y * 2)].type === "sandstonewall"
&&
tile[player.x + 1][player.y + (player.direction.y * 2)].type === "sandstonewall"
&&
tile[player.x - 1][player.y + player.direction.y].type === "sandstonefloor"
&&
tile[player.x][player.y + player.direction.y].type === "sandstonefloor" || tile[player.x][player.y + player.direction.y].type === "ash"
&&
tile[player.x + 1][player.y + player.direction.y].type === "sandstonefloor"
)
)
&&
(
envItems[tile[player.x + player.direction.x - 1][player.y + player.direction.y].envItemList[0]].type === "campfire_lit"
&&
true
&&
envItems[tile[player.x + player.direction.x + 1][player.y + player.direction.y].envItemList[0]].type === "campfire_lit"
)
)
||
(
(
(
tile[player.x + (player.direction.x * 2)][player.y - 1].type === "stonewall"
&&
tile[player.x + (player.direction.x * 2)][player.y].type === "stonewall"
&&
tile[player.x + (player.direction.x * 2)][player.y + 1].type === "stonewall"
&&
tile[player.x + player.direction.x][player.y - 1].type === "cobblestone"
&&
tile[player.x + player.direction.x][player.y].type === "cobblestone" || tile[player.x][player.y + player.direction.y].type === "ash"
&&
tile[player.x + player.direction.x][player.y + 1].type === "cobblestone"
)
||
(
tile[player.x + (player.direction.x * 2)][player.y - 1].type === "sandstonewall"
&&
tile[player.x + (player.direction.x * 2)][player.y].type === "sandstonewall"
&&
tile[player.x + (player.direction.x * 2)][player.y + 1].type === "sandstonewall"
&&
tile[player.x + player.direction.x][player.y - 1].type === "sandstonefloor"
&&
tile[player.x + player.direction.x][player.y].type === "sandstonefloor" || tile[player.x][player.y + player.direction.y].type === "ash"
&&
tile[player.x + player.direction.x][player.y + 1].type === "sandstonefloor"
)
)
&&
(
envItems[tile[player.x + player.direction.x][player.y - 1].envItemList[0]].type === "campfire_lit"
&&
true
&&
envItems[tile[player.x + player.direction.x][player.y + 1].envItemList[0]].type === "campfire_lit"
)
)
);
}
catch(err){
isFacing = false;
}
return isFacing;
}
//Updates the status boxes
function updateGodStatusBoxes(){
//update the box that displays the god's mood
$("#godMoodBox").empty();
if(godKnowsYouExist){
for(var i = 0; i < godMoods.length; i++){
try{
var thePietyMin = godMoods[i].pietyMin;
var thePietyMax = godMoods[i].pietyMax;
var theText = godMoods[i].text;
var theColor = godMoods[i].color;
if(thePietyMin === "none" ){
if(godPiety <= thePietyMax){
$("<span/>", {id: "godMood",text: theText + " (" + godPiety + ")",color: theColor}).appendTo("#godMoodBox");
break;
}
}
else if(thePietyMax === "none"){
if(godPiety >= thePietyMin){
$("<span/>", {id: "godMood",text: theText + " (" + godPiety + ")",color: theColor}).appendTo("#godMoodBox");
break;
}
}
else{
if(godPiety >= thePietyMin && godPiety <= thePietyMax){
$("<span/>", {id: "godMood",text: theText + " (" + godPiety + ")",color: theColor}).appendTo("#godMoodBox");
break;
}
}
}
catch(err){
}
}
}
else{
$("<span/>", {id: "godMood",text: godMood_none.text + " (" + godPiety + ")",color: godMood_none.color}).appendTo("#godMoodBox");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment