Add foyer. Add mansion key action

This commit is contained in:
Logen Kain 2018-03-15 20:43:26 -07:00
parent ef12efb01f
commit bd85e38e3a

19
main.go
View File

@ -38,10 +38,12 @@ func main() {
true,
false},
}
foyerItems := map[string]*Item{}
/* Pointing to the struct "Room" allows us to directly modify its values */
rooms := map[string]*Room{
"entry": {"Field", "\nYou find yourself before a mansion to the (n)orth.\n" +
"The door to the mansion is locked.\n" +
"There is a cave to the (w)est.\n" +
"In the distance, you see some sort of box to the (e)ast.",
entryItems,
@ -54,6 +56,10 @@ func main() {
" cave and proceds to tear you apart.\n",
caveItems,
"none", "none", "none", "entry"},
"foyer": {"Foyer", "\n You find yourself in the foyer of the mansion,\n" +
"Add the real description here after referencing notes and what not.",
foyerItems,
"none", "none", "none", "none"},
}
player := Player{rooms["entry"], inventory}
@ -243,6 +249,19 @@ func main() {
quit = true
}
}
if player.loc.name == "Field" {
if _, ok := player.items["key"]; ok {
println("You use the key to open the door to the mansion.\n" +
"The key broke off in the lock")
delete(player.items, "key")
rooms["entry"].description = "\nYou find yourself before a mansion to the (n)orth.\n" +
"The door to the mansion is wide open.\n " +
"There is a cave to the (w)est.\n" +
"In the distance, you see some sort of box to the (e)ast."
rooms["entry"].north = "foyer"
}
}
/*Clear the commands in case the user just presses "enter"*/
command[0] = ""