The driveway, path, garage, and shed are not "rooms".
Cat's Eye Technologies
11 years ago
24 | 24 | # bullets for the revolver |
25 | 25 | |
26 | 26 | # Mechanics: |
27 | # have "needing a drink" be an actual goal. should it be implemented as a | |
28 | # fancy, extensible Goal object, or just a boolean attribute? | |
29 | # have having had the drink actually calm their nerves so they no longer | |
30 | # need a drink | |
27 | # they should always scream at seeing the dead body. the scream should | |
28 | # be heard throughout the house and yard. | |
31 | 29 | # ...they check that the brandy is still in the liquor cabinet. is this |
32 | 30 | # really necessary? |
33 | 31 | # certain things can't be taken, but can be dragged (like the body) |
49 | 47 | # eliminate identical duplicate sentences |
50 | 48 | # Bob is in the dining room & "Bob made his way to the dining room" -> |
51 | 49 | # "Bob wandered around for a bit, then came back to the dining room" |
52 | # the driveway is not a "room" | |
53 | 50 | # a better solution for "Bob was in the kitchen" at the start of a paragraph; |
54 | 51 | # this might include significant memories Bob acquired in the last |
55 | 52 | # paragraph -- such as finding a revolver in the bed |
175 | 172 | self.events.append(event) |
176 | 173 | |
177 | 174 | |
178 | ### TOPICS AND MEMORIES ### | |
175 | ### TOPICS ### | |
179 | 176 | |
180 | 177 | # a "topic" is just what a character has recently had addressed to |
181 | 178 | # them. It could be anything, not just words, by another character |
210 | 207 | class ThreatTellMeTopic(Topic): |
211 | 208 | pass |
212 | 209 | |
210 | ||
211 | ### MEMORIES ### | |
213 | 212 | |
214 | 213 | class Memory(object): |
215 | 214 | def __init__(self, subject, location, i_hid_it_there=False): |
388 | 387 | if x is self: |
389 | 388 | continue |
390 | 389 | if x.animate(): |
391 | x.emit("<1> saw <2> leave the room", [x, self]) | |
390 | x.emit("<1> saw <2> leave the %s" % x.location.noun(), [x, self]) | |
392 | 391 | if self.location is not None: |
393 | 392 | self.location.contents.remove(self) |
394 | 393 | self.location = location |
406 | 405 | memory = self.memory.get(x.name, None) |
407 | 406 | if memory: |
408 | 407 | amount = pick(['shudder', 'wave']) |
409 | emotion = pick(['fear', 'disgust', 'sickness']) | |
408 | emotion = pick(['fear', 'disgust', 'sickness', 'loathing']) | |
410 | 409 | self.emit("<1> felt a %s of %s as <he-1> looked at <2>" % (amount, emotion), [self, x]) |
411 | 410 | self.memory[x.name] = Memory(x, self.location) |
412 | 411 | else: |
417 | 416 | elif x.animate(): |
418 | 417 | other = x |
419 | 418 | self.emit("<1> saw <2>", [self, other]) |
420 | other.emit("<1> saw <2> walk into the room", [other, self]) | |
419 | other.emit("<1> saw <2> walk into the %s" % self.location.noun(), [other, self]) | |
421 | 420 | self.memory[x.name] = Memory(x, self.location) |
422 | 421 | self.greet(x, "'Hello, <2>,' said <1>") |
423 | 422 | for y in other.contents: |
845 | 844 | ### LOCATIONS ### |
846 | 845 | |
847 | 846 | class Location(Actor): |
848 | def __init__(self, name, enter="went to"): | |
847 | def __init__(self, name, enter="went to", noun="room"): | |
849 | 848 | self.name = name |
850 | 849 | self.enter = enter |
851 | 850 | self.contents = [] |
852 | 851 | self.exits = [] |
852 | self.noun_ = noun | |
853 | ||
854 | def noun(self): | |
855 | return self.noun_ | |
853 | 856 | |
854 | 857 | def set_exits(self, *exits): |
855 | 858 | self.exits = exits |
900 | 903 | living_room = Location('living room') |
901 | 904 | dining_room = Location('dining room') |
902 | 905 | front_hall = Location('front hall') |
903 | driveway = Location('driveway') | |
904 | garage = Location('garage') | |
905 | path_by_the_shed = Location('path by the shed') | |
906 | shed = Location('shed') | |
906 | driveway = Location('driveway', noun="driveway") | |
907 | garage = Location('garage', noun="garage") | |
908 | path_by_the_shed = Location('path by the shed', noun="path") | |
909 | shed = Location('shed', noun="shed") | |
907 | 910 | upstairs_hall = Location('upstairs hall') |
908 | 911 | study = Location('study') |
909 | 912 | bathroom = Location('bathroom') |