From bd85e38e3a66dce3a0dc8d47145c29e0e7d9e321 Mon Sep 17 00:00:00 2001 From: Logen Kain Date: Thu, 15 Mar 2018 20:43:26 -0700 Subject: [PATCH] Add foyer. Add mansion key action --- main.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/main.go b/main.go index 8137595..da71aec 100644 --- a/main.go +++ b/main.go @@ -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] = ""