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:
parent
f724d4c2b9
commit
96c9ca6de4
|
@ -280,7 +280,7 @@ public class Hero extends Char {
|
|||
evasion /= 2;
|
||||
}
|
||||
|
||||
int aEnc = belongings.armor != null ? belongings.armor.STR - STR() : 9 - STR();
|
||||
int aEnc = belongings.armor != null ? belongings.armor.STRReq() - STR() : 9 - STR();
|
||||
|
||||
if (aEnc > 0) {
|
||||
return (int)(defenseSkill * evasion / Math.pow( 1.5, aEnc ));
|
||||
|
@ -342,7 +342,7 @@ public class Hero extends Char {
|
|||
if (hasteLevel != 0)
|
||||
speed *= Math.pow(1.2, hasteLevel);
|
||||
|
||||
int aEnc = belongings.armor != null ? belongings.armor.STR - STR() : 0;
|
||||
int aEnc = belongings.armor != null ? belongings.armor.STRReq() - STR() : 0;
|
||||
if (aEnc > 0) {
|
||||
|
||||
return (float)(speed * Math.pow( 1.3, -aEnc ));
|
||||
|
|
|
@ -375,7 +375,7 @@ public class Generator {
|
|||
a1.random();
|
||||
a2.random();
|
||||
|
||||
return Math.abs(targetStr - a1.STR) < Math.abs(targetStr - a2.STR) ? a1 : a2;
|
||||
return Math.abs(targetStr - a1.STRReq()) < Math.abs(targetStr - a2.STRReq()) ? a1 : a2;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -398,7 +398,7 @@ public class Generator {
|
|||
w1.random();
|
||||
w2.random();
|
||||
|
||||
return Math.abs( targetStr - w1.STR ) < Math.abs( targetStr - w2.STR ) ? w1 : w2;
|
||||
return Math.abs( targetStr - w1.STRReq() ) < Math.abs( targetStr - w2.STRReq() ) ? w1 : w2;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -59,18 +59,13 @@ public class Armor extends EquipableItem {
|
|||
|
||||
public int tier;
|
||||
|
||||
public int STR;
|
||||
|
||||
private int hitsToKnow = HITS_TO_KNOW;
|
||||
|
||||
public Glyph glyph;
|
||||
private BrokenSeal seal;
|
||||
|
||||
public Armor( int tier ) {
|
||||
|
||||
this.tier = tier;
|
||||
|
||||
STR = typicalSTR();
|
||||
}
|
||||
|
||||
private static final String UNFAMILIRIARITY = "unfamiliarity";
|
||||
|
@ -92,12 +87,7 @@ public class Armor extends EquipableItem {
|
|||
hitsToKnow = HITS_TO_KNOW;
|
||||
}
|
||||
inscribe((Glyph) bundle.get(GLYPH));
|
||||
//TODO holdover from beta releases, remove in 0.4.0
|
||||
if (bundle.getBoolean(SEAL)){
|
||||
seal = new BrokenSeal();
|
||||
if (level() > 0) seal.level(1);
|
||||
} else
|
||||
seal = (BrokenSeal)bundle.get(SEAL);
|
||||
seal = (BrokenSeal)bundle.get(SEAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -238,18 +228,9 @@ public class Armor extends EquipableItem {
|
|||
if (seal != null && seal.level() == 0)
|
||||
seal.upgrade();
|
||||
|
||||
STR--;
|
||||
|
||||
return super.upgrade();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item degrade() {
|
||||
STR++;
|
||||
|
||||
return super.degrade();
|
||||
}
|
||||
|
||||
public int proc( Char attacker, Char defender, int damage ) {
|
||||
|
||||
if (glyph != null) {
|
||||
|
@ -269,7 +250,7 @@ public class Armor extends EquipableItem {
|
|||
|
||||
@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
|
||||
|
@ -284,13 +265,13 @@ public class Armor extends EquipableItem {
|
|||
if (levelKnown) {
|
||||
info += "\n\n" + Messages.get(Armor.class, "curr_absorb", Math.max( DR(), 0 ));
|
||||
|
||||
if (STR > Dungeon.hero.STR()) {
|
||||
if (STRReq() > Dungeon.hero.STR()) {
|
||||
info += "\n\n" + Messages.get(Armor.class, "too_heavy");
|
||||
}
|
||||
} else {
|
||||
info += "\n\n" + Messages.get(Armor.class, "avg_absorb", typicalDR(), typicalSTR());
|
||||
info += "\n\n" + Messages.get(Armor.class, "avg_absorb", typicalDR(), STRReq(0));
|
||||
|
||||
if (typicalSTR() > Dungeon.hero.STR()) {
|
||||
if (STRReq(0) > Dungeon.hero.STR()) {
|
||||
info += "\n\n" + Messages.get(Armor.class, "probably_too_heavy");
|
||||
}
|
||||
}
|
||||
|
@ -345,8 +326,14 @@ public class Armor extends EquipableItem {
|
|||
return this;
|
||||
}
|
||||
|
||||
public int typicalSTR() {
|
||||
return 7 + tier * 2;
|
||||
public int STRReq(){
|
||||
return STRReq(level());
|
||||
}
|
||||
|
||||
public int STRReq(int lvl){
|
||||
lvl = Math.max(0, lvl);
|
||||
//strength req decreases at +1,+3,+6,+10,etc.
|
||||
return (7 + tier * 2) - (int)(Math.sqrt(8 * lvl + 1) - 1)/2;
|
||||
}
|
||||
|
||||
public int typicalDR() {
|
||||
|
|
|
@ -42,7 +42,7 @@ abstract public class ClassArmor extends Armor {
|
|||
bones = false;
|
||||
}
|
||||
|
||||
private int DR;
|
||||
private int armorTier;
|
||||
|
||||
public ClassArmor() {
|
||||
super( 6 );
|
||||
|
@ -72,29 +72,37 @@ abstract public class ClassArmor extends Armor {
|
|||
}
|
||||
|
||||
classArmor.level(armor.level());
|
||||
classArmor.STR = armor.STR;
|
||||
classArmor.DR = armor.DR();
|
||||
|
||||
classArmor.armorTier = armor.tier;
|
||||
classArmor.inscribe( armor.glyph );
|
||||
|
||||
return classArmor;
|
||||
}
|
||||
|
||||
private static final String ARMOR_STR = "STR";
|
||||
private static final String ARMOR_DR = "DR";
|
||||
private static final String ARMOR_TIER = "armortier";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( ARMOR_STR, STR );
|
||||
bundle.put( ARMOR_DR, DR );
|
||||
bundle.put( ARMOR_TIER, armorTier );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
STR = bundle.getInt( ARMOR_STR );
|
||||
DR = bundle.getInt( ARMOR_DR );
|
||||
//logic for pre-0.4.0 saves
|
||||
if (bundle.contains( "DR" )){
|
||||
//we just assume tier-4 or tier-5 armor was used.
|
||||
int DR = bundle.getInt( "DR" );
|
||||
if (DR % 5 == 0){
|
||||
level((DR - 10)/5);
|
||||
armorTier = 5;
|
||||
} else {
|
||||
level((DR - 8)/4);
|
||||
armorTier = 4;
|
||||
}
|
||||
} else {
|
||||
armorTier = bundle.getInt( ARMOR_TIER );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -130,13 +138,14 @@ abstract public class ClassArmor extends Armor {
|
|||
abstract public void doSpecial();
|
||||
|
||||
@Override
|
||||
public int DR(){
|
||||
return DR;
|
||||
public int STRReq(int lvl) {
|
||||
lvl = Math.max(0, lvl);
|
||||
return (7 + armorTier * 2) - (int)(Math.sqrt(8 * lvl + 1) - 1)/2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUpgradable() {
|
||||
return false;
|
||||
public int DR(){
|
||||
return armorTier * (2 + level() + (glyph == null ? 0 : 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -58,7 +58,6 @@ public class Pickaxe extends Weapon {
|
|||
|
||||
defaultAction = AC_MINE;
|
||||
|
||||
STR = 14;
|
||||
}
|
||||
|
||||
public boolean bloodStained = false;
|
||||
|
@ -73,6 +72,11 @@ public class Pickaxe extends Weapon {
|
|||
return 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int STRReq(int lvl) {
|
||||
return 14;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
|
|
|
@ -54,7 +54,6 @@ abstract public class Weapon extends KindOfWeapon {
|
|||
|
||||
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 );
|
||||
}
|
||||
|
@ -162,6 +161,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) {
|
||||
if (!enchant && Random.Int( level() ) > 0) {
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,6 @@ public class Boomerang extends MissileWeapon {
|
|||
{
|
||||
image = ItemSpriteSheet.BOOMERANG;
|
||||
|
||||
STR = 10;
|
||||
|
||||
stackable = false;
|
||||
|
||||
unique = true;
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,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 );
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ 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 );
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ public class ItemSlot extends Button {
|
|||
|
||||
if (item.levelKnown || (isWeapon && !(item instanceof MeleeWeapon))) {
|
||||
|
||||
int str = isArmor ? ((Armor)item).STR : ((Weapon)item).STR;
|
||||
int str = isArmor ? ((Armor)item).STRReq() : ((Weapon)item).STRReq();
|
||||
topRight.text( Messages.format( TXT_STRENGTH, str ) );
|
||||
if (str > Dungeon.hero.STR()) {
|
||||
topRight.hardlight( DEGRADED );
|
||||
|
@ -176,8 +176,8 @@ public class ItemSlot extends Button {
|
|||
} else {
|
||||
|
||||
topRight.text( Messages.format( TXT_TYPICAL_STR, isArmor ?
|
||||
((Armor)item).typicalSTR() :
|
||||
((MeleeWeapon)item).typicalSTR() ) );
|
||||
((Armor)item).STRReq(0) :
|
||||
((Weapon)item).STRReq(0) ) );
|
||||
topRight.hardlight( WARNING );
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user