-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShip.java
More file actions
109 lines (87 loc) · 2.37 KB
/
Ship.java
File metadata and controls
109 lines (87 loc) · 2.37 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
package primary;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List;
public class Ship {
private int hp;
private int maxHp;
private int cargo;
private int attack;
private int fuelCapacity;
private int fuel;
private String name;
private List<Item> items;
private int upgradeSlots;
private List<CharacterUpgrade> upgrades;
public Ship(String name, int cargo,
int upgradeSlots, int hp,
int attack, int fuelCapacity, FileInputStream image) {
this.name = name;
this.cargo = cargo;
this.attack = attack;
this.fuelCapacity = fuelCapacity;
this.fuel = fuelCapacity;
this.hp = hp;
this.maxHp = hp;
this.upgradeSlots = upgradeSlots;
this.items = new ArrayList<Item>();
this.upgrades = new ArrayList<CharacterUpgrade>();
}
public Ship(String name, int cargo, int upgradeSlots, int hp, int attack, int fuelCapacity) {
this.name = name;
this.cargo = cargo;
this.attack = attack;
this.fuelCapacity = fuelCapacity;
this.fuel = fuelCapacity;
this.hp = hp;
this.maxHp = hp;
this.upgradeSlots = upgradeSlots;
this.items = new ArrayList<Item>();
this.upgrades = new ArrayList<CharacterUpgrade>();
}
public Ship(String name, int cargo, int upgradeSlots, FileInputStream image) {
this(name, cargo, upgradeSlots, 10, 10, 3000, image);
}
public String getName() {
return name;
}
public int getAttack() {
return attack;
}
public int getCargo() {
return cargo;
}
public int getHp() {
return hp;
}
public void setHp(int hp) {
this.hp = hp;
}
public int getFuelCapacity() {
return fuelCapacity;
}
public int getFuel() {
return fuel;
}
public void setFuel(int fuel) {
this.fuel = fuel;
}
public List<Item> getItems() {
return items;
}
public void setItems(List<Item> items) {
this.items = items;
}
public void addItem(Item item) {
this.items.add(item);
}
public int getMaxHp() {
return maxHp;
}
public int getUpgradeSlots() {
return upgradeSlots;
}
public List<CharacterUpgrade> getUpgrades() {
return upgrades;
}
}