comparison charactercreationcontroller.py @ 153:741d7d193bad

Changed CharacterStatistic classes to work with components.
author KarstenBock@gmx.net
date Sat, 05 Nov 2011 14:42:12 +0100
parents 8bb84164e6a2
children 4dc7951c3bfc
comparison
equal deleted inserted replaced
152:76041ed90a5d 153:741d7d193bad
87 self.view.cancel_new_game_callback = self.cancelNewGame 87 self.view.cancel_new_game_callback = self.cancelNewGame
88 88
89 def reset_character(self): 89 def reset_character(self):
90 # FIXME M. George Hansen 2011-06-06: character stats scripts aren't 90 # FIXME M. George Hansen 2011-06-06: character stats scripts aren't
91 # finished, unfortunately. 91 # finished, unfortunately.
92 # primary_stats_file = \ 92 #primary_stats_file = \
93 # vfs.VFS.open('character_scripts/primary_stats.xml') 93 # vfs.VFS.open('character_scripts/primary_stats.xml')
94 # primary_stats = XmlSerializer.deserialize(primary_stats_file) 94 #primary_stats = XmlSerializer.deserialize(primary_stats_file)
95 # secondary_stats_file = \ 95 #secondary_stats_file = \
96 # vfs.VFS.open('character_scripts/secondary_stats.xml') 96 # vfs.VFS.open('character_scripts/secondary_stats.xml')
97 # secondary_stats = XmlSerializer.deserialize(secondary_stats_file) 97 #secondary_stats = XmlSerializer.deserialize(secondary_stats_file)
98 primary_stats = [] 98 primary_stats = []
99 secondary_stats = [] 99 secondary_stats = []
100 inventory = [] 100 inventory = []
101 for x in xrange(self.INV_SLOTS): 101 for x in xrange(self.INV_SLOTS):
102 inventory.append(None) 102 inventory.append(None)
108 self.char_data.characterstats.age = 20 108 self.char_data.characterstats.age = 20
109 self.char_data.characterstats.picture = ( 109 self.char_data.characterstats.picture = (
110 self.PICTURES[self.GENDERS[0]][0] 110 self.PICTURES[self.GENDERS[0]][0]
111 ) 111 )
112 for primary_stat in primary_stats: 112 for primary_stat in primary_stats:
113 short_name = primary_stat.short_name 113 long_name = primary_stat.long_name
114 self.char_data.characterstats.primary_stats[short_name] = ( 114 self.char_data.characterstats.primary_stats[long_name] = (
115 char_stats.PrimaryStatisticValue( 115 char_stats.PrimaryStatisticValue(
116 primary_stat, self, DEFAULT_STAT_VALUE) 116 primary_stat, self.char_data.characterstats,
117 DEFAULT_STAT_VALUE)
117 ) 118 )
118 for secondary_stat in secondary_stats: 119 for secondary_stat in secondary_stats:
119 name = secondary_stat.name 120 name = secondary_stat.name
120 self.char_data.characterstats.secondary_stats[name] = ( 121 self.char_data.characterstats.secondary_stats[name] = (
121 char_stats.SecondaryStatisticValue(secondary_stat, self) 122 char_stats.SecondaryStatisticValue(secondary_stat,
123 self.char_data.
124 characterstats)
122 ) 125 )
123 self.char_data.container.max_bulk = self.MAX_BULK 126 self.char_data.container.max_bulk = self.MAX_BULK
124 self.char_data.container.children = inventory 127 self.char_data.container.children = inventory
125 self._stat_points = 200 128 self._stat_points = 200
126 129