git @ Cat's Eye Technologies The-Swallows / 350abba
Report that character had found something, when they were not PoV. Cat's Eye Technologies 11 years ago
2 changed file(s) with 19 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
1919 def __init__(self, phrase, participants, excl=False,
2020 previous_location=None,
2121 speaker=None,
22 addressed_to=None):
22 addressed_to=None,
23 exciting=False):
2324 """participants[0] is always the initiator, and we
2425 record the location that the event was initiated in.
2526
4647 self.excl = excl
4748 self.speaker = speaker
4849 self.addressed_to = addressed_to
50 self.exciting = exciting
4951
5052 def rephrase(self, new_phrase):
5153 """Does not modify the event. Returns a new copy."""
175177 # maps main characters to where the reader last saw them
176178 self.last_seen_at = {}
177179 self.transformers = []
180 # maps characters to things that happened to them while not narrated
181 self.exciting_developments = {}
178182
179183 def add_transformer(self, transformer):
180184 self.transformers.append(transformer)
201205 # this is the first sentence of the paragraph
202206 # if the reader wasn't aware they were here, add an event
203207 if self.last_seen_at.get(pov_actor, None) != event.location:
204 if not (('went to' in event.phrase) or ('made <his-1> way to' in event.phrase) or (event.phrase == '<1> <was-1> in <2>')):
208 if not (('went to' in event.phrase) or
209 ('made <his-1> way to' in event.phrase) or
210 (event.phrase == '<1> <was-1> in <2>')):
205211 paragraph_events.append(Event('<1> <was-1> in <2>', [pov_actor, event.location]))
212 # if something exciting happened, tell the reader
213 for (obj, loc) in self.exciting_developments.get(pov_actor, []):
214 paragraph_events.append(Event('<1> had found <2> in <3>', [pov_actor, obj, loc]))
215 self.exciting_developments[pov_actor] = []
206216
207217 # update our idea of where the character is, even if these are
208218 # not events we will be dumping out
212222 paragraph_events.append(event)
213223 # update the reader's idea of where the character is
214224 self.last_seen_at[event.initiator()] = event.location
225 else:
226 if event.exciting:
227 self.exciting_developments.setdefault(event.initiator(), []).append(
228 (event.participants[1], event.participants[2])
229 )
215230
216231 return paragraph_events
217232
279279 desired_things.append(thing)
280280 if desired_things:
281281 thing = random.choice(desired_things)
282 self.emit("<1> found <2> there, and took <him-2>", [self, thing])
282 self.emit("<1> found <2> there, and took <him-2>",
283 [self, thing, container], exciting=True)
283284 thing.move_to(self)
284285 self.remember_location(thing, self)
285286