Changeset 67 for pycgibattler/trunk


Ignore:
Timestamp:
12/20/10 00:08:10 (10 years ago)
Author:
atzm
Message:

performance up

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pycgibattler/trunk/index.cgi

    r66 r67  
    5353    DATA_DIR = os.path.expanduser(CONFIG.get('data', 'basedir')) 
    5454 
    55     CHARA_NAMES = [x.strip() for x in open(os.path.expanduser( 
    56         CONFIG.get('character', 'name_list_file'))).xreadlines()] 
    57     SKILL_NAMES = [x.strip() for x in open(os.path.expanduser( 
    58         CONFIG.get('character', 'skill_list_file'))).xreadlines()] 
    59     SKILL_TYPES = [ 
    60         #pycodebattler.skill.HealType, 
    61         #pycodebattler.skill.ResurrectionType, 
    62         pycodebattler.skill.SingleAttackType, 
    63         pycodebattler.skill.RangeAttackType, 
    64         pycodebattler.skill.MultiAttackType, 
    65         pycodebattler.skill.SuicideAttackType, 
    66     ] 
    67  
    6855    def __init__(self, id_): 
    6956        if not self.VALID_ID.match(id_): 
     
    134121    @classmethod 
    135122    def make_warrior(klass, code): 
     123        chara_names = [x.strip() for x in open(os.path.expanduser( 
     124            CONFIG.get('character', 'name_list_file'))).xreadlines()] 
     125        skill_names = [x.strip() for x in open(os.path.expanduser( 
     126            CONFIG.get('character', 'skill_list_file'))).xreadlines()] 
     127        skill_types = [ 
     128            #pycodebattler.skill.HealType, 
     129            #pycodebattler.skill.ResurrectionType, 
     130            pycodebattler.skill.SingleAttackType, 
     131            pycodebattler.skill.RangeAttackType, 
     132            pycodebattler.skill.MultiAttackType, 
     133            pycodebattler.skill.SuicideAttackType, 
     134        ] 
     135 
    136136        lc = ListChooser(code) 
    137         name = lc.choose(klass.CHARA_NAMES) 
     137        name = lc.choose(chara_names) 
    138138        skills = [] 
    139139 
    140140        for i in range(lc.choose(range(1, 4))): 
    141141            lc.lslide(i) 
    142             skname = lc.choose(klass.SKILL_NAMES) 
    143             sktype = lc.choose(klass.SKILL_TYPES) 
     142            skname = lc.choose(skill_names) 
     143            sktype = lc.choose(skill_types) 
    144144            sklevel = lc.choose(range(1, 4)) 
    145145            skpoint = lc.choose(range(sklevel * 4, sklevel * 7)) 
Note: See TracChangeset for help on using the changeset viewer.