1
0
Fork 0
mirror of https://gitlab.com/Oreolek/black_phone.git synced 2024-07-05 16:24:30 +03:00
black_phone/game/begin.coffee

72 lines
2.6 KiB
CoffeeScript
Raw Normal View History

2015-12-29 08:56:27 +02:00
# copyright (c) Alexander Yakovlev 2015.
# This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
# To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0
situation = require('raconteur')
undum = require('undum-commonjs')
oneOf = require('raconteur/lib/oneOf.js')
qualities = require('raconteur/lib/qualities.js')
$ = require("jquery")
Array.prototype.oneOf = () ->
oneOf.apply(null, this)
md = require('markdown-it')
markdown = new md({
typographer: true,
html: true
})
shortid = require('shortid')
# you have to alter linkRe in Undum core to use that.
# Undum doesn't allow using uppercase letters in situation names by default.
undum.game.id = "6a9909a4-586a-4089-bd18-26da684d1c8d"
undum.game.version = "1.0"
a = require('raconteur/lib/elements.js').a
way_to = (content, ref) -> a(content).class('way').ref(ref)
textlink = (content, ref) -> a(content).once().writer(ref)
textcycle = (content, ref) -> a(content).replacer(ref).class("cycle").id(ref).toString()
# usage: writemd( system, "Text to write")
writemd = (system, text) ->
if typeof text is Function
text = text()
system.write(markdown.render(text))
money = (character, system, amount) ->
system.setQuality("money", character.qualities.money + amount)
situation "start",
content: """
Peter had so much trouble sleeping he had to drown his pills in at least an hour of thoughts.
A violent ringing of the bell awakened him.
He rose from the bed, grumbling:
Crazy neighbors and their guests. It must be three o'clock!”
The visitor entered the hallway.
It was him ringing the bell, but he was not going to meet Peter.
In fact, he wasn't looking for meeting anybody here.
Fourth floor, apartment 406.
There, he tried four keys.
The third of them fitted the lock.
Burglary is a curious line of employment.
Befittedly, Ronald Chernoff was very curious about a black phone behind the door of apartment 406 in a wooden box on a small table no farther than two meters from the bed.
A gift, a prototype, a valuable treasure left by Anastacia Kozlowa when she fled the country.
Of course, one had to be reasonably au fait with her *Instagram* to notice that.
Peter opened his door to find an empty silent corridor.
He went to the neighbor's door and met a closed door.
Ronald was working inside, quietly walking around the apartment.
He began the inspection from [the living room.](living-room)
"""
is_visited = (situation) ->
situations = undum.game.situations[situation]
if situations
return Boolean situations.visited
return 0