v0.4.0: Refactored strength requirements, also changed how they scale

Also refactored class armor a bit so that it is upgradeable
This commit is contained in:
Evan Debenham
2016-05-11 04:54:55 -04:00
parent f724d4c2b9
commit 96c9ca6de4
17 changed files with 111 additions and 98 deletions
@@ -53,8 +53,7 @@ abstract public class Weapon extends KindOfWeapon {
private static final int HITS_TO_KNOW = 20;
private static final String TXT_TO_STRING = "%s :%d";
public int STR = 10;
public float ACU = 1; // Accuracy modifier
public float DLY = 1f; // Speed modifier
@@ -108,7 +107,7 @@ abstract public class Weapon extends KindOfWeapon {
@Override
public float acuracyFactor( Hero hero ) {
int encumbrance = STR - hero.STR();
int encumbrance = STRReq() - hero.STR();
float ACU = this.ACU;
@@ -129,7 +128,7 @@ abstract public class Weapon extends KindOfWeapon {
@Override
public float speedFactor( Hero hero ) {
int encumrance = STR - hero.STR();
int encumrance = STRReq() - hero.STR();
if (this instanceof MissileWeapon && hero.heroClass == HeroClass.HUNTRESS) {
encumrance -= 2;
}
@@ -153,7 +152,7 @@ abstract public class Weapon extends KindOfWeapon {
int damage = super.damageRoll( hero );
if (this instanceof MeleeWeapon || (this instanceof MissileWeapon && hero.heroClass == HeroClass.HUNTRESS)) {
int exStr = hero.STR() - STR;
int exStr = hero.STR() - STRReq();
if (exStr > 0) {
damage += Random.IntRange( 0, exStr );
}
@@ -161,6 +160,12 @@ abstract public class Weapon extends KindOfWeapon {
return Math.round(damage * (imbue == Imbue.LIGHT ? 0.7f : (imbue == Imbue.HEAVY ? 1.5f : 1f)));
}
public int STRReq(){
return STRReq(level());
}
public abstract int STRReq(int lvl);
public Item upgrade( boolean enchant ) {
if (enchantment != null) {
@@ -179,7 +184,7 @@ abstract public class Weapon extends KindOfWeapon {
@Override
public String toString() {
return levelKnown ? Messages.format( TXT_TO_STRING, super.toString(), STR ) : super.toString();
return levelKnown ? Messages.format( TXT_TO_STRING, super.toString(), STRReq() ) : super.toString();
}
@Override
@@ -196,8 +196,6 @@ public class MagesStaff extends MeleeWeapon {
@Override
public Item upgrade(boolean enchant) {
super.upgrade( enchant );
STR = 10;
//does not lose strength requirement
if (wand != null) {
int curCharges = wand.curCharges;
@@ -215,8 +213,6 @@ public class MagesStaff extends MeleeWeapon {
public Item degrade() {
super.degrade();
STR = 10;
if (wand != null) {
int curCharges = wand.curCharges;
wand.degrade();
@@ -37,9 +37,6 @@ public class MeleeWeapon extends Weapon {
ACU = acu;
DLY = dly;
STR = typicalSTR();
}
protected int minBase() {
@@ -65,24 +62,14 @@ public class MeleeWeapon extends Weapon {
return upgrade( false );
}
public Item upgrade( boolean enchant ) {
STR--;
return super.upgrade( enchant );
}
public Item safeUpgrade() {
return upgrade( enchantment != null );
}
@Override
public Item degrade() {
STR++;
return super.degrade();
}
public int typicalSTR() {
return 8 + tier * 2;
public int STRReq(int lvl){
lvl = Math.max(0, lvl);
//strength req decreases at +1,+3,+6,+10,etc.
return (8 + tier * 2) - (int)(Math.sqrt(8 * lvl + 1) - 1)/2;
}
@Override
@@ -101,8 +88,8 @@ public class MeleeWeapon extends Weapon {
} else {
int min = minBase();
int max = maxBase();
info += " " + Messages.get(MeleeWeapon.class, "unknown", (min + (max - min) / 2), typicalSTR());
if (typicalSTR() > Dungeon.hero.STR()) {
info += " " + Messages.get(MeleeWeapon.class, "unknown", (min + (max - min) / 2), STRReq(0));
if (STRReq(0) > Dungeon.hero.STR()) {
info += " " + Messages.get(MeleeWeapon.class, "probably_too_heavy");
}
}
@@ -120,7 +107,7 @@ public class MeleeWeapon extends Weapon {
String stats_desc = Messages.get(this, "stats_desc");
if (!stats_desc.equals("")) info+= "\n\n" + stats_desc;
if (levelKnown && STR > Dungeon.hero.STR()) {
if (levelKnown && STRReq() > Dungeon.hero.STR()) {
info += "\n\n" + Messages.get(Weapon.class, "too_heavy");
}
@@ -35,8 +35,6 @@ public class Boomerang extends MissileWeapon {
{
image = ItemSpriteSheet.BOOMERANG;
STR = 10;
stackable = false;
@@ -61,6 +59,12 @@ public class Boomerang extends MissileWeapon {
return 5 + 2 * level();
}
@Override
public int STRReq(int lvl) {
lvl = Math.max(0, lvl);
return 10 - (int)(Math.sqrt(8 * lvl + 1) - 1)/2;
}
@Override
public boolean isUpgradable() {
return true;
@@ -33,8 +33,6 @@ public class CurareDart extends MissileWeapon {
{
image = ItemSpriteSheet.CURARE_DART;
STR = 14;
}
@Override
@@ -47,6 +45,11 @@ public class CurareDart extends MissileWeapon {
return 3;
}
@Override
public int STRReq(int lvl) {
return 14;
}
public CurareDart() {
this( 1 );
}
@@ -42,6 +42,11 @@ public class Dart extends MissileWeapon {
return 4;
}
@Override
public int STRReq(int lvl) {
return 10;
}
public Dart() {
this( 1 );
}
@@ -36,8 +36,6 @@ public class IncendiaryDart extends MissileWeapon {
{
image = ItemSpriteSheet.INCENDIARY_DART;
STR = 12;
}
@Override
@@ -50,6 +48,11 @@ public class IncendiaryDart extends MissileWeapon {
return 2;
}
@Override
public int STRReq(int lvl) {
return 12;
}
public IncendiaryDart() {
this( 1 );
}
@@ -31,8 +31,6 @@ public class Javelin extends MissileWeapon {
{
image = ItemSpriteSheet.JAVELIN;
STR = 15;
}
@Override
@@ -45,6 +43,11 @@ public class Javelin extends MissileWeapon {
return 15;
}
@Override
public int STRReq(int lvl) {
return 15;
}
public Javelin() {
this( 1 );
}
@@ -131,7 +131,7 @@ abstract public class MissileWeapon extends Weapon {
info += "\n\n" + Messages.get( Weapon.class, "avg_dmg",(min() + (max() - min()) / 2));
if (STR > Dungeon.hero.STR()) {
if (STRReq() > Dungeon.hero.STR()) {
info += Messages.get(Weapon.class, "too_heavy");
}
@@ -28,8 +28,6 @@ public class Shuriken extends MissileWeapon {
{
image = ItemSpriteSheet.SHURIKEN;
STR = 13;
DLY = 0.5f;
}
@@ -44,6 +42,11 @@ public class Shuriken extends MissileWeapon {
return 6;
}
@Override
public int STRReq(int lvl) {
return 13;
}
public Shuriken() {
this( 1 );
}
@@ -31,8 +31,7 @@ public class Tamahawk extends MissileWeapon {
{
image = ItemSpriteSheet.TOMAHAWK;
STR = 17;
}
@Override
@@ -45,6 +44,11 @@ public class Tamahawk extends MissileWeapon {
return 20;
}
@Override
public int STRReq(int lvl) {
return 17;
}
public Tamahawk() {
this( 1 );
}