Debian Codegraph @

scripts/schedules/mapcharacters/talan.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 Talan Wendth
14 #
15 # He guards the gate
16
17 import adonthell
18 import random
19 from schedules.mapcharacters import schedule
20
21 def _(message): return message
22
23 class talan (schedule.speak):
24
25 def __init__ (self, mapcharacterinstance):
26 self.myself = mapcharacterinstance
27
28 # -- make random remarks
29 self.speech = [_("Halt! Who goes there?"), \
30 "\"Ai! laurie lantar lassi surinen ...\"", \
31 _("Nobody may pass through the gate!")]
32 self.speech_delay = (30, 60)
33 schedule.speak.__init__(self)
34
35 self.myself.set_callback (self.goal_reached)
36
37 def walk (self):
38 if self.myself.posy () == 17:
39 self.myself.set_goal (11, 19, adonthell.STAND_NORTH)
40 else:
41 self.myself.set_goal (11, 17, adonthell.STAND_SOUTH)
42
43 def goal_reached (self):
44 delay = "%it" % random.randrange (10, 20)
45 self.myself.time_callback (delay, self.walk)
46