Commit 13b51bf3 authored by moises reinaldo quiroz diaz's avatar moises reinaldo quiroz diaz
Browse files

ahora todas las clases hacen algo

parent 2afe34f1
No related merge requests found
Showing with 42 additions and 30 deletions
+42 -30
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -13,24 +13,31 @@ import java.util.Random;
* @author Moises
*/
public class Arquero extends Usuario {
private int hp;
private int nivel=1;
private int atk;
private final Random random = new Random();
ArrayList<Habilidad> habilidades;
private ArrayList<Habilidad> habilidades;
public Arquero(String nombre) {
super(nombre);
this.habilidades = new ArrayList<>();
this.atk=15;
this.hp=150;
Arquero.this.setHp(200);
Arquero.setAtq(50);
}
@Override
public void hablar(){
System.out.println("Hola Arquero "+getNombre()+" tu historia comienza aqui: \n");
}
@Override
public void agregarHabilidad(){
if (Mago.getNivel()==1) {
Habilidad basico = new Habilidad("Ataque Basico", 10);
habilidades.add(basico);
} else if (Mago.getNivel() == 3) {
Habilidad habilidad = new Habilidad("habilidad1", 20);
habilidades.add(habilidad);
} else if (Mago.getNivel() == 4){
habilidades.add(new Habilidad("habilidad2", 30));
} else if (Mago.getNivel() == 5){
habilidades.add(new Habilidad("habilidad3", 40));}
}
......
......@@ -14,24 +14,31 @@ import java.util.Random;
* @author Moises
*/
public class Guerrero extends Usuario {
private int hp;
private int nivel=1;
private int atk;
private final Random random = new Random();
ArrayList<Habilidad> habilidades;
private ArrayList<Habilidad> habilidades;
public Guerrero(String nombre) {
super(nombre);
this.habilidades = new ArrayList<>();
this.atk=15;
this.hp=150;
Guerrero.this.setHp(200);
Guerrero.setAtq(50);
}
@Override
public void hablar(){
System.out.println("Hola guerrero "+getNombre()+" tu historia comienza aqui: \n");
}
@Override
public void agregarHabilidad(){
if (Mago.getNivel()==1) {
Habilidad basico = new Habilidad("Ataque Basico", 10);
habilidades.add(basico);
} else if (Mago.getNivel() == 3) {
Habilidad habilidad = new Habilidad("habilidad1", 20);
habilidades.add(habilidad);
} else if (Mago.getNivel() == 4){
habilidades.add(new Habilidad("habilidad2", 30));
} else if (Mago.getNivel() == 5){
habilidades.add(new Habilidad("habilidad3", 40));}
}
......
......@@ -13,19 +13,12 @@ import java.util.Random;
* @author Moises
*/
public class Mago extends Usuario {
private int nivel=1;
private final Random random = new Random();
ArrayList<Habilidad> habilidades;
private ArrayList<Habilidad> habilidades;
public Mago(String nombre) {
super(nombre);
this.habilidades = new ArrayList<>();
Mago.this.setHp(200);
Mago.setAtq(50);
}
@Override
......@@ -34,15 +27,15 @@ public class Mago extends Usuario {
}
@Override
public void agregarHabilidad(){
if (nivel ==1) {
if (Mago.getNivel()==1) {
Habilidad basico = new Habilidad("Ataque Basico", 10);
habilidades.add(basico);
} else if (nivel == 3) {
} else if (Mago.getNivel() == 3) {
Habilidad habilidad = new Habilidad("habilidad1", 20);
habilidades.add(habilidad);
} else if (nivel == 4){
} else if (Mago.getNivel() == 4){
habilidades.add(new Habilidad("habilidad2", 30));
} else if (nivel == 5){
} else if (Mago.getNivel() == 5){
habilidades.add(new Habilidad("habilidad3", 40));}
}
......
......@@ -41,6 +41,10 @@ public class Usuario implements Personaje {
return nombre;
}
public static int getNivel() {
return nivel;
}
public ArrayList<Objeto> getObjeto() {
return objeto;
}
......@@ -101,6 +105,7 @@ public class Usuario implements Personaje {
@Override
public void agregarHabilidad() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment