-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInventory.java
More file actions
121 lines (115 loc) · 2.54 KB
/
Inventory.java
File metadata and controls
121 lines (115 loc) · 2.54 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import java.util.Scanner;
public class Inventory implements ObjetcInGame{
protected Equipement ed;
public Inventory() {
}
public void addInventory(Object a) {
all.add(a);
}
public void addEquipement(Equipement a) {
equip.add(a);
}
public boolean ShowInventory() {
boolean ap = false;
Scanner sc = new Scanner(System.in);
if (all.isEmpty() == true) {
System.out.println("Inventaire vide !");
}
else {
System.out.println(" Quel objet voulez-vous utiliser ou equiper ?");
for (int i = 0 ; i < all.size() ; i++) {
System.out.println(i+" "+all.get(i)+"\n");
}
int pp = sc.nextInt();
if(all.get(pp) instanceof Item) {
ap = true;
}
else
ap = false;
UseInventory(pp);
}
return ap;
}
public boolean ShowEquipement() {
boolean ap = false;
Scanner sc = new Scanner(System.in);
int pp = 0;
if (equip.isEmpty() == true) {
System.out.println("Inventaire vide !");
}
else {
System.out.println(" Que voulez-vous equiper ?");
for (int i = 0 ; i < equip.size() ; i++) {
System.out.println(i+" "+equip.get(i)+"\n");
}
pp = sc.nextInt();
}
if(equip.get(pp) instanceof Armor) {
ap = true;
}
equip.remove(pp);
return ap;
}
public int ShowGear() {
Scanner sc = new Scanner(System.in);
int pp = 0;
if (gear.isEmpty() == true) {
System.out.println("Inventaire vide !");
}
else {
System.out.println(" Que voulez-vous equiper ?");
for (int i = 0 ; i < gear.size() ; i++) {
System.out.println(i+" "+gear.get(i)+"\n");
}
pp = sc.nextInt();
UseEquipement(pp);
}
return pp;
}
public void UseInventory(int a) {
all.remove(a);
}
public void UseEquipement(int a) {
//gear.add(equip.get(a));
equip.remove(a);
}
public int CancelInventory() {
Scanner sc = new Scanner(System.in);
int ap = 0;
System.out.println(" Quel objet voulez-vous deposer ?");
for (int i = 0 ; i < all.size() ; i++) {
System.out.println(i+" "+all.get(i)+"\n");
}
int pp = sc.nextInt();
if(all.get(pp) instanceof Equipement) {
ap = 0;
}
UseInventory(pp);
return ap;
}
public boolean Check() {
boolean g;
if (all.isEmpty() == true) {
g = true;
}
else
g = false;
return g;
}
public int CancelEquipement() {
Scanner sc = new Scanner(System.in);
int ap = 0;
System.out.println(" Quel objet voulez-vous deposer ?");
for (int i = 0 ; i < equip.size() ; i++) {
System.out.println(i+" "+equip.get(i)+"\n");
}
int pp = sc.nextInt();
if (equip.get(pp) instanceof Armor ) {
ap = 1;
}
else
ap = 2;
UseEquipement(pp);
return ap;
}
}