File: Statistics.py

package info (click to toggle)
cyphesis-cpp 0.5.16-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 5,084 kB
  • ctags: 3,627
  • sloc: cpp: 30,418; python: 4,812; xml: 4,674; sh: 4,118; makefile: 902; ansic: 617
file content (25 lines) | stat: -rw-r--r-- 717 bytes parent folder | download
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
#This file is distributed under the terms of the GNU General Public license.
#Copyright (C) 2006 Al Riddoch (See the file COPYING for details).

from atlas import *
try:
  from random import *
except ImportError:
  from whrandom import *

import rulesets

class Statistics(rulesets.Statistics):
    """A very simple Statistics example."""
    def __init__(self, entity):
        super(Statistics, self).__init__(entity)
    def attribute(self, name):
        if name == "attack":
            return 1
        if name == "defence":
            return 1
        if name == "strength":
            if hasattr(self.character, 'mass'):
                return self.character.mass
            else:
                return 0