Changeset 87 for pycodebattler


Ignore:
Timestamp:
01/07/11 15:20:27 (14 years ago)
Author:
atzm
Message:

add error check

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pycodebattler/trunk/pycodebattler/warrior.py

    r85 r87  
    6666    def __init__(self, name, hitpoint, skillpoint, strength, concentration, 
    6767                 defense, agility, luck, skill_list=[], luck_range=5000): 
     68        for val in [hitpoint, skillpoint, strength, concentration, 
     69                    defense, agility, luck, luck_range]: 
     70            if val <= 0: 
     71                raise ValueError('parameter includes invalid value') 
     72 
    6873        self._name = name 
    6974        self._skill_list = {} 
Note: See TracChangeset for help on using the changeset viewer.