Add shortbow
This commit is contained in:
parent
24ba1f71b1
commit
3cca8b4fad
1 changed files with 34 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue