-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
84 lines (66 loc) · 2.02 KB
/
Player.java
File metadata and controls
84 lines (66 loc) · 2.02 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
72
73
74
75
76
77
78
79
80
81
82
83
84
public class Player {
private String playerName = "";
private double maxHealth = 100.0;
private double health = 100.0;
private int money = 100;
private Weapons playerWeapon;
public Player(String pName, Weapons pWeapon) {
this.playerName = pName;
this.playerWeapon = new Weapons(pWeapon.getWeaponName(), pWeapon.getMoves(), pWeapon.getMovesDamage(),
pWeapon.getWeaponCost());
}
public String getName() {
return this.playerName;
}
public void setName(String newName) {
this.playerName = newName;
}
/* Helps To set a New Player Weapon */
public void setPlayerWeapon(Weapons newWeapon) {
this.playerWeapon.setWeaponName(newWeapon.getWeaponName());
this.playerWeapon.setMoves(newWeapon.getMoves());
this.playerWeapon.setMovesDamage(newWeapon.getMovesDamage());
}
/* Sets and Gets Health */
public double getHealth() {
return health;
}
public void setHealth(double newHealth) {
this.health = newHealth;
if (health > maxHealth) {
this.health = this.maxHealth;
}
}
public void addHealth(double x) {
this.health += x;
}
public void subtractHealth(double x) {
this.health -= x;
}
/* Sets and Gets Money */
public double getMoney() {
return this.money;
}
public void setMoney(int newMoney) {
this.money = newMoney;
}
public void addMoney(int x) {
this.money += x;
}
public void subtractMoney(int x) {
this.money -= x;
}
public String[] getWeaponMoveNames() {
return playerWeapon.getMoves();
}
public String getWName() {
return playerWeapon.getWeaponName();
}
public double[] getWeaponMoveDamage() {
return playerWeapon.getMovesDamage();
}
public String toString() {
return "\n" + ConsoleColors.BBL + "Player: " + ConsoleColors.BL + playerName + ConsoleColors.CB + "\nWeapon: "
+ ConsoleColors.C + playerWeapon.getWeaponName() + ConsoleColors.YB + "\nBank: " + ConsoleColors.Y + money;
}
}