예제 #1
0
    def execute(self):
        try:
            self.stats_refresh()
            with open(self.form, 'r', encoding='UTF-8') as file:
                event_form = file.read().split('|')
                for elem in event_form:
                    if elem in self.properties:
                        event_form[event_form.index(elem)] = str(
                            self.properties[elem])
                con.hero.data['c_hp'] += self.properties['hp']
                con.hero.data['money'] += self.properties['money']
                con.hero.data['characteristics']['Damage'] += self.properties[
                    'dm']
                con.hero.data['characteristics']['Armor'] += self.properties[
                    'arm']
                con.hero.data['characteristics'][
                    'HealPoints'] += self.properties['HealPoints']
                con.hero.data['exp'] += self.properties['exp']
                con.hero.data['lvl'] += self.properties['lvl']
                if self.properties['Manka'] is not True:
                    while con.hero.data['invent'].count('манка') > 0:
                        con.hero.data['invent'].pop(
                            con.hero.data['invent'].index('манка'))

                con.check_player_stats()
                return ({
                    'text': ''.join(event_form),
                    'stats': self.properties
                })
        except Exception:
            return ({'text': 'Error with file "' + self.form + '".'})
예제 #2
0
def chealpot():
    if con.hero.data['invent'].count('хилка') > 0 and con.hero.data['in_battle'] and \
            con.hero.data['cur_loc'] == 'caves':
        con.hero.data['invent'].pop(con.hero.data['invent'].index('хилка'))
        con.hero.data['c_hp'] += 5 * con.hero.data['lvl']
        con.check_player_stats()
    else:
        run_away()
    con.refresh_db()
    return redirect('/caves')
예제 #3
0
 def lose(self):
     con.hero.data['money'] -= 666
     con.hero.data['c_hp'] = 6
     con.check_player_stats()
     con.hero.data['in_battle'] = False
     return ({'status': 'lose', 'money': -666})
예제 #4
0
 def victory(self):
     con.hero.data['money'] += 666
     con.hero.data['exp'] += 666
     con.check_player_stats()
     return ({'status': 'victory', 'exp': 666, 'money': 666})
예제 #5
0
 def victory(self):
     con.hero.data['money'] += 3000
     con.hero.data['exp'] += 1000
     con.check_player_stats()
     return ({'status': 'victory', 'exp': 1000, 'money': 3000})
예제 #6
0
 def victory(self):
     con.hero.data['money'] += 170
     con.hero.data['exp'] += 540
     con.check_player_stats()
     return ({'status': 'victory', 'exp': 540, 'money': 170})
예제 #7
0
 def victory(self):
     con.hero.data['money'] += 30
     con.hero.data['exp'] += 50
     con.hero.data['invent'].append('хилка')
     con.check_player_stats()
     return ({'status': 'victory', 'exp': 50, 'money': 30})
예제 #8
0
 def victory(self):
     con.hero.data['money'] += 9
     con.hero.data['exp'] += 25
     con.check_player_stats()
     return ({'status': 'victory', 'exp': 15, 'money': 9})
예제 #9
0
 def victory(self):
     con.hero.data['money'] += 111
     con.hero.data['exp'] += 470
     con.check_player_stats()
     return ({'status': 'victory', 'exp': 470, 'money': 111})
예제 #10
0
 def victory(self):
     con.hero.data['money'] += 24
     con.hero.data['exp'] += 150
     con.check_player_stats()
     return ({'status': 'victory', 'exp': 150, 'money': 24})