diff options
author | Nao Pross <naopross@thearcway.org> | 2018-11-19 13:11:43 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-11-19 13:11:43 +0100 |
commit | 2c176589c24093ae93ec45e8d208dce81c27a515 (patch) | |
tree | eba17e826ed3e159c03b2b4ccc269c1bae131693 /src/Weapon.java | |
parent | Set up CardLayout for GameWindow and Scene pause/resume (diff) | |
download | Subconscious-java-2c176589c24093ae93ec45e8d208dce81c27a515.tar.gz Subconscious-java-2c176589c24093ae93ec45e8d208dce81c27a515.zip |
Create java package for the project
Diffstat (limited to 'src/Weapon.java')
-rw-r--r-- | src/Weapon.java | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/Weapon.java b/src/Weapon.java deleted file mode 100644 index f20e0ca..0000000 --- a/src/Weapon.java +++ /dev/null @@ -1,44 +0,0 @@ -// 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 String name; - - // TODO: add bonus / power-ups structure - // public class PowerUps {} - - public Weapon(String name, int damage, int range, int durability) { - this.name = name; - this.damage = damage; - this.range = range; - this.durability = durability; - } - - /* accessors */ - public String getName() { return this.name; } - public int getDamage() { return this.damage; } - public int getRange() { return this.range; } - public int getDurability() { return this.durability; } - - - public boolean isBroken() { - return this.durability <= 0; - } - - public boolean damage(Actor attacker, Actor attacked, Map map) { - if (isBroken()) { - return false; - } - - if (map.getTile(attacked.getX(), attacked.getY()).isSelected()) { - attacked.damage(this.damage); - this.durability--; - return true; - } else { - return false; - } - } - -} |