Compare commits

..

No commits in common. "0f6d7eac0fb99d3b6d1cc64838693857ab6822c7" and "3cca8b4fad362963c7fddd775b3494847e33de3b" have entirely different histories.

2 changed files with 19 additions and 166 deletions

View file

@ -26,9 +26,9 @@ interface Weapon {
abstract class Sword implements Weapon { abstract class Sword implements Weapon {
Map<String, Integer> requirements; Map<String, Integer> requirements;
String infoDamageDice;
String infoDamageBonus; String infoDamageBonus;
int playerStrength; int playerStrength;
int playerDex;
String type = "Melee"; String type = "Melee";
String name; String name;
String rarity; String rarity;
@ -61,7 +61,6 @@ abstract class Sword implements Weapon {
abstract class Bow implements Weapon { abstract class Bow implements Weapon {
Map<String, Integer> requirements; Map<String, Integer> requirements;
String infoDamageDice;
String infoDamageBonus; String infoDamageBonus;
int playerStrength; int playerStrength;
int playerDex; int playerDex;

View file

@ -7,7 +7,6 @@ class Longbow extends Bow {
requirements.put("Str", 8); requirements.put("Str", 8);
playerStrength = strength; playerStrength = strength;
playerDex = dex; playerDex = dex;
infoDamageDice = "1d8";
infoDamageBonus = "0-2"; infoDamageBonus = "0-2";
name = "Longbow"; name = "Longbow";
rarity = "Common"; rarity = "Common";
@ -18,9 +17,10 @@ class Longbow extends Bow {
@Override @Override
public int getDamageBonus(int distance) { public int getDamageBonus(int distance) {
if (playerDex < requirements.get("Dex") || playerStrength < requirements.get("Str") || distance > range) { if (playerDex < requirements.get("Dex") || playerStrength < requirements.get("Str")) {
return -20; return -20;
} }
if (distance > 20 && distance <= 165) { if (distance > 20 && distance <= 165) {
return 2; return 2;
} }
@ -33,120 +33,8 @@ class Longbow extends Bow {
} }
@Override @Override
public int rollDamage(int bonus) { public int rollToHit(int bonus) {
int dieResult = dice.rollD8(); return dice.rollD20();
if (dieResult + bonus < 0) {
return 0;
} else {
return dieResult + bonus;
}
}
}
class Shortbow extends Bow {
public Shortbow(int strength, int dex) {
requirements = new HashMap<>();
requirements.put("Dex", 8);
requirements.put("Str", 6);
infoDamageDice = "1d6";
infoDamageBonus = "0";
playerStrength = strength;
playerDex = dex;
name = "Shortbow";
rarity = "Common";
range = getRange();
hitBonus = getHitBonus();
damageBonus = getDamageBonus();
}
@Override
public int getDamageBonus(int distance) {
if (playerDex < requirements.get("Dex") || playerStrength < requirements.get("Str") || distance > range) {
return -20;
} else {
return 0;
}
}
@Override
public int rollDamage(int bonus){
int dieResult = dice.rollD6();
if (dieResult + bonus < 0) {
return 0;
} else {
return dieResult;
}
}
}
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 @Override
@ -160,70 +48,36 @@ class StraightSword extends Sword {
} }
} }
class ShortSword extends Sword { class Shortbow extends Bow {
public ShortSword(int strength) { public Shortbow(int strength, int dex) {
requirements = new HashMap<>(); requirements = new HashMap<>();
requirements.put("Str", 8); requirements.put("Dex", 8);
infoDamageDice = "1d8"; requirements.put("Str", 6);
infoDamageBonus = "-1 - 2"; infoDamageBonus = "0";
playerStrength = strength; playerStrength = strength;
name = "Short Sword"; playerDex = dex;
name = "Shortbow";
rarity = "Common"; rarity = "Common";
range = getRange(); range = getRange();
hitBonus = getHitBonus(); hitBonus = getHitBonus();
damageBonus = getHitBonus(); damageBonus = getDamageBonus();
} }
@Override @Override
public int getDamageBonus() { public int getDamageBonus() {
if (requirements.get("Str") > playerStrength) { if (playerDex < requirements.get("Dex") || playerStrength < requirements.get("Str")) {
return -20; return -20;
} else { } else {
return dice.rollD4() -2; return 0;
} }
} }
@Override
public int rollDamage(int bonus){ public int rollDamage(int bonus){
int dieResult = dice.rollD8(); int dieResult = dice.rollD6();
if (dieResult + bonus < 0) { if (dieResult + bonus < 0) {
return 0; return 0;
} else { } else {
return dieResult + bonus; return dieResult;
}
}
}
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;
} }
} }
} }