-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCarta.java
More file actions
52 lines (44 loc) · 1.24 KB
/
Copy pathCarta.java
File metadata and controls
52 lines (44 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package risk;
/**
*
* @author landr
*/
public abstract class Carta {
Pais pais;
Jugador jugador;
String tipo;
Carta(Pais pais, String tipo, Jugador jugador){
this.pais = pais;
this.tipo = tipo;
this.jugador = jugador;
}
abstract int obtenerRearme();
public String obtenerNombre(){
return new String(tipo + "&" + pais.getAbreviatura());
}
public String getTipo(){
return tipo;
}
public Pais getPais(){
return pais;
}
@Override
public String toString()
{
String out = new String();
out = "{\n";
out = out + "tipoCarta: \"" + tipo + "\"\n";
out = out + "paisAsociado: \"" + pais.getNombre() + "\"\n";
out = out + "perteneceAJugador: \"" + jugador.getNombre() + "\"\n";
if(jugador.getPaises().contains(pais))
out = out + "ejercitosDeRearme: " + (obtenerRearme()+1) + "\n}";
else
out = out + "ejercitosDeRearme: " + obtenerRearme() + "\n}";
return out;
}
}