-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Semana 1 #2
Semana 1 #2
Conversation
Co-authored-by: SebaKrag <skraglievich@fi.uba.ar> Co-authored-by: mariagalindez <mgalindez@fi.uba.ar> Co-authored-by: SairBaretto <gbaretto@fi.uba.ar>
Co-authored-by: SebaKrag skraglievich@fi.uba.ar
Co-authored-by: SebaKrag <skraglievich@fi.uba.ar>
Co-authored-by: Sebakrag <skraglievich@fi.uba.ar> Co-authored-by: mariagalindez <mgalindez@fi.uba.ar>
…tests. Co-authored-by: Sebakrag <skraglievich@fi.uba.ar> Co-authored-by: mariagalindez <mgalindez@fi.uba.ar> Co-authored-by: fnpratto <fnpratto@gmail.com> Co-authored-by: SairBarreto <gbarreto@fi.uba.ar>
Co-authored-by: Sebakrag <sebaskrag@gmail.com> Co-authored-by: mariagalindez <mgalindez@fi.uba.ar> Co-authored-by: fnpratto <fnpratto@gmail.com> Co-authored-by: SairBarreto <gbarreto@fi.uba.ar>
Co-authored-by: agus-germi <agerminario@fi.uba.ar> Co-authored-by: mariagalindez <mgalindez@fi.uba.ar>
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>
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar> Co-authored-by: SairBarreto <gbarreto@fi.uba.ar> Co-authored-by: Sebakrag <sebaskrag@gmail.com>
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar> Co-authored-by: SairBarreto <gbarreto@fi.uba.ar>
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar> Co-authored-by: SairBarreto <gbarreto@fi.uba.ar>
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar> Co-authored-by: SairBarreto <gbarreto@fi.uba.ar> Co-authored-by: agus-germi <agerminario@fi.uba.ar> Co-authored-by: fnpratto <fnpratto@gmail.ar>
…Falta implementar test 09 y 12. Co-authored-by: mariagalindez <mgalindez@fi.uba.ar> Co-authored-by: SairBarreto <gbarreto@fi.uba.ar> Co-authored-by: agus-germi <agerminario@fi.uba.ar> Co-authored-by: fnpratto <fnpratto@gmail.ar>
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar>
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar>
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar>
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar> Co-authored-by: fnpratto <fnpratto@gmail.com> Co-authored-by: Sebakrag <sebaskrag@gmail.com>
Welcome to Codecov 🎉Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment. Thanks for integrating Codecov - We've got you covered ☂️ |
Co-authored-by: Sebakrag <sebaskrag@gmail.com> Co-authored-by: agus-germi <agerminario@fi.uba.ar> Co-authored-by: SairBarreto <gbarreto@fi.uba.ar>
Co-authored-by: agus-germi <agerminario@fi.uba.ar> Co-authored-by: Sebakrag <sebaskrag@gmail.com> Co-authored-by: SairBarreto <gbarreto@fi.uba.ar>
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar> Co-authored-by: fnpratto <fnpratto@gmail.com> Co-authored-by: Sebakrag <sebaskrag@gmail.com>
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar> Co-authored-by: Sebakrag <sebaskrag@gmail.com>
public void recibirAtaque(){ | ||
this.disminuirEnergia(this.equipamiento.recibirAtaque()); //ROMPE ENCAPSULAMIENTO | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Se puede evitar el getter de la siguiente forma
public void recibirAtaque(){
this.energia = this.equipamiento.recibirAtaque(this.energia));
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Genial Ale! Ese código pertenece a Gladiador verdad?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obvia la pregunta, acabo de ver el path de arriba jajaja
this.disminuirEnergia(this.equipamiento.recibirAtaque()); //ROMPE ENCAPSULAMIENTO | ||
} | ||
|
||
public void recibirDanio(int danio) { this.disminuirEnergia(danio); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Que diferencia hay entre recibirDanio
y recibirAtaque
si al recibir el ataque se produce un daño?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tenes toda la razón, es un error que tenemos visto y creemos que encontramos una posible solución. En cuanto comencemos con el refactor va a ser lo primero en arreglar. Gracias por la observación
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
De hecho, desarrollamos la idea de la solución en un comentario que está al final del archivo de la clase Jugador.java.
Si llegas a leerlo y nos queres anticipar si es un buen planteo y puede llegar a solucionar lo que nos corregiste, nos ayudaría a ahorrar mucho tiempo 🙌🏽
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
El decorador le falta una vuelta de rosca incluso por como esta el modelo se puede cambiar por un Strategy
.
En la reunion vamos a ver en profundidad los comentarios y como arreglarlos
private void disminuirEnergia(int energia) { | ||
this.energia -= energia; | ||
} | ||
|
||
private void aumentarEnergia(int energia) { | ||
this.energia += energia; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No les veo mucha utilidad la verdad
public class Jugador { | ||
private Gladiador gladiador; | ||
private int turnos; | ||
private int casillaActual; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esto debe pasar a ser private Casilla casillaActual;
public Jugador(Gladiador gladiador) { | ||
this.gladiador = gladiador; | ||
this.turnos = 0; | ||
this.casillaActual = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public Jugador(Gladiador gladiador, Casilla casillaInicial) {
this.gladiador = gladiador;
this.turnos = 0;
this.casillaActual =casillaInicial;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En el código más reciente introdujimos este cambio. De alguna manera el código sobre el que hiciste esta corrección quedó es viejo. Me pregunto si habremos hecho mal el push al PR 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Para que se haga un push al PR se tiene que hacer un push en la rama semana-1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfecto! Mañana a la mañana lo hacemos entonces. Debemos haberlo hecho a la rama Decorator y no nos dimos cuenta 🫣
private int tirarDado() { | ||
final int CARAS_DADO = 6; | ||
|
||
if (this.gladiador.tieneEnergia()) { | ||
Random random = new Random(); | ||
return random.nextInt(CARAS_DADO) + 1; | ||
} | ||
return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esto tiene que estar encapsulado en una entidad que simule el dado, de manera que se pueda mockear y no depender de una clase que puede violar OC como Random
private void avanzar(int cantidad) { | ||
this.casillaActual += cantidad; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
La nueva casilla deberia ser obtenida a partir de que la casilla actual conoce a sus vecinos
private static final int CANTIDAD_COPAS_TOTAL = 6; | ||
private static final int ENERGIA_POR_COPA = 4; | ||
|
||
private Random random = new Random(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
encapsularlo en un objeto Dado o ProvedorRandom, x
public void afectar(Jugador jugador) { | ||
jugador.mejorarEquipamiento(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esta clase debería tener mas responsabilidad, porque sino todos los afectantes simplemente delegan o hacen poquitas cosas
public void afectar(Jugador jugador) {
jugador.mejorarEquipamiento(this);
}
public Equipamiento mejorarEquipamiento(Casco casco)
//... asi para los equipamientos//
public class Lesion { | ||
//el turno siguiente no avanza | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Buscar manera de que haga algo
public int aumentarEnergia(){ | ||
return AUMENTO_ENERGIA; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public int aumentarEnergia(int energiaActual){
return energiaActual + AUMENTO_ENERGIA;
}
public Seniority ascender(int turno) { | ||
return this; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checkear los turnos...
// public void recibirImpacto(Afectante afectante) { | ||
// this.gladiador.recibirImpacto(afectante); | ||
//} | ||
// Con este metodo reemplazariamos los metodos de: | ||
// mejorarEquipamiento() | ||
// recibirAtaque() | ||
// recibirDanio() | ||
// recibirEnergia() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me parece mejor.
// public void recibirImpacto(Lesion lesion) { | ||
// // PROBLEMA con la propuesta de cambio: | ||
// // Aqui el Jugador en el siguiente turno no avanza. | ||
// // Esta logica quizas es conveniente que este en Jugador por el hecho de que un | ||
// // jugador tiene la cantidad de turnos. | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Habria que buscar la manera de impedir que el jugador avance
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar> Co-authored-by: SairBarreto <gbarreto@fi.uba.ar> Co-authored-by: agus-germi <agerminario@fi.uba.ar> Co-authored-by: fnpratto <fnpratto@gmail.com>
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar> Co-authored-by: fnpratto <fnpratto@gmail.com> Co-authored-by: Sebakrag <sebaskrag@gmail.com> Co-authored-by: SairBarreto <gbarreto@fi.uba.ar>
Co-authored-by: mariagalindez <mgalindez@fi.uba.ar> Co-authored-by: fnpratto <fnpratto@gmail.com> Co-authored-by: Sebakrag <sebaskrag@gmail.com> Co-authored-by: SairBarreto <gbarreto@fi.uba.ar>
Primer PR. Faltan Test09 y Test12.