Add cave; add cave conditions
This commit is contained in:
parent
f2fde37ec8
commit
0fc99dbc62
28
main.go
28
main.go
@ -22,12 +22,15 @@ func main() {
|
||||
|
||||
/* Pointing to the struct "Room" allows us to directly modify its values */
|
||||
rooms := map[string]*Room{
|
||||
"entry": {"Field", "You find yourself before a mansion to the (n)orth.\n" +
|
||||
"entry": {"Field", "\nYou find yourself before a mansion to the (n)orth.\n" +
|
||||
"There is a cave to the (w)est.\n" +
|
||||
"In the distance, you see some sort of box to the (e)ast.",
|
||||
"none", "none", "none", "chest"},
|
||||
"chest": {"Chest", "You see a closed chest freezer in front of you.",
|
||||
"none", "none", "cave", "chest"},
|
||||
"chest": {"Chest", "\nYou see a closed chest freezer in front of you.\n" +
|
||||
"There is an empty field to the (w)est.\n",
|
||||
"none", "none", "entry", "none"},
|
||||
"cave": {"Cave", "\n A beast of inconevialable horror dwells in this" +
|
||||
" cave and proceds to tear you apart.", "none", "none", "none", "entry"},
|
||||
}
|
||||
|
||||
player := Player{rooms["entry"], inventory}
|
||||
@ -37,6 +40,8 @@ func main() {
|
||||
var command [2]string
|
||||
var quit bool = false
|
||||
|
||||
var steak_happened = false
|
||||
|
||||
println()
|
||||
println()
|
||||
println()
|
||||
@ -49,6 +54,7 @@ func main() {
|
||||
println()
|
||||
for quit != true {
|
||||
println(player.loc.description, "\n")
|
||||
|
||||
fmt.Print("Enter text: ")
|
||||
|
||||
fmt.Scanln(&command[0], &command[1])
|
||||
@ -129,8 +135,22 @@ func main() {
|
||||
|
||||
default:
|
||||
println("\nI don't know how to '", command[0], "'\n")
|
||||
}
|
||||
|
||||
if player.loc.name == "Cave" {
|
||||
if _, ok := player.items["steak"]; ok {
|
||||
println("\n You see a poodle sitting in the cave. You can't stand " +
|
||||
"the smell of the steak anymore and decide to toss it " +
|
||||
"out of the cave which the dog happily chases after.")
|
||||
rooms["cave"].description = "You are in a dark cave.\n" +
|
||||
"There is a key on the floor.\n" +
|
||||
"Their is an empty field to the (e)ast."
|
||||
steak_happened = true
|
||||
}
|
||||
if steak_happened == false {
|
||||
println("Well, it looks like you died! Good luck next time!")
|
||||
quit = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user