public class Weapon { private final int RANGE; private final int DAMAGE; private final int WARMUP; private final int BURSTCOUNT; private int coolDown; public Weapon(int damage, int range, int burstcount, int warmup) { this.coolDown = 0; this.DAMAGE = damage; this.RANGE = range; this.BURSTCOUNT = burstcount; this.WARMUP = warmup; } public int getDamage() { return this.DAMAGE; } public int getBurst() { return this.BURSTCOUNT; } public int getRange() { return this.RANGE; } public boolean canShoot() { if (coolDown <= 0) { return true; } else { return false; } } public boolean shoot(Actor actor, double probability) { if (coolDown <= 0) { actor.damage((int)((this.DAMAGE*probability)*(double)this.BURSTCOUNT)); this.coolDown = this.WARMUP; return true; } else { return false; } } public void tick() { if (coolDown > 0) { coolDown--; } } }