@Test public void testGetDamage() { final int damage = weapon1.getDamage(); assertThat(damage, greaterThanOrEqualTo(MIN_HIT)); assertThat(damage, lessThanOrEqualTo(MAX_HIT)); assertEquals(MAX_HIT, weapon2.getDamage()); }
@Override public int getDamage() { int minModifier = ((WeaponProperties) properties).getMinHit(); int maxModifier = ((WeaponProperties) properties).getMaxHit(); return (int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier; }
RangedWeapon extends Weapon { @Override public int getDamage() { int minModifier = ((WeaponProperties) properties).getMinHit(); int maxModifier = ((WeaponProperties) properties).getMaxHit(); return (int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier; } }
RangedWeapon extends Weapon { @Override public int getDamage() { int minModifier = ((WeaponProperties) properties).getMinHit(); int maxModifier = ((WeaponProperties) properties).getMaxHit(); return (int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier; } RangedWeapon(RangedWeaponProperties properties, int amount); }
RangedWeapon extends Weapon { @Override public int getDamage() { int minModifier = ((WeaponProperties) properties).getMinHit(); int maxModifier = ((WeaponProperties) properties).getMaxHit(); return (int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier; } RangedWeapon(RangedWeaponProperties properties, int amount); @Override Item clone(); @Override void use(Character character); @Override int getDamage(); boolean getNeedsAmmunition(); }
RangedWeapon extends Weapon { @Override public int getDamage() { int minModifier = ((WeaponProperties) properties).getMinHit(); int maxModifier = ((WeaponProperties) properties).getMaxHit(); return (int) (Math.random() * (maxModifier - minModifier + 1)) + minModifier; } RangedWeapon(RangedWeaponProperties properties, int amount); @Override Item clone(); @Override void use(Character character); @Override int getDamage(); boolean getNeedsAmmunition();  }