-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
61 lines (51 loc) · 1.52 KB
/
Copy pathPlayer.java
File metadata and controls
61 lines (51 loc) · 1.52 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
53
54
55
56
57
58
59
60
61
public class Player extends Character{
public static String Ação(){
String opção = "";
System.out.println("O que deseja fazer?");
System.out.println("a) Atacar");
System.out.println("b) Defender");
System.out.println("c) Feitiço");
return Main.in.nextLine();
}
int feitiçoCooldown = 0;
public Player(String nome, int vida, int ataque, int defesa){
super(nome, vida, ataque, defesa);
}
public void Atacar(Character adversario){
// Comportamento apenas do Player
if (adversario instanceof Boss)
{
if (((Boss) adversario).getIsProtected())
{
((Boss) adversario).setIsProtected(false);
}
else
{
super.Atacar(adversario);
}
}
else
{
super.Atacar(adversario);
}
}
public boolean Feitiço(Character adversario)
{
if (feitiçoCooldown > 0)
{
System.out.println("Feitiço ainda em cooldown.");
return false;
}
else
{
System.out.println(nome + " ataca " + adversario.nome + " com Feitiço, ficando com " + adversario.vida + " pontos de vida.");
adversario.setVida(adversario.vida - this.ataque * 3);
feitiçoCooldown = 2;
return true;
}
}
public void Refresh(){
this.defesaAtual = this.defesa;
if (feitiçoCooldown > 0) feitiçoCooldown--;
}
}