diff options
Diffstat (limited to '')
-rw-r--r-- | src/subconscious/Weapon.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/subconscious/Weapon.java b/src/subconscious/Weapon.java index 8533b9f..3295cb8 100644 --- a/src/subconscious/Weapon.java +++ b/src/subconscious/Weapon.java @@ -1,20 +1,24 @@ package subconscious; -// TODO: there are object such as "puch" that need infinite durability public class Weapon { - // TODO: if possible make final - private int damage; - private int durability; - private int range; + + private final boolean unbreakable; + private final int damage; + private final int range; + private String name; + private int durability; // TODO: add bonus / power-ups structure // public class PowerUps {} + // TODO: As a temporary workaround negative durability on the constructor + // makes the weapon unbreakable public Weapon(String name, int damage, int range, int durability) { this.name = name; this.damage = damage; this.range = range; + this.unbreakable = (durability < 0); this.durability = durability; } @@ -24,8 +28,10 @@ public class Weapon { public int getRange() { return this.range; } public int getDurability() { return this.durability; } - public boolean isBroken() { + if (this.unbreakable) + return false; + return this.durability <= 0; } |