Add Peter & Clara happiness conditions
[wgj58.git] / wgj58.js
index b528662d13d32c7187e3314c16458dcaa76b7a56..66344a869c6aef49a03cbf89359ecd4ac78b4e37 100644 (file)
--- a/wgj58.js
+++ b/wgj58.js
@@ -281,8 +281,6 @@ class NPC_Clara extends GameNPC {
                                        { actor: logic.player, text: "Would you go out on a date with me?" },
                                        { actor: this, text: "..." },
                                        { actor: this, text: "No." } ] ));
-                               // FIXME: Clara should have another happy condition.
-                               this.makeHappy();
                                break;
                        default:
                                logic.gameinterface.talk(new Dialogue( [ { actor: this, text: "..." } ] ));
@@ -422,8 +420,7 @@ class NPC_Saiki extends GameNPC {
                                                { actor: logic.player, text: "Haha! I always get it, Saiki!" } ] ));
                                        logic.closeDoor("carlosdoor");
                                        logic.openDoor("saikidoor");
-                                       // FIXME: Abrupt game over.
-                                       if (!logic.carlos.pigsemen) game.time.events.add(Phaser.Timer.SECOND * 15, game.state.start, game.state, 'GameOver', false);
+                                       logic.openDoor("peterdoor");
                                        break;
                                case 1:
                                        logic.gameinterface.talk(new Dialogue( [ { actor: this, text: "Now that I think about it, there's still one thing. You could look into why the access control system is acting so funny today." },
@@ -511,9 +508,8 @@ class NPC_Saiki extends GameNPC {
        actionTake() {
                logic.closeDoor("carlosdoor");
                logic.openDoor("saikidoor");
+               logic.openDoor("peterdoor");
                logic.carlos.kill();
-               // FIXME: Abrupt game over.
-               game.time.events.add(Phaser.Timer.SECOND * 15, game.state.start, game.state, 'GameOver', false);
                return super.actionTake();
        }
 
@@ -521,12 +517,6 @@ class NPC_Saiki extends GameNPC {
                return (logic.carlos.alive);
        }
 
-       makeHappy() {
-               // FIXME: Abrupt game over.
-               game.time.events.add(Phaser.Timer.SECOND * 15, game.state.start, game.state, 'GameOver', false);
-               super.makeHappy();
-       }
-
        tpDone(value) {
                console.log("Woot-woot! Teleport complete:", value);
                value.makeHappy();
@@ -536,6 +526,112 @@ class NPC_Saiki extends GameNPC {
        }
 }
 
+class NPC_Peter extends GameNPC {
+       actionTalk() {
+               if (logic.carlos.alive) {
+                       switch (this.talkcount) {
+                               case 0:
+                                       logic.gameinterface.talk(new Dialogue( [ { actor: logic.player, text: "Hi Peter! What's up?" },
+                                               { actor: this, text: "Hi John! Bianca has locked herself in the large meeting room." },
+                                               { actor: logic.player, text: "Why would she do that?" },
+                                               { actor: this, text: "I have no idea." },
+                                               { actor: this, text: "Normally, I would give a fuck about what she's doing and her problems, but I want to hold a meeting in an hour." },
+                                               { actor: logic.player, text: "That was rude. I think you should care more about your colleagues." },
+                                               { actor: this, text: "Ahh... You're right. I didn't mean it. I'm just so frustrated about all the shit going on here." } ] ));
+                                       logic.closeDoor("saikidoor");
+                                       logic.openDoor("peterdoor");
+                                       logic.openDoor("biancadoor");
+                                       break;
+                               case 1:
+                                       logic.gameinterface.talk(new Dialogue( [ { actor: this, text: "See... Would you talk to Bianca? We don't understand each other pretty well. That's why I'd rather wouldn't make a shot." } ] ));
+                                       break;
+                               default:
+                                       if ((logic.clara.talkcount >= 5) && (this.talkcount == 2)) {
+                                               logic.gameinterface.talk(new Dialogue( [ { actor: logic.player, text: "Do you know Clara from the Reception?" },
+                                                       { actor: this, text: "Of course I do." },
+                                                       { actor: logic.player, text: "I think she's mad at me..." },
+                                                       { actor: this, text: "Why would she?" },
+                                                       { actor: logic.player, text: "I kind of... asked her out." },
+                                                       { actor: logic.player, text: "She said no." },
+                                                       { actor: this, text: "What the heck, dude?" },
+                                                       { actor: this, text: "..." },
+                                                       { actor: this, text: "You should know it's against the company etiquette..." },
+                                                       { actor: this, text: "Regardless, I don't think she's really mad. You're a cool guy." },
+                                                       { actor: logic.player, text: "I hope this will be sorted out... I totally accept her answer, but I wouldn't like her to have negative feelings towards me." } ] ));
+                                               this.offscreenTeleportation(new Phaser.Point(logic.clara.x - 160, logic.clara.y), this.tpDone, this);
+                                       }
+                                       else {
+                                               logic.gameinterface.talk(new Dialogue( [ { actor: this, text: "I'm kind of busy, man." } ] ));
+                                       }
+                       }
+               }
+               else {
+                       switch (this.talkcount) {
+                               case 0:
+                                       logic.gameinterface.talk(new Dialogue( [ { actor: logic.player, text: "What a wonderful day, Peter!" },
+                                               { actor: this, text: "Yikes! Saiki! You scared me!" },
+                                               { actor: logic.player, text: "I didn't even say \"boo\"." },
+                                               { actor: this, text: "Are you OK? You look horrible! You should really see a doctor." },
+                                               { actor: logic.player, text: "I'm fine, Peter. And you?" },
+                                               { actor: this, text: "No... Not at all." },
+                                               { actor: logic.player, text: "I'm sorry to hear that..." } ] ));
+                                       break;
+                               case 1:
+                                       logic.gameinterface.talk(new Dialogue( [ { actor: this, text: "Don't come closer to me!" },
+                                               { actor: logic.player, text: "Why?" },
+                                               { actor: this, text: "I don't mean to offend you, but... you really creep me out..." },
+                                               { actor: logic.player, text: "Why do you say that?" },
+                                               { actor: this, text: "I honestly can't tell what's wrong with you, but... you look like that ghost girl from The Ring!" } ] ));
+                                       break;
+                               case 2:
+                                       logic.gameinterface.talk(new Dialogue( [ { actor: logic.player, text: "Now that was pretty much racist..." },
+                                               { actor: logic.player, text: "Just because I have a Japanese name and long black hair, that makes me immediately look like the Japanese girl from Ring when I'm sick?" },
+                                               { actor: this, text: "Geez... that's not even a Japanese movie! And the actress is American..." },
+                                               { actor: logic.player, text: "The original movie is Japanese." },
+                                               { actor: this, text: "I don't care... Just... keep distance, please!" } ] ));
+                                       break;
+                               default:
+                                       if (Phaser.Math.random() < 0.5) {
+                                               logic.gameinterface.talk(new Dialogue( [ { actor: this, text: "STAY AWAY FROM ME!" } ] ));
+                                       }
+                                       else {
+                                               logic.gameinterface.talk(new Dialogue( [ { actor: this, text: "DON'T COME ANY CLOSER!" } ] ));
+                                       }
+                       }
+               }
+               super.actionTalk();
+       }
+
+       actionTake() {
+               logic.closeDoor("saikidoor");
+               logic.openDoor("peterdoor");
+               logic.openDoor("biancadoor");
+               return super.actionTake();
+       }
+
+       endTalk() {
+               return (logic.saiki.alive) && (this.talkcount < 3);
+       }
+
+       tpDone(value) {
+               console.log("Woot-woot! Teleport complete:", value);
+               value.makeHappy();
+               logic.clara.makeHappy();
+               // FIXME: Need to find a prettier way than this.
+               logic.clara.update = function() { };            // Disable Clara's interaction. (Peter will talk for him.)
+       }
+}
+
+class NPC_Bianca extends GameNPC {
+       actionTake() {
+               // All doors open for you if you have all the cards.
+               logic.openDoor("cutedoor");
+               logic.openDoor("carlosdoor");
+               logic.openDoor("saikidoor");
+               return super.actionTake();
+       }
+}
+
 
 class GameInterface extends Phaser.Group {
        constructor(game, parent) {
@@ -754,6 +850,14 @@ class GameLogic {
                                newChar = new NPC_Saiki(object.x, object.y, 'saiki', "Saiki", "Saiki Ytpme", 150);
                                this.saiki = newChar;
                                break;
+                       case 'peter':
+                               newChar = new NPC_Peter(object.x, object.y, 'peter', "Peter", "Peter Tluaf", 225);
+                               this.peter = newChar;
+                               break;
+                       case 'bianca':
+                               newChar = new NPC_Bianca(object.x, object.y, 'bianca', "Bianca", "Bianca Gnihton", 150);
+                               this.bianca = newChar;
+                               break;
                        default:
                                console.error("Unknown character:", object);
                }
@@ -848,6 +952,8 @@ class GamePlay extends Phaser.State {
                game.load.image('clara', 'clara.png');
                game.load.image('carlos', 'carlos.png');
                game.load.image('saiki', 'saiki.png');
+               game.load.image('peter', 'peter.png');
+               game.load.image('bianca', 'bianca.png');
                game.load.image('tileset', 'tileset.png');
                game.load.image('objects', 'objects.png');
                game.load.tilemap('gamemap', 'tilemap.json', null, Phaser.Tilemap.TILED_JSON);