-
Notifications
You must be signed in to change notification settings - Fork 0
/
HiPotion.java
81 lines (71 loc) · 1.39 KB
/
HiPotion.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
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
package Maestus.Porkyman;
/**
* Healing item for player to give to pockymon
* @author Oracle
*
*/
public class HiPotion implements IItem {
/**
* Total amount owned by player
*/
private int quantity;
/**
* Constructs a bag of this item
* Default quantity is 1
*/
public HiPotion() {
super();
quantity = 1;
}
/**
* Specifies how to execute item usage
* Strongly heals a single target
*/
@Override
public boolean doSomething(Pockymon caster, Pockymon... targets) {
if (quantity < 1) {
// Ideally shouldn't be printed unless using multiple items at once
System.out.println("You are out of Hi-Potions!");
return false;
}
// TODO: Change this to single target after finishing debug trials
for (Pockymon p : targets) {
if (quantity > 0) {
System.out.println(p + " is feeling alot better!");
p.modHP(200);
quantity--;
}
}
return true;
}
/**
* Not implemented
*/
@Override
public boolean validate(Object o) {
return yourTurn;
}
/**
* If quantity runs out, informs container to delete this item
*/
@Override
public boolean depleteItem() {
if (quantity < 1)
return true;
else return false;
}
/**
* Intended target is one pockymon on player team
*/
@Override
public Target getTarget() {
return Target.SELF;
}
/**
* Displays name of item
*/
@Override
public String toString() {
return "Hi-Potion";
}
}