-
Notifications
You must be signed in to change notification settings - Fork 0
/
Item.java
56 lines (47 loc) · 1.12 KB
/
Item.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
49
50
51
52
53
54
55
56
package sample;
import javafx.scene.control.TextArea;
/**
* Created by Sonia on 10/6/2015.
*/
public class Item
{
String itemName;
protected int healthBonus;
protected int strengthBonus;
public Item()
{
itemName="";
healthBonus=0;
strengthBonus=0;
}
public Item(String itemName,int healthBonus, int strengthBonus)
{
this.itemName = itemName;
this.healthBonus = healthBonus;
this.strengthBonus = strengthBonus;
}
public void use(TextArea outScreen, Monster mons)
{
mons.setHealth(healthBonus);
mons.setStrength(strengthBonus);
outScreen.appendText(mons.name + "'s health is now " +mons.getHealth()+"\n");
outScreen.appendText(mons.name + "'s strength is now "+ mons.getStrength()+"\n\n");
mons.charItem.remove(this);
}
public int getHealthBonus()
{
return healthBonus;
}
public int getStrengthBonus()
{
return strengthBonus;
}
public String getItemName()
{
return itemName;
}
public String toString()
{
return itemName;
}
}