Compare commits
2 commits
3cca8b4fad
...
0f6d7eac0f
Author | SHA1 | Date | |
---|---|---|---|
|
0f6d7eac0f | ||
|
ad2c9fd150 |
2 changed files with 158 additions and 11 deletions
|
@ -26,9 +26,9 @@ interface Weapon {
|
|||
|
||||
abstract class Sword implements Weapon {
|
||||
Map<String, Integer> requirements;
|
||||
String infoDamageDice;
|
||||
String infoDamageBonus;
|
||||
int playerStrength;
|
||||
int playerDex;
|
||||
String type = "Melee";
|
||||
String name;
|
||||
String rarity;
|
||||
|
@ -61,6 +61,7 @@ abstract class Sword implements Weapon {
|
|||
|
||||
abstract class Bow implements Weapon {
|
||||
Map<String, Integer> requirements;
|
||||
String infoDamageDice;
|
||||
String infoDamageBonus;
|
||||
int playerStrength;
|
||||
int playerDex;
|
||||
|
|
|
@ -7,6 +7,7 @@ class Longbow extends Bow {
|
|||
requirements.put("Str", 8);
|
||||
playerStrength = strength;
|
||||
playerDex = dex;
|
||||
infoDamageDice = "1d8";
|
||||
infoDamageBonus = "0-2";
|
||||
name = "Longbow";
|
||||
rarity = "Common";
|
||||
|
@ -17,10 +18,9 @@ class Longbow extends Bow {
|
|||
|
||||
@Override
|
||||
public int getDamageBonus(int distance) {
|
||||
if (playerDex < requirements.get("Dex") || playerStrength < requirements.get("Str")) {
|
||||
if (playerDex < requirements.get("Dex") || playerStrength < requirements.get("Str") || distance > range) {
|
||||
return -20;
|
||||
}
|
||||
|
||||
if (distance > 20 && distance <= 165) {
|
||||
return 2;
|
||||
}
|
||||
|
@ -32,14 +32,9 @@ class Longbow extends Bow {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rollToHit(int bonus) {
|
||||
return dice.rollD20();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rollDamage(int bonus) {
|
||||
int dieResult = dice.rollD10();
|
||||
int dieResult = dice.rollD8();
|
||||
if (dieResult + bonus < 0) {
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -53,6 +48,7 @@ class Shortbow extends Bow {
|
|||
requirements = new HashMap<>();
|
||||
requirements.put("Dex", 8);
|
||||
requirements.put("Str", 6);
|
||||
infoDamageDice = "1d6";
|
||||
infoDamageBonus = "0";
|
||||
playerStrength = strength;
|
||||
playerDex = dex;
|
||||
|
@ -63,8 +59,8 @@ class Shortbow extends Bow {
|
|||
damageBonus = getDamageBonus();
|
||||
}
|
||||
@Override
|
||||
public int getDamageBonus() {
|
||||
if (playerDex < requirements.get("Dex") || playerStrength < requirements.get("Str")) {
|
||||
public int getDamageBonus(int distance) {
|
||||
if (playerDex < requirements.get("Dex") || playerStrength < requirements.get("Str") || distance > range) {
|
||||
return -20;
|
||||
} else {
|
||||
return 0;
|
||||
|
@ -72,6 +68,7 @@ class Shortbow extends Bow {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rollDamage(int bonus){
|
||||
int dieResult = dice.rollD6();
|
||||
if (dieResult + bonus < 0) {
|
||||
|
@ -81,3 +78,152 @@ class Shortbow extends Bow {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
class BowOfTheEnchantedOak extends Bow {
|
||||
public BowOfTheEnchantedOak(int distance, int strength, int dex) {
|
||||
requirements = new HashMap<>();
|
||||
requirements.put("Dex", 25);
|
||||
requirements.put("Str", 12);
|
||||
playerStrength = strength;
|
||||
playerDex = dex;
|
||||
infoDamageDice = "2d8";
|
||||
infoDamageBonus = "0-4";
|
||||
name = "Bow of the Enchanted Oak";
|
||||
rarity = "Rare";
|
||||
range = getRange(650);
|
||||
hitBonus = getHitBonus();
|
||||
damageBonus = getDamageBonus(distance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamageBonus(int distance) {
|
||||
if (playerDex < requirements.get("Dex") || playerStrength < requirements.get("Str") || distance > range) {
|
||||
return -20;
|
||||
}
|
||||
|
||||
if (distance > 20 && distance <= 200) {
|
||||
return 4;
|
||||
}
|
||||
else if (distance > 200 && distance <= 400) {
|
||||
return 2;
|
||||
}
|
||||
else if (distance > 400 && distance <= 500){
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rollDamage(int bonus) {
|
||||
int dieResult = dice.rollD8() + dice.rollD8();
|
||||
if (dieResult + bonus < 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return dieResult + bonus;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class StraightSword extends Sword {
|
||||
public StraightSword(int strength) {
|
||||
requirements = new HashMap<>();
|
||||
requirements.put("Str", 12);
|
||||
playerStrength = strength;
|
||||
infoDamageDice = "1d10";
|
||||
infoDamageBonus = "1-4";
|
||||
name = "Straight Sword";
|
||||
rarity = "Common";
|
||||
range = getRange();
|
||||
hitBonus = getHitBonus();
|
||||
damageBonus = getHitBonus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamageBonus() {
|
||||
if (requirements.get("Str") > playerStrength) {
|
||||
return -20;
|
||||
} else {
|
||||
return dice.rollD4();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rollDamage(int bonus) {
|
||||
int dieResult = dice.rollD10();
|
||||
if (dieResult + bonus < 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return dieResult + bonus;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ShortSword extends Sword {
|
||||
public ShortSword(int strength) {
|
||||
requirements = new HashMap<>();
|
||||
requirements.put("Str", 8);
|
||||
infoDamageDice = "1d8";
|
||||
infoDamageBonus = "-1 - 2";
|
||||
playerStrength = strength;
|
||||
name = "Short Sword";
|
||||
rarity = "Common";
|
||||
range = getRange();
|
||||
hitBonus = getHitBonus();
|
||||
damageBonus = getHitBonus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamageBonus() {
|
||||
if (requirements.get("Str") > playerStrength) {
|
||||
return -20;
|
||||
} else {
|
||||
return dice.rollD4() -2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rollDamage(int bonus) {
|
||||
int dieResult = dice.rollD8();
|
||||
if (dieResult + bonus < 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return dieResult + bonus;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class PrideOfTheGiantForges extends Sword {
|
||||
public PrideOfTheGiantForges(int strength) {
|
||||
requirements = new HashMap<>();
|
||||
requirements.put("Str", 25);
|
||||
playerStrength = strength;
|
||||
infoDamageDice = "2d10";
|
||||
infoDamageBonus = "3-6";
|
||||
name = "Pride of the Giant's forges";
|
||||
rarity = "Rare";
|
||||
range = getRange();
|
||||
hitBonus = getHitBonus();
|
||||
damageBonus = getHitBonus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamageBonus() {
|
||||
if (requirements.get("Str") > playerStrength) {
|
||||
return -25;
|
||||
} else {
|
||||
return dice.rollD4() + 2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rollDamage(int bonus) {
|
||||
int dieResult = dice.rollD10() + dice.rollD10();
|
||||
if (dieResult + bonus < 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return dieResult + bonus;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue