From bb7b377eb37b905c8e3d33f4340fcf18c480b842 Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Mon, 4 Jan 2016 09:02:34 +0700 Subject: [PATCH] Issue #3: less text on screen --- game/begin.coffee | 38 ++++- game/story.coffee | 347 ++++++++++++++++++++++++++++------------------ 2 files changed, 248 insertions(+), 137 deletions(-) diff --git a/game/begin.coffee b/game/begin.coffee index 9356e3b..69448ff 100644 --- a/game/begin.coffee +++ b/game/begin.coffee @@ -33,7 +33,20 @@ textcycle = (content, ref) -> a(content).replacer(ref).class("cycle").id(ref).to writemd = (system, text) -> if typeof text is Function text = text() - system.write(markdown.render(text)) + text = markdown.render(text) + system.write(text) + +preparemd = (text, mark) -> + if typeof text is Function + text = text() + text = markdown.render(text) + if mark? + text = """ +
+ #{text} +
+ """ + return text money = (character, system, amount) -> system.setQuality("money", character.qualities.money + amount) @@ -136,3 +149,26 @@ is_visited = (situation) -> if situations return Boolean situations.visited return 0 + +# N-th level examine function +level = (text, mark) -> + $("#content .#{mark}").fadeOut() + return preparemd(text, mark) + +lvl1 = (text) -> + $("#content .lvl2").fadeOut() + $("#content .lvl3").fadeOut() + $("#content .lvl4").fadeOut() + level(text, "lvl1") + +lvl2 = (text) -> + $("#content .lvl3").fadeOut() + $("#content .lvl4").fadeOut() + level(text, "lvl2") + +lvl3 = (text) -> + $("#content .lvl4").fadeOut() + level(text, "lvl3") + +lvl4 = (text) -> + level(text, "lvl4") diff --git a/game/story.coffee b/game/story.coffee index 10f3cd6..016cde7 100644 --- a/game/story.coffee +++ b/game/story.coffee @@ -17,58 +17,75 @@ situation "living-room", actions: door: (character, system) -> if character.sandbox.box_opened == 0 - writemd(system, "Ronald has a job here. It's still on.") + writemd(system, lvl1("Ronald has a job here. It's still on.")) else system.doLink("exitdoor") writers: - walls: """ - There are colorful photographs on the walls. - A wooden house in a forest. - A village on a mountaintop. - A family sitting around a fire. - A sunset burning in a vast ocean. - A black monolith standing on sand dunes. - """ - window: "The moon is full today. It illuminates the apartment, makes the things stand out in some weird angles." - bookcase: """ - Either Anastacia has a very conflicting taste in books, or she has no taste at all. Let's see... - #{textlink("“Soviet Black Magic: a Lost Art”,", "magic")} - #{textlink("”My Dinner with Zane”,", "zane")} - #{textlink("The Scientific Dictionary of Everything,", "dictionary")} - #{textlink("“Silent Things”,", "silent")} - #{textlink("”Also sprach Zarathustra”,", "zaratustra")} - #{textlink("”Pepperoni poker”,", "pepper")} - #{textlink("”Jazz sauce. Culinary collection”", "culinary")} - and #{textlink("Classico.", "classico")} - """ - magic: """ - ”Soviet Black Magic: a Lost Art” + walls: (character, system) -> + lvl1(""" + There are colorful photographs on the walls. + A wooden house in a forest. + A village on a mountaintop. + A family sitting around a fire. + A sunset burning in a vast ocean. + A black monolith standing on sand dunes. + """) + window: (character, system) -> + lvl1(""" + The moon is full today. + It illuminates the apartment, makes the things stand out in some weird angles. + """) + bookcase: (character, system) -> + lvl1(""" + Either Anastacia has a very conflicting taste in books, or she has no taste at all. Let's see... + #{textlink("“Soviet Black Magic: a Lost Art”,", "magic")} + #{textlink("”My Dinner with Zane”,", "zane")} + #{textlink("The Scientific Dictionary of Everything,", "dictionary")} + #{textlink("“Silent Things”,", "silent")} + #{textlink("”Also sprach Zarathustra”,", "zaratustra")} + #{textlink("”Pepperoni poker”,", "pepper")} + #{textlink("”Jazz sauce. Culinary collection”", "culinary")} + and #{textlink("Classico.", "classico")} + """) + magic: (character, system) -> + lvl2(""" + ”Soviet Black Magic: a Lost Art” - The author, who calls himself The Master, describes the lost art of Soviet Union *magija.* - It's mostly about illusions. + The author, who calls himself The Master, describes the lost art of Soviet Union *magija.* + It's mostly about illusions. - This is a cheap paperback edition, but she read this at least a couple of times. - The pages have dogged ears, and coffee stains too. - Ronald can even see a hint of lipstick smearing the variety show retelling. - """ - zane: """ - A three-part romantic urban fantasy detective about a girl who solves murders while dining - with her best werewolf friend in an Orient café. + This is a cheap paperback edition, but she read this at least a couple of times. + The pages have dogged ears, and coffee stains too. + Ronald can even see a hint of lipstick smearing the variety show retelling. + """) + zane: (character, system) -> + lvl2(""" + A three-part romantic urban fantasy detective about a girl who solves murders while dining + with her best werewolf friend in an Orient café. - It looks rather new, the pages are still white and straight. - Maybe she didn't catch the right moment to read this.. or maybe just forgot about it. - """ - dictionary: "A big fat Dictionary of Everything, issued in 1989. Nobody reads every page of these. Ronald doubts Anastacia got to read at least one page." - silent: "Silent Things, a story where nothing speaks and nothing happens. *And she actually read that.*" + It looks rather new, the pages are still white and straight. + Maybe she didn't catch the right moment to read this.. or maybe just forgot about it. + """) + dictionary: (character, system) -> + lvl2(""" + A big fat Dictionary of Everything, issued in 1989. + Nobody reads every page of these. + Ronald doubts Anastacia got to read at least one page. + """) + silent: (character, system) -> + lvl2(""" + Silent Things, a story where nothing speaks and nothing happens. + *And she actually read that.* + """) zaratustra: (character, system) -> if character.sandbox.seen_zaratustra? - """ + lvl2(""" This book already gave Ronald everything he wanted. No need to read it, not a bit. - """ + """) else money(character, system, 20000) - """ + lvl2(""" Nietsche's four-part novel about The Man, The Superman and everything in-between. It's surprisingly worn down. She took this book out a lot. @@ -78,14 +95,23 @@ situation "living-room", No, of course not. Ronald opens the book and finds a stash of money inside. - """ - pepper: """ - An "ironic woman detective" who plays harp and solves murders! - It's a trash book filled with blatant product placement. Looks untouched. - """ - culinary: "An old culinary book. Nothing about it." - classico: "A history of classical music, from the prehistoric times to the 1970s, a brand new edition with passages about psychedelic rock. The Bach section is bookmarked." - tv: "An expensive 40-something inch TV standing on a stylish black stand. The room looks kinda small for that monster." + """) + pepper: (character, system) -> + lvl2(""" + An "ironic woman detective" who plays harp and solves murders! + It's a trash book filled with blatant product placement. Looks untouched. + """) + culinary: (character, system) -> + lvl2("An old culinary book. Nothing about it.") + classico: (character, system) -> + lvl2(""" + A history of classical music, from the prehistoric times to the 1970s, a brand new edition with passages about psychedelic rock. + The Bach section is bookmarked. + """) + tv: (character, system) -> + lvl1(""" + An expensive 40-something inch TV standing on a stylish black stand. The room looks kinda small for that monster. + """) situation "bedroom", before: () -> @@ -105,101 +131,148 @@ situation "bedroom", else ""} """ writers: - bed: """ + bed: () -> lvl1(""" A double bed with flower-embroidered sheets. She left several days ago. The sheets are still fresh. - """ - wardrobe: """ + """) + wardrobe: () -> lvl1(""" Anastacia's wardrobe is very high-maintenance. It has a built-in ironing board (with an iron hanged nearby), with 5 drawer rows for #{textlink("lingerie,", "lingerie")} #{textlink("accessories", "accessories")}, #{textlink("shoes.", "shoes")}, #{textlink("hats", "hats")} and.. #{textlink("audio players.", "mp3")} On the hangers are #{textlink("cashmere coat,", "coat")} #{textlink("sport jacket,","jacket")} #{textlink("jeans,", "jeans")} #{textlink("green shirt,", "gshirt")} #{textlink("a red sleeveless shirt", "rshirt")}, #{textlink("an orange vest,", "vest")} #{textlink("knee-length flower dress,", "dress")} #{textlink("another flower dress,", "adress")} #{textlink("alpaca coat,","coat")} #{textlink("a short skirt", "skirt")} and #{textlink("a big collection of dancing costumes.", "costumes")} - """ - coat: "A warm coat for the cold winter." - jacket: "A light expensive jacket. An unusual material, must be something high-tech. It's slightly used." - jeans: "Just a pair of women jeans, nothing special." - gshirt: "A green shirt, looks very worn. It's not remarkable in any way but maybe she just loves it very much." - rshirt: "A red women-cut shirt. She didn't wear it much." - vest: "It looks like a life vest but actually it's a fashionable piece of warm clothing. It was trendy last year. *Why do I know this, is something wrong with me?*" - dress: "Just a dress. Lots of flower embroidery, no pockets. Impractical." - adress: "These flowers are not like that flowers." - coat: (character, system) -> """ - #{ + """) + coat: () -> + lvl2("A warm coat for the cold winter.") + jacket: () -> + lvl2(""" + A light expensive jacket. + An unusual material, must be something high-tech. + It's slightly used. + """) + jeans: () -> + lvl2("Just a pair of women jeans, nothing special.") + gshirt: () -> + lvl2(""" + A green shirt, looks very worn. + It's not remarkable in any way but maybe she just loves it very much. + """) + rshirt: () -> + lvl2(""" + A red women-cut shirt. + She didn't wear it much. + """) + vest: () -> + lvl2(""" + It looks like a life vest but actually it's a fashionable piece of warm clothing. + It was trendy last year. + *Why do I know this, is something wrong with me?* + """) + dress: () -> + lvl2(""" + Just a dress. + Lots of flower embroidery, no pockets. + *Impractical.* + """) + adress: () -> + lvl2("These flowers are not like that flowers.") + coat: (character, system) -> if character.sandbox.seen_coat? - "A warm grey alpaca coat for the bleak autumn times. It's one of her favorites." + return lvl2(""" + A warm grey alpaca coat for the bleak autumn times. + It's one of her favorites. + """) else character.sandbox.seen_coat = 1 money(character, system, 4000) - "A warm coat.. hey, what's this? One of the pockets is loaded with cash!" - } - """ - skirt: "This hanger has only a short skirt. Maybe there was something else on it? Who knows." - costumes: "Ana is an exotic dancer. She has her own dance style, and these exquisite costumes are made just for her moves and motions." - mp3: """ - Wow, this woman LOVES her players! + return lvl2(""" + A warm coat.. hey, what's this? + One of the pockets is loaded with cash! + """) + skirt: () -> + lvl2(""" + This hanger has only a short skirt. + Maybe there was something else on it? + Who knows. + """) + costumes: () -> + lvl2(""" + Ana is an exotic dancer. + She has her own dance style, and these exquisite costumes are made just for her moves and motions. + """) + mp3: () -> + lvl2(""" + Wow, this woman LOVES her players! - There are MP3 players, CD players, portable DVD, walk-on clips, sport hands-free players, underwater ones. + There are MP3 players, CD players, portable DVD, walk-on clips, sport hands-free players, underwater ones. - These are all rather cheap, though, compared to *something else* in this room. - """ - hats: "These look very old-style, very Mary Poppins-like.Maybe that's just a trend or whatever.", - lingerie: "Ronald won't be digging in that." - accessories: """ - A cross necklace, three metal bracelets and lots of uncomplicated earrings and hair pins. - A dozen of scarfs or so. - No diamonds, no rings, no *jewelry.* + These are all rather cheap, though, compared to *something else* in this room. + """) + hats: () -> + lvl2(""" + These look very old-style, very Mary Poppins-like. + Maybe that's just a trend or whatever. + """ + lingerie: () -> + lvl2("Ronald won't be digging in that.") + accessories: () -> + lvl2(""" + A cross necklace, three metal bracelets and lots of uncomplicated earrings and hair pins. + A dozen of scarfs or so. + No diamonds, no rings, no *jewelry.* - On the other hand, her Instagram nickname is *bareboned mane shaker.* - """ - shoes: """ - Anastacia doesn't care for the footwear fashion. - These 4 pairs of combat boots and 13 pairs of ballet flats can attest that. + On the other hand, her Instagram nickname is *bareboned mane shaker.* + """) + shoes: () -> + lvl2(""" + Anastacia doesn't care for the footwear fashion. + These 4 pairs of combat boots and 13 pairs of ballet flats can attest that. - Of course, there are sandals, loafers, flat dress shoes.. That's a strong dislike for heels... or maybe it's a medical problem? - """ - mirror: """ - The mirror looks directly at the bed. - Kinky, though not very much *Feng Shui* in it. + Of course, there are sandals, loafers, flat dress shoes.. That's a strong dislike for heels... or maybe it's a medical problem? + """) + mirror: () -> + lvl1(""" + The mirror looks directly at the bed. + Kinky, though not very much *Feng Shui* in it. - #{textlink("The frame","frame")} depicts various artists (all women) making sculptures of men. - It's a very *unusual* art. - """ - frame: """ - On a close examination, the frame isn't attached to the wall. - There is #{textlink("a safe", "safe")} behind the mirror! - """ - safe: (character) -> """ - #{if character.sandbox.seen_safe? - """ + #{textlink("The frame","frame")} depicts various artists (all women) making sculptures of men. + It's a very *unusual* art. + """) + frame: () -> + lvl2(""" + On a close examination, the frame isn't attached to the wall. + There is #{textlink("a safe", "safe")} behind the mirror! + """) + safe: (character) -> + if character.sandbox.seen_safe? + return lvl3(""" The safe is locked with a regular lock. Ronald tries two keys. The first of them opens the door. There are #{textlink("money", "money")} inside, and #{textlink("a rough sketch.", "sketch")} - """ + """) else - """ + return lvl3(""" The safe is open now. There is #{textlink("a rough sketch", "sketch")} inside. - """ - } - """ + """) money: (character, system) -> character.sandbox.seen_safe = 1 money(character, system, 50000) - """ + lvl4(""" It's a big cash. Odd that she didn't take this when she left. But someone's fault just makes Ronald's payday now. - """ - sketch: """ - It's a portrait of Anastacia. - She bites her lower lip slightly. - Her eyes are sad, or maybe concerned with something. - The sketch is signed: *"L. Y. - 2017"* - """ + """) + sketch: () -> + lvl4(""" + It's a portrait of Anastacia. + She bites her lower lip slightly. + Her eyes are sad, or maybe concerned with something. + The sketch is signed: *"L. Y. - 2017"* + """) situation "kitchen", before: () -> @@ -210,35 +283,36 @@ situation "kitchen", The white, perfectly clean kitchen could be called spartan: #{textlink("a fridge,", "fridge")} a microwave and #{textlink("a big table", "table")} where one can eat whatever she "cooked" that way. """ writers: - fridge: """ - No magnets or stickers on the outside. - The door opens easily. - *If only the hinges on the apartment doors were as good as refrigerator ones.* + fridge: () -> + lvl1(""" + No magnets or stickers on the outside. + The door opens easily. + *If only the hinges on the apartment doors were as good as refrigerator ones.* - A hearty bunch of salad. + A hearty bunch of salad. - Some fruits, carrots, two beets. + Some fruits, carrots, two beets. - Three eggs, one cracked. + Three eggs, one cracked. - A bottle of ketchup, bottle of whiskey, valerian vial. + A bottle of ketchup, bottle of whiskey, valerian vial. - A jar of raspberry preserve, half-finished. + A jar of raspberry preserve, half-finished. - And enough frozen pizzas to last a month. - """ + And enough frozen pizzas to last a month. + """) table: (character, system) -> if character.sandbox.seen_table? - "A letter's still there. Nothing new about it." + return lvl1("A letter's still there. Nothing new about it.") else character.sandbox.seen_table = 1 - """ + return lvl1(""" There's something on the table. It looks like a formal letter. It's in French, though, so Ronald won't be able to read it. He's sure it's recent (`24.03.2018`) and it's about something-something QUANTUM AUDIO.. armement? - """ + """) situation "bathroom", before: (character,system) -> @@ -265,20 +339,21 @@ situation "balcony", writers: ashtray: (character) -> character.sandbox.knows_the_code = 1 - return """ + return lvl1(""" She completely smoked out two cigarettes here. There's also a #{textlink("piece of paper nearby,", "paper")} half-burnt. - """ - paper: """ - It's a letter, written by hand on a thick sheet of what must be an A4 paper. - The handwriting is wobbly and the first three quarters of the sheet is gone, but the ending is legible. + """) + paper: () -> + lvl2(""" + It's a letter, written by hand on a thick sheet of what must be an A4 paper. + The handwriting is wobbly and the first three quarters of the sheet is gone, but the ending is legible. - *...ok at them, celebrating the New Year, think of our anniversary. - The day of White. - I will fly to you no matter what.* + *...ok at them, celebrating the New Year, think of our anniversary. + The day of White. + I will fly to you no matter what.* -     *L. Y.* - """ +     *L. Y.* + """) situation "box", before: () ->