-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWeapon.java
50 lines (46 loc) · 1.07 KB
/
Weapon.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
public abstract class Weapon {
private int reloadTime;
int reloadProgress;
private double ammo;
boolean isTurret;
SpaceObj owner;
private double velocity;
private int ttl;
int damage;
private double mass;
boolean friendlyFire;
abstract Projectile generate();
public double range() {
return velocity * ttl;
}
public int setReloadTime(int t) {
return reloadTime = t > 0 ? t : 1;
}
public int getReloadTime() {
return reloadTime;
}
public double setAmmo(double a) {
return ammo = a >= 0 ? a : 0;
}
public double getAmmo() {
return ammo;
}
public double setVelocity(double v) {
return velocity = v >= 0 ? v : 0;
}
public double getVelocity() {
return velocity;
}
public int setTTL(int t) {
return ttl = t > 0 ? t : 1;
}
public int getTTL() {
return ttl;
}
public double setMass(double m) {
return mass = m > 0 ? m : 0.000000001;
}
public double getMass() {
return mass;
}
}