-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChest.java
More file actions
36 lines (32 loc) · 758 Bytes
/
Chest.java
File metadata and controls
36 lines (32 loc) · 758 Bytes
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
public class Chest
{
private char item; // the item
private int amount; // the amount you increase by
public Chest()
{
int rand = (int)(Math.random()*3); // only 3 possible items in chests
if (rand == 0) // health
{
item = 'H';
amount = (int)(Math.random()*10+5);
}
else if (rand == 1) // armor
{
item = 'A';
amount = (int)(Math.random()*10+5);
}
else // sword
{
item = 'S';
amount = (int)(Math.random()*10+5);
}
}
public char getItem() // gets the Item
{
return item;
}
public int getAmount() // gets the Amount
{
return amount;
}
}