-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPotion.java
51 lines (41 loc) · 1.35 KB
/
Potion.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
import java.util.HashMap;
import java.util.Map;
public class Potion extends Product{
private int effect_amount;
Map func = new HashMap();
// to initialize a potion;
public void initialize(String n, double p, int l, int e, boolean hp, boolean mp, boolean stg, boolean dex, boolean agi) {
super.initialize(n, p, l);
setEffect_amount(e);
func.put("HP", hp);
func.put("MP", mp);
func.put("Strength", stg);
func.put("Dexterity", dex);
func.put("Agility", agi);
}
// to set the effect amount;
public void setEffect_amount(int e) {
effect_amount = e;
}
// to return the effect amount;
public int getEffect_amount(){ return effect_amount;}
// to return the map;
public boolean getMap(String s){
return (boolean)func.get(s);
}
@Override
// to print the title of the basic information of potions;
public void print_title() {
System.out.println("Name\tPrice\tRequired Level\tAttribute Increase\tAttribute Affected");
}
@Override
// to print the basic info of potions;
public void print_info(){
System.out.println(getName() + "\t" + getPrice() + "\t" + getLevel() + "\t" + effect_amount);
}
@Override
// to return the type ---- potion;
public String get_type(){
return "Potion";
}
}