def atacar_con_kit(self, ataque): # Ataca con kit de ingenieros # Retorna string con estado del ataque # NO TESTEADA atacados = f.get_opciones( "VEHICULOS", self.vehiculos, "estado_actual", salir=False) ataque.atacar(atacados) string = "Kit de ingenieros usado exitosamente en {}".format( atacados.name) return string
def menu_ataque(self, vehiculo): # Menu ataques disponibles # NO TESTEADA in_menu_ataque = True while in_menu_ataque: ataque = f.get_opciones( "ATAQUES", vehiculo.ataques_disp(), "__repr__") if not ataque: return True else: in_menu_ataque = self.atacar_con_vehiculo(ataque, vehiculo)
def main_menu(self): # Menu principal # NO TESTEADA in_main = True while in_main: vehiculo = f.get_opciones( "VEHICULOS", self.vehiculos, "estado_actual") if not vehiculo: return True else: print("\n {} \n".format(vehiculo.name)) in_main = self.menu_vehiculo(vehiculo) return in_main
def menu_moverse(self, veh): # Menu moverse # NO TESTEADA in_menu_moverse = True while in_menu_moverse: sector = self.mapa.get_sector_vehiculo(veh) if veh.sym != "Ⓛ" and veh.sym != "Ⓔ": mov = f.get_opciones("MOVIMIENTOS", sector.mov_disp(veh), None) if not mov: return True else: sector.mover_vehiculo(veh, mov) self.stats.mover(veh) s = "{0} movido en direccion {1}".format(veh.name, mov) self.radar.agregar_turno(s) return False elif veh.sym == "Ⓛ": coor_ok = False while not coor_ok: a = "donde desea ubicar cabeza de la lancha" coor = f.get_coor(a, sector) cf = coor[0] cc = coor[1] if veh.is_horizontal() and not cc+1 > 11: if sector.grilla[cf][cc+1] is None: a = sector.encontrar_coordenadas(veh) sector.eliminar_vehiculo(a) sector.grilla[cf][cc] = veh sector.grilla[cf][cc+1] = veh coor_ok = True else: a = "\nEl segundo componente queda en cas ocupada!" print(a) elif not veh.is_horizontal() and not cf+1 > 11: if sector.grilla[cf+1][cc] is None: a = sector.encontrar_coordenadas(veh) sector.eliminar_vehiculo(a) sector.grilla[cf][cc] = veh sector.grilla[cf+1][cc] = veh coor_ok = True else: a = "\nEl segundo componente queda en cas ocupada!" print(a) else: a = "\nEl segundo componente traspasa el tablero!" print(a) self.stats.mover(veh) self.radar.agregar_turno("Lancha movida exitosamente") return False elif veh.sym == "Ⓔ": coor_ok = False while not coor_ok: coor = f.get_coor("donde desea ubicar el centro (es 3x3)",sector) res = sector.revisar_around_coor(coor) if isinstance(res,list): coor_ok = True sector.eliminar_vehiculo(sector.encontrar_coordenadas(veh)) for i,j in res: sector.grilla[i][j] = veh exploracion = veh.explorar(res, self.juego.el_otro(self).mapa) self.stats.mover(veh) s = "Explorador revelo {} vehiculos".format(exploracion[0]) if exploracion[1]: s += " en sector maritimo enemigo y si revelo ubicacion" s1 = "En turno enemigo ud fue explorado en " s1 += " ".join([abc[i[0]]+str(i[1]) for i in res]) self.juego.el_otro(self).radar.agregar_anuncio(s1) self.juego.el_otro(self).anuncio = s1 elif not exploracion[1]: s += " en sector maritimo enemigo y no revelo ubicacion" print("\n" + s) self.radar.agregar_turno(s) else: print(res) return False