Debian Codegraph @

scripts/schedules/mapcharacters/silverhair.py

raw symbols SCIP
1 #
2 # (C) Copyright 2001/2002 Kai Sterker <[email protected]>
3 # Part of the Adonthell Project http://adonthell.linuxgames.com
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License.
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY.
9 #
10 # See the COPYING file for more details
11 #
12
13 # -- Movement schedule for Imoen Silverhair
14 #
15 # She will mainly stand still, but occasionally walk up to the
16 # window and make a remark about the weather.
17
18 import adonthell
19 from schedules.mapcharacters import schedule
20 import random
21
22 # -- pygettext support
23 def _(message): return message
24
25 class silverhair (schedule.speak):
26
27 def __init__ (self, mapcharacterinstance):
28 self.myself = mapcharacterinstance
29 self.speech = [_("In truth, Sarin, it is no bother. I am not offended."), \
30 _("Janesta, dear, worry not. I am content here."), \
31 _("Janesta, please bring my figurine. I wish to see it more closely."), \
32 _("It truly is a lovely day. I expect we will have time yet to enjoy it.")]
33 self.speech_delay = (20, 72)
34 schedule.speak.__init__(self)
35
36 self.myself.set_callback (self.goal_reached)
37
38 def walk (self):
39 # -- goto the window
40 if self.myself.posx () == 4:
41 # ... and speak about the weather
42 self.myself.set_val ("delay", random.randrange (15, 22))
43 self.myself.set_goal (6, 4, adonthell.STAND_EAST)
44
45 # -- go back to our normal position
46 else:
47 self.myself.set_val ("delay", random.randrange (15, 22))
48 if self.myself.set_goal (4, 4, adonthell.STAND_SOUTH) == 0:
49 self.myself.go_north ()
50
51 def goal_reached (self):
52 # -- standing in front of the window
53 if self.myself.posx () == 6:
54 self.myself.speak (self.speech[3])
55
56 delay = "%it" % self.myself.get_val ("delay")
57 self.myself.time_callback (delay, self.walk)