@@ -580,6 +580,7 @@ public void enviarMensaje(String mensaje, Object... args) {
580
580
* @return
581
581
*/
582
582
public boolean golpea () {
583
+ // @TODO: Verificar intervalos
583
584
// @TODO: Cancelar /salir
584
585
if (isMeditando ()) {
585
586
// No podes golpear si estas meditando
@@ -591,12 +592,25 @@ public boolean golpea() {
591
592
}
592
593
// @TODO: Sacar ocultarse
593
594
595
+ // Verificamos que tengamos energia para luchar
596
+ if (getStamina ().getMin () < Balance .COMBATE_ENERGIA_NECESARIA ) {
597
+ if ("MUJER" .equals (getGenero ())) {
598
+ enviarMensaje ("Estas muy cansada para luchar." );
599
+ return false ;
600
+ }
601
+ enviarMensaje ("Estas muy cansado para luchar." );
602
+ return false ;
603
+ }
604
+
594
605
Posicion nuevaPosicion = Logica .calcularPaso (getCoordenada ().getPosicion (), orientacion );
595
606
Mapa m = Servidor .getServidor ().getMapa (getCoordenada ().getMapa ());
596
607
Baldosa b = m .getBaldosa (nuevaPosicion );
597
608
598
609
if (b .getCharindex () == 0 ) {
610
+ // Arrojamos un golpe al aire, enviamos el sonido y disminuimos la energia
599
611
getConexion ().enviarMundoReproducirSonido (Sonidos .SND_SWING );
612
+ getStamina ().disminuir (Balance .COMBATE_ENERGIA_NECESARIA );
613
+ getConexion ().enviarUsuarioStats ();
600
614
return true ;
601
615
}
602
616
@@ -608,6 +622,8 @@ public boolean golpea() {
608
622
Personaje victima = Servidor .getServidor ().getPersonaje (charindex );
609
623
610
624
enviarMensaje ("Le pegaste a " + victima .getNombre ());
625
+ getStamina ().disminuir (Balance .COMBATE_ENERGIA_NECESARIA );
626
+ getConexion ().enviarUsuarioStats ();
611
627
612
628
// // Le avisamos a los otros clientes que el usuario se movio
613
629
// Servidor.getServidor().todosMenosUsuarioArea(this, (usuario, conexion) -> {
0 commit comments