1. Arne Babenhauserheide
  2. TextRPG

Commits

Arne Babenhauserheide  committed 210c590

exp is now a property, and so it wil always be up to date.

  • Participants
  • Parent commits 09da0e7
  • Branches default

Comments (0)

Files changed (1)

File ews/char.py

View file
     """A single soldier. Will be imported from either a prefab character file from amov or via a template
     
     *args and **kwds makes sure, that we aren't confused, when we get more arguments than we expected."""
+    
     def __init__(self,source="tag:1w6.org,2008:Human",template=True,  *args,  **kwds):
         '''Basic creation of a single Char.'''
         # First call super, so that miltiple inheritance with char as first class can work. 
         # print self.wounds
         
         # Get the experience, either from the char, if it has it, or calculate it from all other values.
-        self.exp = self.amov.ladeGrunddaten().setdefault(_("Striche"), self.calculate_might()) #: The experience of the char. 
+        self.amov.ladeGrunddaten().setdefault(_("Striche"), self.calculate_might()) #: The experience of the char. 
         
         #: The attributes of the Char. # TODO: If Eigenschaften changes from ' ' to a dict, update attribute "attributes"
         self.attributes = self.amov.eigenschaften
         else: 
           self.morale_dict = self.amov.eigenschaften.setdefault(_("Morale"), {})
           self.morale = [self.morale_dict.setdefault(_("Zahlenwert"), 12)]
-
-
+    
+    
     def save_data_into_char_dict(self): 
         """Save the data from the attributes back into the amov data. 
         
         if self.amov.fertigkeiten != " ": 
             for i in self.amov.fertigkeiten.keys(): 
                 might += self.amov.fertigkeiten[i].setdefault("Striche",  self.get_necessary_striche_for_obj({i: self.amov.fertigkeiten[i]}))
-        self.exp = might
         if might == 0: 
             if second_run: 
                 print self.amov.eigenschaften,  self.amov.fertigkeiten
             return might
         
     
+    # Experience as property. 
+    exp = property(fget=calculate_might)
+    
+    
     def upgrade(self,expadd,object=('weighted',[])):
         '''
         Randomly enhance the characters skills and attributes.