import debug as _dbg from utils import logs as _log def get_winner(context, Arena, chat_id): winner= Arena.get_alive_players()[0] try: context.job.schedule_removal() _log.log_info(f'simulate_day: {chat_id} Loop removed') except: pass msg= f'{winner.get_name_and_stats()} Vince la cruenta battaglia ' msg+= f'uccidendo {winner.get_kills()} giocatori ' msg+= f'e schivando {winner.get_dodges()} colpi nemici, e vive felice e ' if winner.player_gender_is_male(): msg+= 'contento con Guarino' elif winner.player_gender_is_female(): msg+= 'contenta con Guarino' else: msg+= 'content# con Guarino' return msg async def simulate_day(context, chat_id): if 'arena' not in context.application.bot_data: _log.log_info('simulate_day: {chat_id} Arena not Found') await context.bot.send_message(chat_id, 'Che e\' successo? un Guarino ha rubato l\'arena, avvia una nuova partita con /start') return Arena= context.application.bot_data['arena'] if len(Arena.get_alive_players()) <= 1: return await context.bot.send_message(chat_id, 'Il gioco e\' finito, Grazie per aver giocato!') await context.bot.send_message(chat_id, f'Giorno #{Arena.day}') msg= _dbg.play_one_day_debug(Arena) await context.bot.send_message(chat_id, msg) #Print the ranking each day msg= Arena.get_ranking() await context.bot.send_message(chat_id, msg) if len(Arena.get_alive_players()) == 1: msg= get_winner(context, Arena, chat_id) return await context.bot.send_message(chat_id, msg)