Mercurial > parpg-source
diff components/character_statistics.py @ 153:741d7d193bad
Changed CharacterStatistic classes to work with components.
author | KarstenBock@gmx.net |
---|---|
date | Sat, 05 Nov 2011 14:42:12 +0100 |
parents | 17fab1f2bf7d |
children | f017f8cac2c2 |
line wrap: on
line diff
--- a/components/character_statistics.py Wed Oct 26 13:01:49 2011 +0200 +++ b/components/character_statistics.py Sat Nov 05 14:42:12 2011 +0100 @@ -26,4 +26,16 @@ fields = self.fields.keys() fields.remove("primary_stats") fields.remove("secondary_stats") - return fields \ No newline at end of file + return fields + +def get_statistic(stats, name): + """Gets the statistic by its name""" + if name in stats.primary_stats: + return stats.primary_stats[name] + elif name in stats.secondary_stats: + return stats.secondary_stats[name] + else: + for stat in stats.primary_stats: + if stat.statistic_type.short_name == name: + return stat + return None \ No newline at end of file