Debian Codegraph @

scripts/schedules/mapcharacters/frostbloom.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 Rhayne Frostbloom
14 #
15 # She just walks around the tree in the yard
16
17 import adonthell
18 from schedules.mapcharacters import schedule
19 import random
20
21 def _(message): return message
22
23 class frostbloom (schedule.speak):
24
25 def __init__ (self, mapcharacterinstance):
26 self.myself = mapcharacterinstance
27
28 # -- Borders of the area she will stay in
29 self.min_x = 16
30 self.max_x = 25
31 self.min_y = 21
32 self.max_y = 29
33
34 # -- make random remarks
35 self.speech = [_("This tree is so inspiring."), \
36 _("I wonder why everybody seems so excited."), \
37 _("Do you know a creature more lovely than the yeti?")]
38 self.speech_delay = (20, 55)
39 schedule.speak.__init__(self)
40
41 self.myself.set_callback (self.goal_reached)
42
43 def walk (self):
44 # -- the position we want to reach
45 x = random.randrange (self.min_x, self.max_x)
46 y = random.randrange (self.min_y, self.max_y)
47
48 self.myself.set_goal (x, y)
49
50 def goal_reached (self):
51 delay = "%it" % random.randrange (20, 50)
52 self.myself.time_callback (delay, self.walk)