-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInventory.java
More file actions
107 lines (78 loc) · 2.71 KB
/
Inventory.java
File metadata and controls
107 lines (78 loc) · 2.71 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
import java.util.ArrayList;
public class Inventory extends Main {
boolean savedVillager = false;
static ArrayList<String> playerInv = new ArrayList<String>();
public static void printInventory() {
System.out.println("Inventory:" + playerInv);
}
public void addItem(String item) {
playerInv.add(item);
}
public void useItem(String item) {
// CREATE BOAT
if (item == "Stick1" || item == "Stick2" || item == "Stick3" || item == "Stick4" || item == "Rope") {
if (playerInv.contains(Items.itemsList.get(5)) && playerInv.contains(Items.itemsList.get(6)) && playerInv.contains(Items.itemsList.get(7)) && playerInv.contains(Items.itemsList.get(8)) && playerInv.contains(Items.itemsList.get(4))) {
playerInv.remove("Stick1");
playerInv.remove("Stick2");
playerInv.remove("Stick3");
playerInv.remove("Stick4");
playerInv.remove("Rope");
playerInv.add("Boat");
}
}
// BOAT ENDING
if (item == "Boat") {
if (Navigation.currentLocation == "Beach") {
if(playerInv.contains(Items.itemsList.get(11))) {
Ending.BeachEnding();
}
}
// COLLECT WATER
if (item == "Bucket") {
if (Navigation.currentLocation == "River") {
if (playerInv.contains(Items.itemsList.get(0))) {
playerInv.remove("Bucket");
playerInv.add("Bucket of Water");
}
}
}
// GIVE VILLAGER TO VILLAGE
if (item == "Lost Villager") {
if (Navigation.currentLocation == "Village") {
if (playerInv.contains(Items.itemsList.get(13))) {
playerInv.remove("Lost Villager");
playerInv.add("Seeds");
playerInv.add("Garden Tools");
savedVillager = true;
}
}
}
// USE TOOLS AND SEEDS TO GROW FRUIT
if (item == "Seeds" || item == "Garden Tools") {
if (Navigation.currentLocation == "Village") {
if (playerInv.contains(Items.itemsList.get(3)) && playerInv.contains(Items.itemsList.get(9)) && playerInv.contains(Items.itemsList.get(12))) {
playerInv.remove("Bucket of Water");
playerInv.remove("Seeds");
playerInv.add("Bucket");
playerInv.add("Fruit");
}
}
}
// PLANE ENDING
if (item == "Wires & Metal" || item == "Flare Gun") {
if (Navigation.currentLocation == "Plane Crash") {
if (playerInv.contains(Items.itemsList.get(1)) && playerInv.contains(Items.itemsList.get(10))) {
Ending.CrashSiteEnding();
}
}
}
if (item == "Fruit" || savedVillager == true) {
if (Navigation.currentLocation == "Plane Crash") {
if (playerInv.contains(Items.itemsList.get(2))) {
Ending.VillageEnding();
}
}
}
}
}
}