File: character_speak.py

package info (click to toggle)
adonthell-data 0.3.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 27,040 kB
  • sloc: python: 5,172; sh: 4,584; makefile: 420; xml: 40; sed: 16
file content (35 lines) | stat: -rw-r--r-- 1,235 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
#
#  (C) Copyright 2001 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
#

# -- Map Event to make a character say something.

import adonthell

class character_speak(object):

    # Parameters:
    # name: name of the character that should speak when the event is triggered
    # sentence: sentence to say when the event is triggered
    def __init__ (self, eventinstance, name, sentence):
        self.myself = eventinstance
        self.mapchar = adonthell.gamedata_get_character (name)
        self.sentence = sentence

    def run (self, submap, x, y, dir, name):
        self.mapchar.speak (self.sentence)
        if submap == 4:
            if x == 7 and y == 3:
                adonthell.achievements.update(1, 11)
            if x == 7 and y == 5:
                adonthell.achievements.update(1, 21)
            if x == 8 and y == 4:
                adonthell.achievements.update(1, 31)