-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStats.java
48 lines (44 loc) · 1.01 KB
/
Stats.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
/**
* Created with IntelliJ IDEA.
* User: greg
* Date: 05/09/13
* Time: 22:08
* To change this template use File | Settings | File Templates.
*/
public class Stats {
private int money;
public Stats() {
// read in from however the fuck you save games
money = 0;
}
/**
* return the amount of money the player has
* @return
*/
public int getMoney() {
return money;
}
/**
* increment the player's money bank by the value of the money item object
* @param money
* @return
*/
public int gainMoney(Money money) {
this.money += money.getValue();
money.markForRemoval();
return getMoney();
}
/**
* decrement the player's monetary value (buying shit or something)
*
* @param loss
* @return the new value or money
*/
public int loseMoney(int loss) {
this.money -= loss;
if (this.money < 0) {
this.money = 0;
}
return getMoney();
}
}