forked from Cryz/battle_royale_sim
35 lines
1.3 KiB
Python
35 lines
1.3 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
|
|
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:
|
|
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)
|
|
if len(Arena.get_alive_players()) == 1:
|
|
msg= get_winner(Arena)
|
|
return await context.bot.send_message(chat_id, msg)
|