File: lucia.py

package info (click to toggle)
adonthell-data 0.3.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 27,040 kB
  • sloc: python: 5,172; sh: 4,584; makefile: 418; xml: 40; sed: 16
file content (56 lines) | stat: -rw-r--r-- 1,814 bytes parent folder | download | duplicates (3)
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
48
49
50
51
52
53
54
55
56
#
#  (C) Copyright 2001/2002 Alexandre Courbot <alexandrecourbot@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 Lucia Redwyne
#
# She just walk around in the kitchen, doing her business and
# complaining about her life.

import adonthell
from schedules.mapcharacters import schedule
import random

def _(message): return message

class lucia (schedule.speak):

    def __init__ (self, mapcharacterinstance):
        self.myself = mapcharacterinstance
        
        # -- make random remarks
        self.speech = [_("When can I finally rest a bit?"), \
                       _("I told Orloth this place would bring us nothing but trouble!"), \
                       _("This smoke! I'm dying!")]
        self.speech_delay = (20, 40)
        schedule.speak.__init__(self)
        
        self.coords = [(3, 3, adonthell.STAND_NORTH), \
                  (6, 3, adonthell.STAND_EAST)]

        self.myself.set_callback (self.goal_reached)

    def walk (self):
        if self.myself.posx () != 3:
            x, y, dir = self.coords[0]
        else:
            x, y, dir = self.coords[random.randrange(0, 2)]
        self.myself.set_goal (x, y, dir)
    
    def goal_reached (self):
        # -- standing in front of the exit
        if self.myself.posx () == 6:
            self.myself.speak (_("Ah, some fresh air!"))
            delay = "8t"
        else:
            delay = "%it" % random.randrange (20, 40)
        
        self.myself.time_callback (delay, self.walk)