Skip to content

Commit

Permalink
feat: Actualizamos.
Browse files Browse the repository at this point in the history
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar>
Co-authored-by: fnpratto <fnpratto@gmail.com>
Co-authored-by: Sebakrag <sebaskrag@gmail.com>
  • Loading branch information
4 people committed Nov 20, 2023
1 parent 477e95f commit 1cc3132
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 17 deletions.
3 changes: 1 addition & 2 deletions src/main/java/edu/fiuba/algo3/modelo/Gladiador.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public boolean tieneEnergia(){
}

public void recibirAtaque(){
this.disminuirEnergia(this.equipamiento.recibirAtaque());
this.disminuirEnergia(this.equipamiento.recibirAtaque()); //ROMPE ENCAPSULAMIENTO
}

public void recibirDanio(int danio) { this.disminuirEnergia(danio); }
Expand All @@ -47,7 +47,6 @@ public void mejorarSeniority(int turnos){

public void recibirEnergia(int energia) { this.aumentarEnergia(energia); }


// -------------------------------- PRIVADOS -------------------------------- //
private void disminuirEnergia(int energia) {
this.energia -= energia;
Expand Down
14 changes: 8 additions & 6 deletions src/main/java/edu/fiuba/algo3/modelo/Jugador.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,37 @@ public boolean tieneTurnosIgualA(int cantidad) {
return (this.turnos == cantidad);
}

public boolean energiaIgualA(int energia){
public boolean energiaIgualA(int energia) {
return this.gladiador.energiaIgualA(energia);
}

public boolean estaEnCasilla(int numeroCasilla) {
return (this.casillaActual == numeroCasilla);
}

public void recibirEnergia(int aumentoEnergia){ this.gladiador.recibirEnergia(aumentoEnergia); }
public void recibirEnergia(int aumentoEnergia) {
this.gladiador.recibirEnergia(aumentoEnergia);
}

public void mejorarEquipamiento() {
this.gladiador.mejorarEquipamiento();
}

public void recibirAtaque(){
public void recibirAtaque() {
this.gladiador.recibirAtaque();
}

public void recibirDanio(int danio){
public void recibirDanio(int danio) {
this.gladiador.recibirDanio(danio);
}

// -------------------------------- PRIVADOS -------------------------------- //
private void avanzar(int cantidad){
private void avanzar(int cantidad) {
this.casillaActual += cantidad;
}

private int tirarDado() {
int CARAS_DADO = 6;
final int CARAS_DADO = 6;

if (this.gladiador.tieneEnergia()) {
Random random = new Random();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import edu.fiuba.algo3.modelo.Jugador;
import edu.fiuba.algo3.modelo.equipamientos.DecoradorEquipamiento;


public class EscudoYEspada extends DecoradorEquipamiento {
private static final int DANIO = 2;

Expand Down
6 changes: 0 additions & 6 deletions src/main/test/edu/fiuba/algo3/GladiadorTests.java

This file was deleted.

48 changes: 48 additions & 0 deletions src/main/test/edu/fiuba/algo3/testsUnitarios/GladiadorTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package edu.fiuba.algo3.testsUnitarios;
import edu.fiuba.algo3.modelo.Equipamiento;
import edu.fiuba.algo3.modelo.Gladiador;
import edu.fiuba.algo3.modelo.Seniority;
import edu.fiuba.algo3.modelo.seniorities.Novato;
import edu.fiuba.algo3.modelo.equipamientos.Desequipado;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class GladiadorTests {
@Test
public void test01GladiadorSeCreaConVeinteDeEnergia(){
int energiaInicial = 20;
Gladiador gladiador = new Gladiador();

Assertions.assertTrue(gladiador.energiaIgualA(energiaInicial));
}

@Test
public void test02GladiadorRecibeEnergiaCorrectamente(){
Gladiador gladiador = new Gladiador();
int aumento = 10;
int energiaEsperada = 30;

gladiador.recibirEnergia(aumento);

Assertions.assertTrue(gladiador.energiaIgualA(energiaEsperada));
}

@Test
public void test03GladiadorRecibeDanioCorrectamente(){
Gladiador gladiador = new Gladiador();
int danio = 15;
int energiaEsperada = 5;

gladiador.recibirDanio(danio);

Assertions.assertTrue(gladiador.energiaIgualA(energiaEsperada));
}

public void test04GladiadorTieneEnergia() {
//Gladiador gladiador = new Gladiador();

//gladiador.recibirDanio(danio);

//Assertions.assertTrue(gladiador.energiaIgualA(energiaEsperada));
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package edu.fiuba.algo3;
package edu.fiuba.algo3.testsUnitarios;

import edu.fiuba.algo3.modelo.Seniority;
import edu.fiuba.algo3.modelo.seniorities.Novato;
Expand All @@ -8,6 +8,7 @@

public class NovatoTests {
@Test
//mockito ?
public void test01SiTurnoEsMenorQueOchoAscenderDevuelveASiMismo(){
Novato novato = new Novato();
int turno = 4;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package edu.fiuba.algo3;
package edu.fiuba.algo3.testsUnitarios;
import edu.fiuba.algo3.modelo.Seniority;
import edu.fiuba.algo3.modelo.seniorities.SemiSenior;
import org.junit.jupiter.api.Assertions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package edu.fiuba.algo3;
package edu.fiuba.algo3.testsUnitarios;
import edu.fiuba.algo3.modelo.Seniority;
import edu.fiuba.algo3.modelo.seniorities.Senior;
import org.junit.jupiter.api.Assertions;
Expand Down

0 comments on commit 1cc3132

Please sign in to comment.