Add shortbow

This commit is contained in:
Emma Nora Theuer 2024-09-08 14:34:10 +02:00
parent 24ba1f71b1
commit 3cca8b4fad

View file

@ -47,3 +47,37 @@ class Longbow extends Bow {
}
}
}
class Shortbow extends Bow {
public Shortbow(int strength, int dex) {
requirements = new HashMap<>();
requirements.put("Dex", 8);
requirements.put("Str", 6);
infoDamageBonus = "0";
playerStrength = strength;
playerDex = dex;
name = "Shortbow";
rarity = "Common";
range = getRange();
hitBonus = getHitBonus();
damageBonus = getDamageBonus();
}
@Override
public int getDamageBonus() {
if (playerDex < requirements.get("Dex") || playerStrength < requirements.get("Str")) {
return -20;
} else {
return 0;
}
}
public int rollDamage(int bonus){
int dieResult = dice.rollD6();
if (dieResult + bonus < 0) {
return 0;
} else {
return dieResult;
}
}
}