-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
95 lines (79 loc) · 2.04 KB
/
Player.java
File metadata and controls
95 lines (79 loc) · 2.04 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
85
86
87
88
89
90
91
92
93
94
95
package mockTextGameProject;
import java.util.ArrayList;
public class Player extends Character
{
private ArrayList <Collectible> itemPouch = new ArrayList<Collectible>();
private ArrayList <String> roomsVisited = new ArrayList<String>();
public Player()
{
super.setName("Jay");
super.setCurrentHealth(100);
super.setMaxHealthPoints(100);
super.setAttackValue(5);
}
public Player(String name)
{
super.setName(name);
super.setCurrentHealth(100);
super.setMaxHealthPoints(100);
super.setAttackValue(5);
}
/*
* Method - addItemToBag
* Purpose - adds Collectible to the itemPouch ArrayList
* @Param Collectible aCollectibleItem
*/
public void addItemToBag(Collectible aCollectableItem)
{
itemPouch.add(aCollectableItem);
}
/**
* @return the itemPouch
*/
public ArrayList<Collectible> getItemPouch()
{
return itemPouch;
}
/**
* @param itemPouch the itemPouch to set
*/
public void setItemPouch(ArrayList<Collectible> itemPouch)
{
this.itemPouch = itemPouch;
}
/**
* @return the roomsVisited
*/
public ArrayList<String> getRoomsVisited()
{
return roomsVisited;
}
/**
* @param roomsVisited the roomsVisited to set
*/
public void setRoomsVisited(ArrayList<String> roomsVisited)
{
this.roomsVisited = roomsVisited;
}
/*
* Method - addItemsToPouch
* @param collectible
* Return - Void
* Recieves items and adds them to the player's inventory.
*/
public void addItemsToPouch(Collectible collectible)
{
this.itemPouch.add(collectible);
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{
return "Player [itemPouch=" + itemPouch + ", roomsVisited=" + roomsVisited + ", getCurrentRoom()="
+ getCurrentRoom() + ", getCurrentHealth()=" + getCurrentHealth() + ", getAttackValue()="
+ getAttackValue() + ", getMaxHealthPoints()=" + getMaxHealthPoints() + ", getName()=" + getName() + ", isAlive()=" + isAlive() + ", getClass()=" + getClass() + ", hashCode()=" + hashCode()
+ ", toString()=" + super.toString() + "]";
}
}