Debian Codegraph @

scripts/schedules/mapcharacters/lucia.py

raw symbols SCIP
1 #
2 # (C) Copyright 2001/2002 Alexandre Courbot <[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 Lucia Redwyne
14 #
15 # She just walk around in the kitchen, doing her business and
16 # complaining about her life.
17
18 import adonthell
19 from schedules.mapcharacters import schedule
20 import random
21
22 def _(message): return message
23
24 class lucia (schedule.speak):
25
26 def __init__ (self, mapcharacterinstance):
27 self.myself = mapcharacterinstance
28
29 # -- make random remarks
30 self.speech = [_("When can I finally rest a bit?"), \
31 _("I told Orloth this place would bring us nothing but trouble!"), \
32 _("This smoke! I'm dying!")]
33 self.speech_delay = (20, 40)
34 schedule.speak.__init__(self)
35
36 self.coords = [(3, 3, adonthell.STAND_NORTH), \
37 (6, 3, adonthell.STAND_EAST)]
38
39 self.myself.set_callback (self.goal_reached)
40
41 def walk (self):
42 if self.myself.posx () != 3:
43 x, y, dir = self.coords[0]
44 else:
45 x, y, dir = self.coords[random.randrange(0, 2)]
46 self.myself.set_goal (x, y, dir)
47
48 def goal_reached (self):
49 # -- standing in front of the exit
50 if self.myself.posx () == 6:
51 self.myself.speak (_("Ah, some fresh air!"))
52 delay = "8t"
53 else:
54 delay = "%it" % random.randrange (20, 40)
55
56 self.myself.time_callback (delay, self.walk)