forked from Cryz/battle_royale_sim
36 lines
1.5 KiB
Python
36 lines
1.5 KiB
Python
import debug as _dbg
|
|
|
|
def get_winner(Arena):
|
|
winner= Arena.get_alive_players()[0]
|
|
try:
|
|
context.job.schedule_removal()
|
|
print(f'simulate_day: Loop removed')
|
|
except: pass
|
|
day= Arena.day
|
|
if winner.player_gender_is_male():
|
|
msg= f'{winner.get_name_and_stats()} Vince la cruenta battaglia uccidendo {winner.get_kills()} giocatori, e vive felice e contento con Guarino'
|
|
elif winner.player_gender_is_female():
|
|
msg= f'{winner.get_name_and_stats()} Vince la cruenta battaglia uccidendo {winner.get_kills()} giocatori, e vive felice e contenta con Guarino'
|
|
else:
|
|
msg= f'{winner.get_name_and_stats()} Vince la cruenta battaglia uccidendo {winner.get_kills()} giocatori, e vive felice e content# con Guarino'
|
|
return msg
|
|
|
|
async def simulate_day(context, chat_id):
|
|
if 'arena' not in context.application.bot_data:
|
|
print('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(Arena)
|
|
return await context.bot.send_message(chat_id, msg)
|