Mercurial > parpg-source
comparison characterstatistics.py @ 153:741d7d193bad
Changed CharacterStatistic classes to work with components.
author | KarstenBock@gmx.net |
---|---|
date | Sat, 05 Nov 2011 14:42:12 +0100 |
parents | 7a89ea5404b1 |
children |
comparison
equal
deleted
inserted
replaced
152:76041ed90a5d | 153:741d7d193bad |
---|---|
16 | 16 |
17 from abc import ABCMeta, abstractmethod | 17 from abc import ABCMeta, abstractmethod |
18 from weakref import ref as weakref | 18 from weakref import ref as weakref |
19 | 19 |
20 from .serializers import SerializableRegistry | 20 from .serializers import SerializableRegistry |
21 | |
22 from components import character_statistics | |
21 | 23 |
22 class AbstractCharacterStatistic(object): | 24 class AbstractCharacterStatistic(object): |
23 __metaclass__ = ABCMeta | 25 __metaclass__ = ABCMeta |
24 | 26 |
25 @abstractmethod | 27 @abstractmethod |
142 statistic_type = self.statistic_type | 144 statistic_type = self.statistic_type |
143 stat_modifiers = statistic_type.stat_modifiers | 145 stat_modifiers = statistic_type.stat_modifiers |
144 character = self.character() | 146 character = self.character() |
145 | 147 |
146 value = sum( | 148 value = sum( |
147 character.statistics[name].value * modifier for name, modifier in | 149 character_statistics.get_statistic(character, name).value * |
150 modifier for name, modifier in | |
148 stat_modifiers.items() | 151 stat_modifiers.items() |
149 ) | 152 ) |
150 assert 0 <= value <= 100 | 153 assert 0 <= value <= 100 |
151 if not normalized: | 154 if not normalized: |
152 mean = statistic_type.mean | 155 mean = statistic_type.mean |