1
0
Fork 0
mirror of https://gitlab.com/Oreolek/black_phone.git synced 2024-06-16 23:20:59 +03:00

The box puzzle

This commit is contained in:
Alexander Yakovlev 2015-12-30 13:08:10 +07:00
parent 5e2c1862a0
commit e7e0a7b4d5
3 changed files with 157 additions and 12 deletions

View file

@ -37,6 +37,36 @@ writemd = (system, text) ->
money = (character, system, amount) ->
system.setQuality("money", character.qualities.money + amount)
code_can_input = (character) ->
return character.sandbox.code.length < 6
code_input = (character, digit) ->
if code_can_input(character)
character.sandbox.code = character.sandbox.code + digit
code_reset = (character) ->
character.sandbox.code = ""
code_check = (character, system) ->
if character.sandbox.code.length >= 6
if character.sandbox.code != "27032017"
writemd(system, "Something clicks and the display resets, but the box stays locked.")
if character.sandbox.code == "000000"
writemd(system, "Of course, Ronald didn't hope it would be that easy.")
else
character.sandbox.box_opened = 1
writemd(system, """
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.
""")
character.sandbox.code = ""
situation "start",
content: """
Peter had so much trouble sleeping he had to drown his pills in at least an hour of thoughts.

View file

@ -7,5 +7,8 @@ undum.game.init = (character, system) ->
)
document.onmousedown = (e) ->
e.target.click()
character.sandbox.view_smash = 1
character.sandbox.code = ""
character.sandbox.box_opened = 0
window.onload = undum.begin

View file

@ -5,13 +5,11 @@ update_ways = (ways) ->
content += way_to(undum.game.situations[way].title, way)
$("#ways").html(content)
# Сюжет игры:
# герой находит коробку, коробка закрыта
# коробка - отдельная ситуация с вариантами действий
# сломать коробку = шум
# открыть коробку - нужен код
# когда он хочет уйти, за дверью кто-то стоит - это другой вор, который оглушил Петю
# его можно убрать при помощи Чёрного Телефона
# the code is the day she met her lover
# if the player enters the code prior to learning the birthday, the game responds accordingly
# when he wants to go, there's someone at rge door
# it's another thief (someone who is at ease with Ana's Instagram too) who took out Petya
# the Black Phone can deal with him
situation "living-room",
title: "Living room"
@ -87,11 +85,14 @@ situation "bedroom",
update_ways(this.ways)
title: "Bedroom"
ways: ["living-room", "kitchen"]
content: """
On a small table near the bed is an ornate #{textlink("wooden box.", "box")}
"""
writers:
box: ""
content: (character, system) ->
return """
The bedroom is spacious. There's a wardrobe and a big bed.
#{if character.sandbox.box_opened == 0
"On a small table near the bed is an ornate #{way_to("wooden box.", "box")}"
}
"""
situation "kitchen",
before: () ->
@ -101,3 +102,114 @@ situation "kitchen",
content: """
Bedroom here
"""
situation "box",
before: () ->
update_ways(this.ways)
ways: ["bedroom"]
choices: "#box"
content: (character, system) ->
return """
It's a red wood, very expensive.
And this box is locked with a digital code key.
#{if is_visited(this) == 0
"""
Ronald takes out a vial from his pocket. He coats the keys with a bright white powder.
Only 1, 2, 3, 7 and 0 keys are fingerprinted.
He wipes the box clean until there is no trace of the powder.
"""
}
"""
# no need to call update_ways, it's the same location
situation "smash",
canView: (character) ->
character.sandbox.view_smash == 1
optionText: "Smash the box"
before: (character) ->
character.sandbox.view_smash = 0
choices: "#box"
tags: ["box"]
content: "Ronald still needs the phone in this box. A very high-tech fragile phone. Smashing isn't an option."
situation "put1",
choices: "#box"
tags: ["box"]
optionText: "Enter 1"
before: (character) ->
code_input(character, 1)
canChoose: (character) ->
code_can_input(character)
after: (character, system) ->
code_check(character, system)
content: (character) -> """
Ronald presses button 1. The display is #{character.sandbox.code} now.
"""
situation "put2",
choices: "#box"
tags: ["box"]
optionText: "Enter 2"
before: (character) ->
code_input(character, 2)
after: (character, system) ->
code_check(character, system)
canChoose: (character) ->
code_can_input(character)
content: (character) -> """
Ronald presses button 2. The display is #{character.sandbox.code} now.
"""
situation "put3",
choices: "#box"
tags: ["box"]
optionText: "Enter 3"
before: (character) ->
code_input(character, 3)
after: (character, system) ->
code_check(character, system)
canChoose: (character) ->
code_can_input(character)
content: (character) -> """
Ronald presses button 3. The display is #{character.sandbox.code} now.
"""
situation "put7",
choices: "#box"
tags: ["box"]
optionText: "Enter 7"
before: (character) ->
code_input(character, 7)
after: (character, system) ->
code_check(character, system)
canChoose: (character) ->
code_can_input(character)
content: (character) -> """
Ronald presses button 7. The display is #{character.sandbox.code} now.
"""
situation "put0",
choices: "#box"
tags: ["box"]
optionText: "Enter 0"
before: (character) ->
code_input(character, 0)
after: (character, system) ->
code_check(character, system)
canChoose: (character) ->
code_can_input(character)
content: (character) -> """
Ronald presses button 0. The display is #{character.sandbox.code} now.
"""
situation "reset",
choices: "#box"
tags: ["box"]
optionText: "Reset the display"
before: (character) ->
code_reset(character)
content: """
You press Backspace until the display is empty.
"""