def sanar_deportista(self): if self.dinero >= param.COSTO_SANAR: tablero_deportistas(self.equipo) deportista = input( "Escriba el nombre del deportista que piensa sanar: ") while not (isinstance(deportista, str) and deportista in self.equipo): print("Opción inválida, intente denuevo \n") deportista = input( "Escriba el nombre del deportista que piensa sanar: ") formula_recuperar = round( min( 1, max(0, (self.equipo[deportista].moral * (self.implem_medicos + self.excelencia_respeto) / 200))), 1) recuperar_real = round(uniform(0, 1), 1) if recuperar_real <= formula_recuperar: self.equipo[deportista].lesionado = False print(f"{deportista} se ha sanado!") else: print(f"Se ha fallado sanando a {deportista} =(") self.dinero -= param.COSTO_SANAR * 2 else: print("Dinero insuficiente para sanar a un deportista!")
def entrenar_deportista(self): if self.dinero >= param.COSTO_ENTRENAR: tablero_deportistas(self.equipo) deportista = input( "Escriba el nombre del deportista que piensa entrenar: ") while not (isinstance(deportista, str) and deportista in self.equipo): print("Opción inválida, intente denuevo \n") deportista = input( "Escriba el nombre del deportista que piensa entrenar: ") habilidad = input( "Eliga que habilidad desea entrenar (velocidad, flexibilidad o resistencia): " ) while habilidad.upper() != "VELOCIDAD" and habilidad.upper( ) != "FLEXIBILIDAD" and habilidad.upper() != "RESISTENCIA": print("Opción inválida, intente denuevo \n") habilidad = input( "Eliga que habilidad desea entrenar (velocidad, flexibilidad o resistencia): " ) self.equipo[deportista].entrenar(habilidad.upper()) print(f"Has entrenado la {habilidad} de {deportista} !") self.dinero -= param.COSTO_ENTRENAR else: print("Insuficiente dinero, no se puede entrenar al deportista!")
def mostrar_estado(self): print("\n") tablero_delegacion(self.usuario) tablero_deportistas(self.usuario.equipo) print("*" * 100) print("*" * 100) tablero_delegacion(self.rival) tablero_deportistas(self.rival.equipo) print("*" * 100) print("*" * 100) print("\n")
def fichar(self, deportistas_disponibles): print(f"Se tiene {self.dinero} disponible \n") tablero_deportistas(deportistas_disponibles, True) fichaje = input( "Escriba el nombre del deportista que piensa reclutar: ") while not (isinstance(fichaje, str) and fichaje in deportistas_disponibles): print("Opción inválida, intente denuevo \n") fichaje = input( "Escriba el nombre del deportista que piensa reclutar: ") if deportistas_disponibles[fichaje].precio <= self.dinero: self.equipo[fichaje] = deportistas_disponibles[fichaje] self.equipo[fichaje].identidad = self.nombre deportistas_disponibles.pop(fichaje) self.dinero -= self.equipo[fichaje].precio else: print( "No se tiene dinero suficiente para fichar a este deportista!\n" )
def realizar_competencias(self): print("Llegó la hora de elegir a los competidores! \n") tablero_deportistas(self.usuario.equipo) usuario_atl, usuario_cicl, usuario_gimn, usuario_nata = None, None, None, None while usuario_atl not in self.usuario.equipo: usuario_atl = input( "Escriba el nombre de su deportista para Atletismo: ") tablero_deportistas(self.usuario.equipo) while usuario_cicl not in self.usuario.equipo: usuario_cicl = input( "Escriba el nombre su deportista para Ciclismo: ") tablero_deportistas(self.usuario.equipo) while usuario_gimn not in self.usuario.equipo: usuario_gimn = input("Seleccione a su deportista para Gimnasia: ") tablero_deportistas(self.usuario.equipo) while usuario_nata not in self.usuario.equipo: usuario_nata = input("Seleccione a su deportista para Natacion: ") usuario_competidores = { "atletismo": self.usuario.equipo[usuario_atl], "ciclismo": self.usuario.equipo[usuario_cicl], "gimnasia": self.usuario.equipo[usuario_gimn], "natacion": self.usuario.equipo[usuario_nata] } rival_competidores = { "atletismo": choice(list(self.rival.equipo.values())), "ciclismo": choice(list(self.rival.equipo.values())), "gimnasia": choice(list(self.rival.equipo.values())), "natacion": choice(list(self.rival.equipo.values())) } self.dias_competencia[self.dia_actual] = DiaCompetencia( self.dia_actual, usuario_competidores, rival_competidores, [self.usuario, self.rival]) self.dia_actual += 1 if self.dia_actual >= DIAS_COMPETENCIA / 2: self.terminar_campeonato()