-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBot.java
More file actions
71 lines (55 loc) · 1.3 KB
/
Bot.java
File metadata and controls
71 lines (55 loc) · 1.3 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
62
63
64
65
66
67
68
69
70
71
import java.util.Random;
public class Bot{
private String playStyle;
private Random randomNumber = new Random();
private Fighter bot;
private Fighter opp;
private enum Goals{
ATTACK,
HEAL,
REST,
RANDOM
}
private Goals goal;
public Bot(Fighter bot, String playStyle){
this.playStyle = playStyle.toUpperCase();
this.bot = bot;
}
public void setOpponent(Fighter opp){
this.opp = opp;
}
public void play(){
switch(playStyle){
case "RANDOM":
bot.useCard(randomNumber.nextInt(bot.getDeckSize() - 1));
break;
default:
bot.useCard(randomNumber.nextInt(bot.getDeckSize() - 1));
break;
}
}
boolean healthRisk(){
return bot.getHealth() < 20;
}
boolean highStanima(){
return bot.getStanima() > 20;
}
boolean tired(){
return bot.getStanima() < 10;
}
boolean noStanima(){
return bot.getStanima() <= 0;
}
boolean lowMana(){
return bot.getMana() < 15;
}
boolean highMana(){
return bot.getMana() > 20;
}
boolean noMana(){
return bot.getMana() <= 0;
}
boolean opponentWeak(){
return opp.getHealth() < 20;
}
}