def value_bar(self, usr_data): if self.index == 1: print(fonts.font_dark('red') + fonts.bold() + 'HEALTH :', end='' + fonts.default()) elif self.index == 2: print(fonts.font_dark('yellow') + fonts.bold() + 'ATTACK :', end='' + fonts.default()) elif self.index == 8: print(fonts.font_light('blue') + fonts.bold() + 'COMPUTER HEALTH :', end='' + fonts.default()) if int(usr_data[self.index]) < 4: color1 = fonts.bar_dark('red') color2 = fonts.font_dark('red') elif 4 <= int(usr_data[self.index]) <= 7: color1 = fonts.bar_dark('blue') color2 = fonts.font_dark('blue') elif int(usr_data[self.index]) > 7: color1 = fonts.bar_dark('green') color2 = fonts.font_dark('green') else: color1 = fonts.default() color2 = fonts.default() print(color2, '( %d ) ' % int(usr_data[self.index]), end='') for x in range(0, int(usr_data[self.index])): print(color1, end='') print('=', end='') print(fonts.default(), end='') for x in range(int(usr_data[self.index]), 10): print(fonts.bold() + '-', end='') print(fonts.default(), end='')
def zebra_bar(self, color1, color2, lenght): for x in range(0, int(lenght/10)): print(fonts.bar_dark(color1) + ' ', end='' + fonts.default()) print(fonts.bar_dark(color2) + ' ', end='' + fonts.default()) print() #print(fonts.bar_light('grey'), ' ' + fonts.default(), end='') for x in range(0, int(lenght/10)): print(fonts.bar_dark(color2) + ' ', end='' + fonts.default()) print(fonts.bar_dark(color1) + ' ', end='' + fonts.default())
def menu(): system('clear') print("+----------------------------+") print("|" + fonts.bar_dark('red') + fonts.bold() + fonts.font_dark('grey') + " LUCKY SKILLS " + fonts.default() + "|") print("+----------------------------+\n") print(" 1. " + fonts.font_light('green') + "NEW GAME" + fonts.default()) if path.isfile(war.dir_path + 'saved_game.txt'): print(" 2. " + fonts.font_light('yellow') + "LOAD SAVED GAME" + fonts.default()) print(" 3. " + fonts.font_light('blue') + "HIGH SCORE" + fonts.default()) print(" 4. " + fonts.font_dark('purple') + "STORY" + fonts.default()) print(" 5. " + fonts.font_light('white') + "INSTRUCTIONS" + fonts.default()) print(" 6. " + fonts.font_light('red') + "EXIT" + fonts.default()) print() choice = int(input(">>> ")) else: print(" 2. " + fonts.font_light('red') + "EXIT" + fonts.default()) print() choice = int(input(">>> ")) if choice == 2: choice = 6 return choice
def inputs(self): """ This function checks for a correct input from user and TRA! :return: None """ # User input self.usr_input = int(input(fonts.font_dark('green') + "Your Chance: " + fonts.default())) while self.usr_input > 9 or self.usr_input <= 0: print(fonts.bar_dark('red') + '* Please enter correctly *' + fonts.default()) self.usr_input = int(input(fonts.font_dark('green') + "Your Chance: " + fonts.default())) while self.usr_input in self.usr_data[9]: print(fonts.font_dark('red') + '* Number Locked *' + fonts.default()) self.usr_input = int(input(fonts.font_dark('green') + "Your Chance: " + fonts.default())) self.usr_data[9].append(self.usr_input - 1) self.usr_data[9].append(self.usr_input) self.usr_data[9].append(self.usr_input + 1) if self.usr_data[7] >= 3: self.usr_data[9].pop(0) self.usr_data[9].pop(1) self.usr_data[9].pop(2) # computer input tra_input_temp = int(randint(1, 90) % 20) or randint(1, 19) while self.tra_input == tra_input_temp: tra_input_temp = int(randint(1, 90) % 20) or randint(1, 19) self.tra_input = tra_input_temp self.io.speech_tra('I took %d' % self.tra_input, 1)
def display_resource(self): """ Displays the current resource list: Magic cards, Health Point and Attack Point and Score :return: None """ # Bar 1 print(fonts.bar_dark('white')) self.io.print_spaces(90) print(fonts.default()) print() # Player Name print(' ', end='') print(fonts.font_dark('aqua') + fonts.bold() + "PLAYER : " + fonts.default(), end='') print(self.usr_data[0].upper()) # Magic Cards print(' ', end='') self.mc.display_card_resource(self.usr_data) # Player Health Point print(' ', end='') self.hp.value_bar(self.usr_data) # Break self.io.print_spaces(8) print('|', end='') self.io.print_spaces(8) # Computer Health Point self.chp.value_bar(self.usr_data) print() # Attack Point print(' ', end='') self.ap.value_bar(self.usr_data) # Break self.io.print_spaces(8) print('|', end='') self.io.print_spaces(8) # Score print(fonts.font_light('purple') + fonts.bold() + fonts.underline() + 'SCORE: ', self.usr_data[3]) print(fonts.default()) # Any active Magic Card if int(self.usr_data[4]) >= 0: # print(fonts.bar_light('grey'), ' ' + fonts.default() + ' ', end='') print(fonts.font_dark(self.mc.color_code[self.mc.card_list[self.usr_data[4]]]) + fonts.underline() + fonts.bold() + '* ' + self.mc.card_list[self.usr_data[4]], '*' + fonts.font_dark('grey') + ' is active!' + fonts.default()) # print(fonts.bar_light('grey'), ' ', end='') # Bar 2 (zebra) self.io.zebra_bar('grey', 'white', 96) print('\n')