Changeset 85 for pycodebattler
- Timestamp:
- 01/06/11 20:58:00 (14 years ago)
- Location:
- pycodebattler/trunk/pycodebattler
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pycodebattler/trunk/pycodebattler/battle.py
r71 r85 133 133 ]] 134 134 players = [ 135 pycodebattler.warrior.Warrior (135 pycodebattler.warrior.Warrior.make( 136 136 pycodebattler.util.path2name(f), 137 137 open(f), -
pycodebattler/trunk/pycodebattler/scouter.py
r71 r85 20 20 def _main_entry(): 21 21 if len(sys.argv) == 1: 22 p = [pycodebattler.warrior.Warrior ('stdin', sys.stdin)]22 p = [pycodebattler.warrior.Warrior.make('stdin', sys.stdin)] 23 23 else: 24 p = [pycodebattler.warrior.Warrior (24 p = [pycodebattler.warrior.Warrior.make( 25 25 pycodebattler.util.path2name(f), open(f)) 26 26 for f in sys.argv[1:]] -
pycodebattler/trunk/pycodebattler/warrior.py
r71 r85 64 64 65 65 class Warrior: 66 def __init__(self, name, fp, skill_list=[], luck_range=5000): 67 scorer = pycodebattler.score.Scorer(fp.readlines()) 68 69 self._luck_range = luck_range 66 def __init__(self, name, hitpoint, skillpoint, strength, concentration, 67 defense, agility, luck, skill_list=[], luck_range=5000): 70 68 self._name = name 71 69 self._skill_list = {} 72 self._max_hitpoint = self._hitpoint = scorer.style_score() 73 self._max_skillpoint = self._skillpoint = scorer.name_score() 74 self._strength = scorer.complex_score() 75 self._concentration = scorer.colon_score() 76 self._defense = scorer.lines_score() 77 self._agility = scorer.const_score() 78 self._luck = luck_range // (self.hitpoint() + 79 self.skillpoint() + 80 self.strength() + 81 self.concentration() + 82 self.defense() + 83 self.agility()) 70 self._max_hitpoint = self._hitpoint = hitpoint 71 self._max_skillpoint = self._skillpoint = skillpoint 72 self._strength = strength 73 self._concentration = concentration 74 self._defense = defense 75 self._agility = agility 76 self._luck = luck 77 self._luck_range = luck_range 84 78 85 79 for sk in skill_list: 86 80 self._skill_list[sk.name()] = sk 81 82 @classmethod 83 def make(klass, name, fp, skill_list=[], luck_range=5000): 84 scorer = pycodebattler.score.Scorer(fp.readlines()) 85 86 hitpoint = scorer.style_score() 87 skillpoint = scorer.name_score() 88 strength = scorer.complex_score() 89 concentration = scorer.colon_score() 90 defense = scorer.lines_score() 91 agility = scorer.const_score() 92 luck = luck_range // (hitpoint + skillpoint + strength + 93 concentration + defense + agility) or 1 94 95 return klass(name, hitpoint, skillpoint, strength, concentration, 96 defense, agility, luck, skill_list, luck_range) 87 97 88 98 def __str__(self):
Note: See TracChangeset
for help on using the changeset viewer.