File: alek.py

package info (click to toggle)
adonthell-data 0.3.5%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 14,776 kB
  • ctags: 389
  • sloc: python: 4,667; sh: 3,327; makefile: 362; sed: 16
file content (47 lines) | stat: -rwxr-xr-x 1,454 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#
#  (C) Copyright 2001/2002 Kai Sterker <kaisterker@linuxgames.com>
#  Part of the Adonthell Project http://adonthell.linuxgames.com
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License.
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY.
#
#  See the COPYING file for more details
#

# -- Movement schedule for Alek Endhelm
#
#    He'll walk between his table and the bar

import adonthell
import schedule
import random

def _(message): return message

class alek (schedule.speak):
    
    def __init__ (self, mapcharacterinstance):
        self.myself = mapcharacterinstance
        
        # -- make random remarks
        self.speech = [_("More Ale!"), \
                       _("I'll cut 'em open like ripe fruits."), \
                       _("They should sort out this business like real men!")]
        self.speech_delay = (20, 40)
        schedule.speak.__init__(self)
    
        self.myself.set_callback (self.goal_reached)
       
    def walk (self):
        # -- walk to table
        if self.myself.posx () == 1:
            self.myself.set_goal (12, 5, adonthell.STAND_NORTH)
        # -- walk to bar
        else:
            self.myself.set_goal (1, 3, adonthell.STAND_SOUTH)

    def goal_reached (self):
        delay = "%it" % random.randrange (65, 90)
        self.myself.time_callback (delay, self.walk)