-
Notifications
You must be signed in to change notification settings - Fork 0
/
MaxRevive.java
82 lines (73 loc) · 1.59 KB
/
MaxRevive.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
82
package Maestus.Porkyman;
/**
* Revival item for player to give to pockymon
* Currently not in use because of PockymonBattle system architecture
* @author Oracle
*
*/
public class MaxRevive implements IItem {
/**
* Total amount owned by player
*/
private int quantity;
/**
* Constructs a bag of this item
* Default quantity is 1
*/
public MaxRevive() {
super();
quantity = 1;
}
/**
* Specifies how to execute item usage
* Revives a single dead pockymon
* Declines usage if target pockymon is alive
*/
@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 Max Revive!");
return false;
}
if (caster.checkAlive()) {
System.out.println(caster.getNickname() + " doesn't need this right now.");
return false;
} else {
caster.modHP(999); // HP.MAX if it was enumerated but this is fine too
quantity--;
System.out.println(caster.getNickname() + " is revived to max health!");
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 "Max Revive";
}
}