File tree Expand file tree Collapse file tree
src/main/java/jwarrior/juego/niveles Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99public abstract class Nivel {
1010
1111 private final String nombre ;
12+ private final String plano ;
1213 private Jugador jugador ;
1314
14- public Nivel (final String nombre , final Jugador jugador ) {
15+ public Nivel (final String nombre , final String plano , final Jugador jugador ) {
1516 this .nombre = nombre ;
17+ this .plano = plano ;
1618 this .jugador = jugador ;
1719 }
1820
19- public abstract List <Posicion > obtenerPosiciones ();
21+ public final List <Posicion > obtenerPosiciones () {
22+ ConstructorDeNiveles constructor = new ConstructorDeNiveles ();
23+ return constructor .construirPosiciones (this .plano , crearGuerrero ());
24+ }
2025
21- public String obtenerNombre () {
26+ public final String obtenerNombre () {
2227 return this .nombre ;
2328 }
2429
25- protected Guerrero crearGuerrero () {
30+ private Guerrero crearGuerrero () {
2631 return new Guerrero (this .jugador .obtenerNombreDelGuerrero (), this .jugador );
2732 }
2833
Original file line number Diff line number Diff line change 11package jwarrior .juego .niveles ;
22
3- import java .util .List ;
4-
53import jwarrior .juego .Jugador ;
6- import jwarrior .posiciones .Posicion ;
74
85public class Nivel01 extends Nivel {
96
107 public Nivel01 (final Jugador jugador ) {
11- super ("Nivel 01" , jugador );
12- }
13-
14- @ Override
15- public List <Posicion > obtenerPosiciones () {
16- ConstructorDeNiveles constructor = new ConstructorDeNiveles ();
17- return constructor .construirPosiciones ("PG____S" , crearGuerrero ());
8+ super ("Nivel 01" , "PG____S" , jugador );
189 }
1910}
Original file line number Diff line number Diff line change 11package jwarrior .juego .niveles ;
22
3- import java .util .List ;
4-
53import jwarrior .juego .Jugador ;
6- import jwarrior .posiciones .Posicion ;
74
85public class Nivel02 extends Nivel {
96
107 public Nivel02 (final Jugador jugador ) {
11- super ("Nivel 02" , jugador );
12- }
13-
14- @ Override
15- public List <Posicion > obtenerPosiciones () {
16- ConstructorDeNiveles constructor = new ConstructorDeNiveles ();
17- return constructor .construirPosiciones ("PG_oooS" , crearGuerrero ());
8+ super ("Nivel 02" , "PG_oooS" , jugador );
189 }
19-
2010}
Original file line number Diff line number Diff line change 11package jwarrior .juego .niveles ;
22
3- import java .util .List ;
4-
53import jwarrior .juego .Jugador ;
6- import jwarrior .posiciones .Posicion ;
74
85public class Nivel03 extends Nivel {
96
107 public Nivel03 (final Jugador jugador ) {
11- super ("Nivel 03" , jugador );
12- }
13-
14- @ Override
15- public List <Posicion > obtenerPosiciones () {
16- ConstructorDeNiveles constructor = new ConstructorDeNiveles ();
17- return constructor .construirPosiciones ("PG_o_o_oo_oS" , crearGuerrero ());
8+ super ("Nivel 03" , "PG_o_o_oo_oS" , jugador );
189 }
19-
2010}
You can’t perform that action at this time.
0 commit comments