Skip to content

Commit

Permalink
feat: Cambiamos atributos de publicos a privados. Modificamos test 01.
Browse files Browse the repository at this point in the history
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar>
  • Loading branch information
agus-germi and mariagalindez committed Nov 20, 2023
1 parent 0de2b3c commit e9bfb47
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/main/java/edu/fiuba/algo3/modelo/Jugador.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ private void avanzar(int cantidad){
}

private int tirarDado() {
int CARAS_DADO = 6;

if (this.gladiador.tieneEnergia()) {
Random random = new Random();
return random.nextInt(6) + 1;
return random.nextInt(CARAS_DADO) + 1;
}
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import edu.fiuba.algo3.modelo.Seniority;

public class Novato implements Seniority {
public static final int AUMENTO_ENERGIA = 0;
private static final int AUMENTO_ENERGIA = 0;

public Seniority ascender(int turno) {
if (turno == 8) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import edu.fiuba.algo3.modelo.Seniority;

public class SemiSenior implements Seniority {
public static final int AUMENTO_ENERGIA = 5;
private static final int AUMENTO_ENERGIA = 5;

public Seniority ascender(int turno) {
if (turno == 12) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import edu.fiuba.algo3.modelo.Seniority;

public class Senior implements Seniority {
public static final int AUMENTO_ENERGIA = 10;
private static final int AUMENTO_ENERGIA = 10;

public Seniority ascender(int turno) {
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@
public class CasosDeUsoSemana1Test {
@Test
public void test01SeInicializaUnJugadorConLaEnergiaYElEquipamientoCorrecto() {

int energiaInicial = 20;
int energiaLuegoDeSerAtacado = 0;
Gladiador gladiador = new Gladiador();
Jugador jugador = new Jugador(gladiador);
Fiera fiera = new Fiera();

Assertions.assertTrue(jugador.energiaIgualA(energiaInicial));
// sigue arrange act y assert. A que costo ? je
boolean jugadorAlCrearseTieneEnergiaInicial = jugador.energiaIgualA(energiaInicial);

//Probamos el comportamiento de un Gladiador desequipado (asi se debe instanciar).
fiera.afectar(jugador);

Assertions.assertTrue(jugadorAlCrearseTieneEnergiaInicial);
Assertions.assertTrue(jugador.energiaIgualA(energiaLuegoDeSerAtacado));
}

Expand Down

0 comments on commit e9bfb47

Please sign in to comment.