diff --git a/js/dialogue.js b/js/dialogue.js index a648ca6..54b986c 100644 --- a/js/dialogue.js +++ b/js/dialogue.js @@ -85,6 +85,7 @@ function DialogUI( stage, gameState ){ messages["custom"] = ["Me: " + textSeq.customText ]; } + if( textSeq.random ){ that.showRandomConvo(); return; @@ -95,7 +96,7 @@ function DialogUI( stage, gameState ){ that.endFunc = textSeq.endFunc || function(){}; - that.textContent.text=nextDialogue[1]; + that.textContent.text=nextDialogue[1].replace(/\[GenderPronoun\]/g, gameState.pronoun ).replace(/\[Player\]/g, gameState.name ); that.currentFace.y = 250; that.currentFace = peopleImg[nextDialogue[0]] || that.currentFace; that.autoAdvance = textSeq.autoAdvance; @@ -166,7 +167,7 @@ function DialogUI( stage, gameState ){ tick: function(){ delayCounter = new Date().getTime() - oldTime; - if( that.autoAdvance == true && that.dialogBox.y ==0 && delayCounter > ( (that.textContent.text.length * MILLIS_PER_CHAR) < 2000 ? 200 : (that.textContent.text.length * MILLIS_PER_CHAR) ) ){ + if( that.autoAdvance == true && that.dialogBox.y ==0 && delayCounter > ( (that.textContent.text.length * MILLIS_PER_CHAR) < 2000 ? 2000 : (that.textContent.text.length * MILLIS_PER_CHAR) ) ){ clickEvent(); } diff --git a/js/main.js b/js/main.js index 77fc7ee..d6d6dd0 100644 --- a/js/main.js +++ b/js/main.js @@ -11,6 +11,7 @@ function GameState(){ this.gameStarted = false; this.name = ""; this.gender = "Male"; + this.pronoun = "he"; this.wallet = 45.00; this.hard = false; this.boughtOvenLight = false; diff --git a/js/screens.js b/js/screens.js index 37a8529..a74716a 100644 --- a/js/screens.js +++ b/js/screens.js @@ -216,9 +216,11 @@ function DifficultyScreen( stage, gameState ){ if( gender == "Male" ){ that.maleSelection.alpha = 1; that.femaleSelection.alpha = 0; + gameState.pronoun = "he"; }else{ that.maleSelection.alpha = 0; that.femaleSelection.alpha = 1; + gameState.pronoun = "she"; } }) return { diff --git a/js/stories.js b/js/stories.js index 89aa6e1..9d60e42 100644 --- a/js/stories.js +++ b/js/stories.js @@ -1,6 +1,6 @@ var messages = { "Null":["Me: "], - "KitchenInitial" : ["Me: I need to buy a turkey..."], + "KitchenInitial" : ["Me: I should run to the store and buy a delicious turkey!"], "CannotBuyTurkey" : ["Me: I barely have time for ONE turkey, let alone TWO!"], "NoMoney" : ["Me: I can't afford this!"], "BuyTurkeyFirst" : ["Me: I should buy a turkey first!"], @@ -661,5 +661,4 @@ var story = { "Cat: Purrrsonally, not as bad as yours.", "Turkey: Gobble Gobble"] - }; diff --git a/js/ui.js b/js/ui.js index ffb7352..c460a09 100644 --- a/js/ui.js +++ b/js/ui.js @@ -405,6 +405,17 @@ function OvenUI( stage, gameState ){ handleBar.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); handleBar.addEventListener( "pressup", handlePress ); + var evalSkin = { + "raw": "The turkey looks no different from when I put it in", + "undercooked": "The skin looks pink", + "slightly cooked": "The turkey could use a couple more minutes", + "cooked": "The turkey looks good enough to eat", + "overcooked": "The turkey looks a bit shriveled", + "dry": "The turkey looks like cardboard", + "burnt": "The turkey looks burnt" + }; + + // Look for a drag event function handlePress(event) { if( event.stageY > 300 && that.ovenDoor != OVEN_OPEN ){ @@ -418,8 +429,8 @@ function OvenUI( stage, gameState ){ if( gameState.turkeyBought ){ var state = gameState.ovenModel.getTurkeyState(); - gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:"Hmm... Looks " + turkeyState["skin"]["cond"][2] + "." } ); - gameState.pubsub.publish( "AddRecord", {type:"Open ", text:"The turkey looked " + turkeyState["skin"]["cond"][2]} ); + gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:evalSkin[turkeyState["skin"]["cond"][2]] + "." } ); + gameState.pubsub.publish( "AddRecord", {type:"Open ", text:evalSkin[turkeyState["skin"]["cond"][2]]} ); gameState.ovenModel.setRawTemp( (gameState.ovenModel.getRawTemp() - 25) < 150 ? 150 : gameState.ovenModel.getRawTemp() - 25 ); gameState.ovenOpened++; } @@ -450,8 +461,8 @@ function OvenUI( stage, gameState ){ handleBar.y = 48; if( gameState.turkeyBought ){ var state = gameState.ovenModel.getTurkeyState(); - gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:"Looks " + turkeyState["skin"]["cond"][2] } ); - gameState.pubsub.publish( "AddRecord", {type:"Peek ", text:"The turkey looked " + turkeyState["skin"]["cond"][2]} ); + gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:evalSkin[turkeyState["skin"]["cond"][2]] } ); + gameState.pubsub.publish( "AddRecord", {type:"Peek ", text:"The turkey looked " +turkeyState["skin"]["cond"][2]} ); } } else if (that.ovenDoor == OVEN_PEEK){ @@ -504,6 +515,8 @@ function OvenUI( stage, gameState ){ for(var i = 0; i < 1200; i++){ that.secondTick( 1000 ); } + if( gameState.alarmActivated ) + gameState.alarmTimer -= 1200; gameState.pubsub.publish("DoneSkipTime",""); });