Skip to content

Commit

Permalink
Primer caso de uso (a medias).
Browse files Browse the repository at this point in the history
Co-authored-by: agus-germi <agerminario@fi.uba.ar>
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar>
Co-authored-by: SairBarreto <gbarreto@fi.uba.ar>
Co-authored-by: fnpratto <fnpratto@gmail.com>
  • Loading branch information
5 people committed Nov 17, 2023
1 parent 76cd139 commit b243489
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 80 deletions.

This file was deleted.

7 changes: 0 additions & 7 deletions src/main/java/edu/fiuba/algo3/modelo/Equipamiento/Casco.java

This file was deleted.

This file was deleted.

21 changes: 17 additions & 4 deletions src/main/java/edu/fiuba/algo3/modelo/Gladiador.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package edu.fiuba.algo3.modelo;
//Energia inicial -> como constante ?

import edu.fiuba.algo3.modelo.seniorities.Novato;
import edu.fiuba.algo3.modelo.equipamientos.Desequipado;

public class Gladiador {
//Declaramos constantes ?
private static final int ENERGIA_INICIAL = 20;

private int energia;
private Seniority seniority;
private Equipamiento equipamiento;

public Gladiador() {
this.energia = 20;
this.energia = ENERGIA_INICIAL;
this.seniority = new Novato();
this.equipamiento = new Desequipado();
}
Expand All @@ -19,8 +25,15 @@ public void disminuirEnergia(int energia) {
this.energia -= energia;
}

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

public Equipamiento equipamientoGladiador(){
return this.equipamiento;
}

// public void recibirAtaque(Obstaculo unObstaculo){
// this.energia -= unObstaculo.reducirEnergia(this.equipamiento);
//}
}
8 changes: 5 additions & 3 deletions src/main/java/edu/fiuba/algo3/modelo/Jugador.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package edu.fiuba.algo3.modelo;

import java.util;

//Decorator pattern para equipamiento ?¿
public class Jugador {
private int energia;
public class Jugador{
private Gladiador gladiador;

//private Casilla casilla;
Expand All @@ -13,5 +11,9 @@ public Jugador(Gladiador gladiador) {
this.gladiador = gladiador;
}

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


}
8 changes: 0 additions & 8 deletions src/main/java/edu/fiuba/algo3/modelo/Seniority/Senior.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package edu.fiuba.algo3.modelo.equipamientos;

import edu.fiuba.algo3.modelo.Equipamiento;

public class Armadura implements Equipamiento {
public Equipamiento mejorarEquipamiento() {
return new EscudoYEspada();
}
}
9 changes: 9 additions & 0 deletions src/main/java/edu/fiuba/algo3/modelo/equipamientos/Casco.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package edu.fiuba.algo3.modelo.equipamientos;

import edu.fiuba.algo3.modelo.Equipamiento;

public class Casco implements Equipamiento {
public Equipamiento mejorarEquipamiento() {
return new Armadura();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package edu.fiuba.algo3.modelo.equipamientos;

import edu.fiuba.algo3.modelo.Equipamiento;

public class Desequipado implements Equipamiento {
public Equipamiento mejorarEquipamiento() {
return new Casco();
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package edu.fiuba.algo3.modelo.Equipamiento;
package edu.fiuba.algo3.modelo.equipamientos;

import edu.fiuba.algo3.modelo.Equipamiento;

public class EscudoYEspada implements Equipamiento {
public Equipamiento mejorarEquipamiento() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package edu.fiuba.algo3.modelo.Equipamiento;
package edu.fiuba.algo3.modelo.equipamientos;

import edu.fiuba.algo3.modelo.Equipamiento;

public class Llave implements Equipamiento {
public Equipamiento mejorarEquipamiento() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package edu.fiuba.algo3.modelo.Seniority;
package edu.fiuba.algo3.modelo.seniorities;

import edu.fiuba.algo3.modelo.Seniority;

public class Novato implements Seniority {
public Seniority ascender(int turno) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package edu.fiuba.algo3.modelo.Seniority;
package edu.fiuba.algo3.modelo.seniorities;

import edu.fiuba.algo3.modelo.Seniority;

public class SemiSenior implements Seniority {
public Seniority ascender(int turno) {
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/edu/fiuba/algo3/modelo/seniorities/Senior.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package edu.fiuba.algo3.modelo.seniorities;

import edu.fiuba.algo3.modelo.Seniority;

public class Senior implements Seniority {
public Seniority ascender(int turno) {
return this;
}

}
20 changes: 0 additions & 20 deletions src/main/test/edu/fiuba/algo3/entrega_2/MessageTest2.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
package edu.fiuba.algo3.entregas;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import edu.fiuba.algo3.modelo.*;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class CasosDeUsoSemana1Test {
@Test
public void test01SeInicializaUnJugadorConLaEnergiaYElEquipamientoCorrecto() {

int energiaInicial = 20;
Gladiador gladiador = new Gladiador();
Jugador jugador = new Jugador(gladiador);

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

@Test
public void test02JugadorSaleCorrectamenteDeLaCasillaInicial() {
}
Expand Down
20 changes: 0 additions & 20 deletions src/main/test/edu/fiuba/algo3/entregas/MessageTest.java

This file was deleted.

0 comments on commit b243489

Please sign in to comment.