Clement Colmerauer commited on 2024-12-13 09:53:52
Showing 11 changed files, with 8 additions and 3 deletions.
| ... | ... |
@@ -26,13 +26,13 @@ public class Manager {
|
| 26 | 26 |
break; |
| 27 | 27 |
case DWARF : |
| 28 | 28 |
player.heal(1); |
| 29 |
- if(player.inventory.contains("Holy Elixir")) {
|
|
| 29 |
+ if(player.getInventory().contains("Holy Elixir")) {
|
|
| 30 | 30 |
player.heal(1); |
| 31 | 31 |
} |
| 32 | 32 |
break; |
| 33 | 33 |
case ARCHER : |
| 34 | 34 |
player.heal(1); |
| 35 |
- if(player.inventory.contains("Magic Bow")) {
|
|
| 35 |
+ if(player.getInventory().contains("Magic Bow")) {
|
|
| 36 | 36 |
int potentialHeal = player.getCurrentHealthPoints()/8-1; |
| 37 | 37 |
player.heal(potentialHeal < 0 ? 0 : potentialHeal); |
| 38 | 38 |
} |
| ... | ... |
@@ -30,7 +30,7 @@ public class Player {
|
| 30 | 30 |
private Natural xp; |
| 31 | 31 |
|
| 32 | 32 |
private HashMap<Ability, Integer> abilities; //Ability = stat |
| 33 |
- public ArrayList<String> inventory; |
|
| 33 |
+ private ArrayList<String> inventory; |
|
| 34 | 34 |
|
| 35 | 35 |
public Player(String playerName, String avatar_name, Jobs avatarClass, int money, ArrayList<String> inventory) {
|
| 36 | 36 |
this(playerName,avatar_name,avatarClass,money,inventory,Player.defaultMaxHp.toInt()); |
| ... | ... |
@@ -99,6 +99,11 @@ public class Player {
|
| 99 | 99 |
return copy; |
| 100 | 100 |
} |
| 101 | 101 |
|
| 102 |
+ public ArrayList<String> getInventory() |
|
| 103 |
+ {
|
|
| 104 |
+ return new ArrayList<String>(this.inventory); |
|
| 105 |
+ } |
|
| 106 |
+ |
|
| 102 | 107 |
public void heal(int hp) |
| 103 | 108 |
{
|
| 104 | 109 |
if(hp < 0 ) |
| 105 | 110 |