♻️ refactor: remove redundant brackets and indents
parent
cfc5785995
commit
d4847f2239
178
game/src/lib.rs
178
game/src/lib.rs
|
@ -329,101 +329,91 @@ impl State {
|
|||
|
||||
output
|
||||
}
|
||||
Look (item_name) => {
|
||||
match item_name {
|
||||
ItemName::Door => {
|
||||
self.room_1.detected_keypad = true;
|
||||
just (line_response ("You examine the DOOR. It is firmly locked, and you don't have any lock-picking tools. On the DOOR is an electronic KEYPAD."))
|
||||
},
|
||||
ItemName::EmergencyExit => {
|
||||
just (line_response ("The EMERGENCY EXIT reads, \"Emergency exit. Push bar to open. Alarm will sound. Door will unlock in 10 seconds.\". The EMERGENCY EXIT is period-accurate for an American Wal-Mart c. 2020 C.E."))
|
||||
},
|
||||
ItemName::Keypad => {
|
||||
require_detection! (self.room_1.detected_keypad);
|
||||
|
||||
just (line_response ("The DOOR is locked by an electronic KEYPAD. A soft amber power light indicates that the KEYPAD is likely functional. The KEYPAD buttons are the digits 0-9, Enter, and Clear. Experience tells you that the key code is likely 4 or 5 digits long."))
|
||||
},
|
||||
ItemName::Note => {
|
||||
require_detection! (self.room_1.detected_note);
|
||||
|
||||
self.room_1.read_note = true;
|
||||
|
||||
just (Response::PrintMany (vec! [
|
||||
"You read the NOTE.",
|
||||
"",
|
||||
"Welcome to SEROTONIN DEPOSITORY.",
|
||||
"As you play, keep in mind:",
|
||||
"- LOOKing at ITEMS is not always safe",
|
||||
"- TAKEing an item may be bad long-term",
|
||||
"- WAITing counts as an action",
|
||||
"- LOOKing AROUND is always safe",
|
||||
"- Other NOTEs may contain non-truths",
|
||||
"The code for this first KEYPAD is 1234.",
|
||||
"",
|
||||
" -- Phayle Sayf",
|
||||
"",
|
||||
"You notice that the NOTE is _not_ period-accurate.",
|
||||
]))
|
||||
},
|
||||
ItemName::Table => {
|
||||
self.room_1.detected_note = true;
|
||||
just (line_response ("You look at the TABLE. Your instincts tell you that it is period-accurate. Upon the TABLE sits a NOTE."))
|
||||
},
|
||||
_ => {
|
||||
just (undetected_item ())
|
||||
},
|
||||
}
|
||||
Look (item_name) => match item_name {
|
||||
ItemName::Door => {
|
||||
self.room_1.detected_keypad = true;
|
||||
just (line_response ("You examine the DOOR. It is firmly locked, and you don't have any lock-picking tools. On the DOOR is an electronic KEYPAD."))
|
||||
},
|
||||
ItemName::EmergencyExit => just (line_response (
|
||||
"The EMERGENCY EXIT reads, \"Emergency exit. Push bar to open. Alarm will sound. Door will unlock in 10 seconds.\". The EMERGENCY EXIT is period-accurate for an American Wal-Mart c. 2020 C.E."
|
||||
)),
|
||||
ItemName::Keypad => {
|
||||
require_detection! (self.room_1.detected_keypad);
|
||||
|
||||
just (line_response ("The DOOR is locked by an electronic KEYPAD. A soft amber power light indicates that the KEYPAD is likely functional. The KEYPAD buttons are the digits 0-9, Enter, and Clear. Experience tells you that the key code is likely 4 or 5 digits long."))
|
||||
},
|
||||
ItemName::Note => {
|
||||
require_detection! (self.room_1.detected_note);
|
||||
|
||||
self.room_1.read_note = true;
|
||||
|
||||
just (Response::PrintMany (vec! [
|
||||
"You read the NOTE.",
|
||||
"",
|
||||
"Welcome to SEROTONIN DEPOSITORY.",
|
||||
"As you play, keep in mind:",
|
||||
"- LOOKing at ITEMS is not always safe",
|
||||
"- TAKEing an item may be bad long-term",
|
||||
"- WAITing counts as an action",
|
||||
"- LOOKing AROUND is always safe",
|
||||
"- Other NOTEs may contain non-truths",
|
||||
"The code for this first KEYPAD is 1234.",
|
||||
"",
|
||||
" -- Phayle Sayf",
|
||||
"",
|
||||
"You notice that the NOTE is _not_ period-accurate.",
|
||||
]))
|
||||
},
|
||||
ItemName::Table => {
|
||||
self.room_1.detected_note = true;
|
||||
just (line_response ("You look at the TABLE. Your instincts tell you that it is period-accurate. Upon the TABLE sits a NOTE."))
|
||||
},
|
||||
_ => just (undetected_item ()),
|
||||
},
|
||||
Use (item_name) => {
|
||||
match item_name {
|
||||
ItemName::Door => {
|
||||
let mut output = vec! [
|
||||
line_response ("You can't USE the DOOR, it is locked."),
|
||||
];
|
||||
|
||||
if ! self.room_1.detected_keypad {
|
||||
self.room_1.detected_keypad = true;
|
||||
output.push (line_response ("You notice an electronic KEYPAD on the DOOR."));
|
||||
}
|
||||
|
||||
output
|
||||
},
|
||||
ItemName::EmergencyExit => {
|
||||
vec! [
|
||||
line_response ("You push on the emergency exit. An alarm starts sounding. Your ADVENTURE GAME ENTHUSIAST friend is going to be very mad at you."),
|
||||
Response::Sleep (5000),
|
||||
line_response ("The alarm is still sounding. You are getting embarrassed, but you have committed to this path of action."),
|
||||
Response::Sleep (5000),
|
||||
line_response ("The emergency exit unlocks, and you walk out of the game. Bye."),
|
||||
Response::JokeEnding,
|
||||
Response::Quit,
|
||||
]
|
||||
},
|
||||
ItemName::Keypad => {
|
||||
require_detection! (self.room_1.detected_keypad);
|
||||
|
||||
if ! self.room_1.read_note {
|
||||
return just (line_response ("You can't USE the KEYPAD, you don't know the code for it. You would normally try guessing, but it would take the programmer all day to implement that level of interaction."));
|
||||
}
|
||||
|
||||
vec! [
|
||||
line_response ("You USE the code on the KEYPAD. The door opens, and the game immediately crashes."),
|
||||
Response::PlayerVictory,
|
||||
Response::Quit,
|
||||
]
|
||||
},
|
||||
ItemName::Note => {
|
||||
require_detection! (self.room_1.detected_note);
|
||||
|
||||
just (line_response ("You can't think of any way to USE the NOTE that would be better than LOOKing at it to read it."))
|
||||
},
|
||||
ItemName::Table => {
|
||||
just (line_response ("You can't think of any way to USE the TABLE that would be better than LOOKing at it."))
|
||||
},
|
||||
_ => {
|
||||
just (undetected_item ())
|
||||
},
|
||||
}
|
||||
Use (item_name) => match item_name {
|
||||
ItemName::Door => {
|
||||
let mut output = vec! [
|
||||
line_response ("You can't USE the DOOR, it is locked."),
|
||||
];
|
||||
|
||||
if ! self.room_1.detected_keypad {
|
||||
self.room_1.detected_keypad = true;
|
||||
output.push (line_response ("You notice an electronic KEYPAD on the DOOR."));
|
||||
}
|
||||
|
||||
output
|
||||
},
|
||||
ItemName::EmergencyExit => vec! [
|
||||
line_response ("You push on the emergency exit. An alarm starts sounding. Your ADVENTURE GAME ENTHUSIAST friend is going to be very mad at you."),
|
||||
Response::Sleep (5000),
|
||||
line_response ("The alarm is still sounding. You are getting embarrassed, but you have committed to this path of action."),
|
||||
Response::Sleep (5000),
|
||||
line_response ("The emergency exit unlocks, and you walk out of the game. Bye."),
|
||||
Response::JokeEnding,
|
||||
Response::Quit,
|
||||
],
|
||||
ItemName::Keypad => {
|
||||
require_detection! (self.room_1.detected_keypad);
|
||||
|
||||
if ! self.room_1.read_note {
|
||||
return just (line_response ("You can't USE the KEYPAD, you don't know the code for it. You would normally try guessing, but it would take the programmer all day to implement that level of interaction."));
|
||||
}
|
||||
|
||||
vec! [
|
||||
line_response ("You USE the code on the KEYPAD. The door opens, and the game immediately crashes."),
|
||||
Response::PlayerVictory,
|
||||
Response::Quit,
|
||||
]
|
||||
},
|
||||
ItemName::Note => {
|
||||
require_detection! (self.room_1.detected_note);
|
||||
|
||||
just (line_response ("You can't think of any way to USE the NOTE that would be better than LOOKing at it to read it."))
|
||||
},
|
||||
ItemName::Table => just (line_response (
|
||||
"You can't think of any way to USE the TABLE that would be better than LOOKing at it."
|
||||
)),
|
||||
_ => just (undetected_item ()),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue