Debian Codegraph @

scripts/schedules/mapcharacters/tristan.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 Tristan Illig
14 #
15 # Illig will either be in the common room or outside at the gate.
16
17
18 import adonthell
19 from schedules.mapcharacters import schedule
20 import random
21
22 def _(message): return message
23
24 class tristan (schedule.speak):
25
26 def __init__ (self, mapcharacterinstance):
27 self.myself = mapcharacterinstance
28
29 # -- make random remarks
30 self.speech = [_("Don't they know that I am losing money by the hour!?"), \
31 _("What a fuss about a few worthless gems!"), \
32 _("Ye gods! It cannot be that hard to find the thief!")]
33 self.speech_delay = (20, 55)
34 schedule.speak.__init__(self)
35
36 self.walk_delay = "75t"
37 self.myself.set_callback (self.goal_reached)
38
39 def walk (self):
40 # -- in common room -> go outside
41 if self.myself.submap () == 1 and \
42 adonthell.gamedata_get_quest ("demo").get_val ("intro_on") == 0:
43 self.myself.set_goal (13, 8, adonthell.STAND_SOUTH)
44 self.walk_delay = "%it" % random.randint (60, 90)
45
46 # -- outside -> goto common room
47 else:
48 self.myself.set_goal (18, 13, adonthell.STAND_NORTH)
49 self.walk_delay = "%it" % random.randint (45, 90)
50
51 def goal_reached (self):
52 # -- reached common room
53 if self.myself.submap () == 1 and self.myself.posx () == 13:
54 self.myself.set_goal (4, 6, adonthell.STAND_WEST)
55 # -- reached yard
56 elif self.myself.submap () == 0 and self.myself.posx () == 18:
57 self.myself.set_goal (12, 18, adonthell.STAND_WEST)
58 # -- reached our final destination
59 else:
60 self.myself.time_callback (self.walk_delay, self.walk)