Skip to content

Commit

Permalink
Fixed logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
Veski0 committed Oct 24, 2018
1 parent 1eb3df1 commit 6ccf4c9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion evidence.py
Expand Up @@ -42,6 +42,6 @@

evidence_gloves = {
"id": "gloves",
"name": "Driving gloves",
"name": "Gardening gloves",
"description": "Gardening gloves. Brand new."
}
9 changes: 5 additions & 4 deletions game.py
Expand Up @@ -6,6 +6,7 @@
import gameparser
import items
import settings
import narratives

win_condition = False

Expand Down Expand Up @@ -188,7 +189,7 @@ def execute_evidence():
item_names.append(item["name"])
string_evidence += (", ".join(item_names))
string_evidence += ".\n"
return string_evidence
return "You have {0} pieces of evidence: {1}".format(len(player.evidence), string_evidence)
else:
return "Evidence: you don't have any evidence yet.\n"

Expand Down Expand Up @@ -265,7 +266,7 @@ def execute_talk():
people = player.current_room["rooms"][room_ver]["characters"]
if len(people) > 0:
person = people[0]
player.evidence.append(person)
player.speech.append(person)
room_name = player.current_room['rooms'][room_ver]['name']
map.pop_room_character(room_name)
return "{0}: '{1}'".format(person["name"], person["speech"])
Expand Down Expand Up @@ -339,7 +340,7 @@ def render_screen(r, i, o):
print(o)


def narrative1(room_ver):
def demo(room_ver):
if room_ver == 0 and player.current_room == map.rooms["Papa Kirill's"] and len(player.current_room["rooms"][room_ver]['evidence']) == 0:
map.rooms["Papa Kirill's"]["version"] = 1
if room_ver == 0 and player.current_room == map.rooms["Andy's Jazz Club"] and len(player.current_room["rooms"][room_ver]['characters']) == 0:
Expand All @@ -354,7 +355,7 @@ def narrative1(room_ver):


def game_director(room_ver):
narrative1(room_ver)
demo(room_ver)


# Entry point.
Expand Down
16 changes: 16 additions & 0 deletions narratives.py
@@ -0,0 +1,16 @@
import player
import map


def demo(room_ver):
if room_ver == 0 and player.current_room == map.rooms["Papa Kirill's"] and len(player.current_room["rooms"][room_ver]['evidence']) == 0:
map.rooms["Papa Kirill's"]["version"] = 1
if room_ver == 0 and player.current_room == map.rooms["Andy's Jazz Club"] and len(player.current_room["rooms"][room_ver]['characters']) == 0:
map.rooms["Andy's Jazz Club"]["version"] = 1
if room_ver == 1 and player.current_room == map.rooms["Andy's Jazz Club"] and len(player.current_room["rooms"][room_ver]['evidence']) == 0:
map.rooms["Alleyway"]["version"] = 1
if room_ver == 1 and player.current_room == map.rooms["Alleyway"] and len(player.current_room["rooms"][room_ver]['evidence']) == 0:
map.rooms["Alleyway"]["version"] = 2
if player.current_room == map.rooms["Papa Kirill's"] and len(player.evidence) == 7:
global win_condition
win_condition = True

0 comments on commit 6ccf4c9

Please sign in to comment.