-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathArma.java
53 lines (50 loc) · 1.07 KB
/
Arma.java
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
53
import java.util.*;
public class Arma extends Item
{
private String nome;
private int dano;
/**
* @param nome tipo de arma
*/
public Arma(String nome){
this.nome = nome;
if(nome.equals("faca")){
this.dano = 1;
}else{
if(nome.equals("espada")){
this.dano = 2;
}
else{
if(nome.equals("cimitarra")){
this.dano = 3;
}
}
}
}
public static Arma Arma(){
int numero = (int) (Math.random()*3);
String n = "";
switch (numero) {
case 0:
n = "faca";
break;
case 1:
n = "espada";
break;
case 2:
n = "cimitarra";
break;
}
return new Arma(n);
}
public int getDano(){
return dano;
}
/**
* retorna o nome da arma. O nome funciona como tipo da arma.
* @return valor do nome
*/
public String getNome(){
return nome;
}
}