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

101 lines
3.1 KiB
CoffeeScript
Raw Permalink 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
2016-01-20 18:48:30 +02:00
room = require("../../lib/room.coffee")
obj = require('../../lib/obj.coffee')
oneOf = require('../../lib/oneOf.coffee')
2016-02-08 13:38:44 +02:00
Salet = require('../../lib/salet.coffee')
salet = new Salet
salet.game_id = "6a9909a4-586a-4089-bd18-26da684d1c8d"
salet.game_version = "2.0"
salet.init = () ->
_paq.push(['setCustomDimension', 1, false])
@character.view_smash = 1
@character.money = 0
@character.code = ""
@character.knows_the_code = 0
@character.box_opened = 0
$(document).ready(() ->
salet.beginGame()
)
2015-12-29 08:56:27 +02:00
2016-01-20 18:48:30 +02:00
way_to = (content, ref) ->
return "<a href='#{ref}' class='way'>#{content}</a>"
2016-02-08 13:38:44 +02:00
objlink = (content, ref) ->
return "<a href='./_act_#{ref}' class='once'>#{content}</a>"
2016-01-04 04:02:34 +02:00
2016-02-08 13:38:44 +02:00
money = (salet, amount) ->
salet.character.money = salet.character.money + amount
2015-12-29 08:56:27 +02:00
2016-02-08 13:38:44 +02:00
code_can_input = (salet) ->
return salet.character.code.length < 8
2015-12-30 08:08:10 +02:00
2016-02-08 13:38:44 +02:00
code_print = (salet) ->
mask = 8 - salet.character.code.length
retval = salet.character.code
2016-01-03 07:11:38 +02:00
if mask > 0
for i in [1..mask]
2016-03-10 16:49:48 +02:00
retval += 'x'
retval = '<tt>'+retval+'</tt>'
2016-01-03 07:11:38 +02:00
return retval
2016-02-08 13:38:44 +02:00
code_input = (salet, digit) ->
if code_can_input(salet)
salet.character.code = salet.character.code + digit
2016-03-10 16:49:48 +02:00
return false
2015-12-30 08:08:10 +02:00
2016-02-08 13:38:44 +02:00
code_reset = (salet) ->
salet.character.code = ""
2015-12-30 08:08:10 +02:00
2016-02-08 13:38:44 +02:00
code_check = (salet) ->
output = ""
if salet.character.code.length >= 8
2016-01-01 16:05:30 +02:00
# There is an Undum.. let's call it a feature
# that prevents the player from entering "3112".
# You see, you can't select the situation 1 when you are
# already in this situation, so you can't input 1 twice.
2016-02-08 13:38:44 +02:00
if salet.character.code == "01012017"
salet.character.box_opened = 1
if salet.character.knows_the_code == 0
output += """
Is he an extraordinary puzzle cracker or was it a sheer luck, but Ronald manages to *guess* the code.
2016-02-08 13:38:44 +02:00
"""
else
2016-02-08 13:38:44 +02:00
output += """
New Year 2017.
L. Y. must be Leonard Yakovlev, a famous painter.
Some tabloids tried to connect him with Ana but it seemed like a weak link.
By that logic, his sketch is worth more than all the cash here.
Ronald thinks about it, but decides to "let the woman have her memories".
2016-02-08 13:38:44 +02:00
"""
output += """
\n\n
2015-12-30 08:08:10 +02:00
Something clicks and box opens.
The phone is slick, black and light in Ronald's hand.
It springs to life, humming with purpose.
The screen plays an animation: "LOADING..."
Ronald has no other business here.
It's time to go.
2016-02-08 13:38:44 +02:00
"""
salet.goTo("bedroom")
else
2016-02-08 13:38:44 +02:00
output += "Something clicks and the display resets, but the box stays locked."
2016-01-02 10:17:36 +02:00
2016-02-08 13:38:44 +02:00
code_reset(salet)
return output
2015-12-30 08:08:10 +02:00
2016-02-08 13:38:44 +02:00
room "start", salet,
2016-03-10 14:57:05 +02:00
extendSection: true,
2016-01-20 18:48:30 +02:00
dsc: """
2015-12-29 08:56:27 +02:00
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.
2016-01-20 18:48:30 +02:00
He began the inspection from #{way_to('the living room.', 'living-room')}
2015-12-29 08:56:27 +02:00
"""