Merging 1.9.1 source: item changes

This commit is contained in:
Evan Debenham
2015-11-11 02:01:25 -05:00
parent bc1e3ee17a
commit 366dce1610
86 changed files with 409 additions and 352 deletions
@@ -54,7 +54,6 @@ public class Armor extends EquipableItem {
public int tier;
public int STR;
public int DR;
private int hitsToKnow = HITS_TO_KNOW;
@@ -65,7 +64,6 @@ public class Armor extends EquipableItem {
this.tier = tier;
STR = typicalSTR();
DR = typicalDR();
}
private static final String UNFAMILIRIARITY = "unfamiliarity";
@@ -79,24 +77,24 @@ public class Armor extends EquipableItem {
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
super.restoreFromBundle(bundle);
if ((hitsToKnow = bundle.getInt( UNFAMILIRIARITY )) == 0) {
hitsToKnow = HITS_TO_KNOW;
}
inscribe( (Glyph)bundle.get( GLYPH ) );
inscribe((Glyph) bundle.get(GLYPH));
}
@Override
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero );
actions.add( isEquipped( hero ) ? AC_UNEQUIP : AC_EQUIP );
actions.add(isEquipped(hero) ? AC_UNEQUIP : AC_EQUIP);
return actions;
}
@Override
public boolean doEquip( Hero hero ) {
detach( hero.belongings.backpack );
detach(hero.belongings.backpack);
if (hero.belongings.armor == null || hero.belongings.armor.doUnequip( hero, true, false )) {
@@ -147,6 +145,10 @@ public class Armor extends EquipableItem {
return hero.belongings.armor == this;
}
public int DR(){
return tier * (2 + level() + (glyph == null ? 0 : 1));
}
@Override
public Item upgrade() {
return upgrade( false );
@@ -155,7 +157,7 @@ public class Armor extends EquipableItem {
public Item upgrade( boolean inscribe ) {
if (glyph != null) {
if (!inscribe && Random.Int( level ) > 0) {
if (!inscribe && Random.Int( level() ) > 0) {
GLog.w( TXT_INCOMPATIBLE );
inscribe( null );
}
@@ -164,8 +166,7 @@ public class Armor extends EquipableItem {
inscribe( Glyph.random() );
}
};
DR += tier;
STR--;
return super.upgrade();
@@ -173,7 +174,6 @@ public class Armor extends EquipableItem {
@Override
public Item degrade() {
DR -= tier;
STR++;
return super.degrade();
@@ -214,7 +214,7 @@ public class Armor extends EquipableItem {
if (levelKnown) {
info.append(
"\n\nThis " + name + " provides damage absorption up to " +
"" + Math.max( DR, 0 ) + " points per attack. " );
"" + Math.max( DR(), 0 ) + " points per attack. " );
if (STR > Dungeon.hero.STR()) {
@@ -297,10 +297,10 @@ public class Armor extends EquipableItem {
price /= 2;
}
if (levelKnown) {
if (level > 0) {
price *= (level + 1);
} else if (level < 0) {
price /= (1 - level);
if (level() > 0) {
price *= (level() + 1);
} else if (level() < 0) {
price /= (1 - level());
}
}
if (price < 1) {
@@ -310,13 +310,6 @@ public class Armor extends EquipableItem {
}
public Armor inscribe( Glyph glyph ) {
if (glyph != null && this.glyph == null) {
DR += tier;
} else if (glyph == null && this.glyph != null) {
DR -= tier;
}
this.glyph = glyph;
return this;
@@ -39,6 +39,8 @@ abstract public class ClassArmor extends Armor {
bones = false;
}
private int DR;
public ClassArmor() {
super( 6 );
@@ -64,7 +66,7 @@ abstract public class ClassArmor extends Armor {
}
classArmor.STR = armor.STR;
classArmor.DR = armor.DR;
classArmor.DR = armor.DR();
classArmor.inscribe( armor.glyph );
@@ -118,6 +120,11 @@ abstract public class ClassArmor extends Armor {
abstract public String special();
abstract public void doSpecial();
@Override
public int DR(){
return DR;
}
@Override
public boolean isUpgradable() {
@@ -41,7 +41,7 @@ public class Affection extends Glyph {
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage) {
int level = (int)GameMath.gate( 0, armor.level, 6 );
int level = (int)GameMath.gate( 0, armor.level(), 6 );
if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level / 2 + 5 ) >= 4) {
@@ -43,7 +43,7 @@ public class AntiEntropy extends Glyph {
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage) {
int level = Math.max( 0, armor.level );
int level = Math.max( 0, armor.level() );
if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 6 ) >= 5) {
@@ -37,7 +37,7 @@ public class Bounce extends Glyph {
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage) {
int level = Math.max( 0, armor.level );
int level = Math.max( 0, armor.level() );
if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 5) >= 4) {
@@ -44,7 +44,7 @@ public class Displacement extends Glyph {
return damage;
}
int nTries = (armor.level < 0 ? 1 : armor.level + 1) * 5;
int nTries = (armor.level() < 0 ? 1 : armor.level() + 1) * 5;
for (int i=0; i < nTries; i++) {
int pos = Random.Int( Level.LENGTH );
if (Dungeon.visible[pos] && Level.passable[pos] && Actor.findChar( pos ) == null) {
@@ -42,7 +42,7 @@ public class Entanglement extends Glyph {
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage ) {
int level = Math.max( 0, armor.level );
int level = Math.max( 0, armor.level() );
if (Random.Int( 4 ) == 0) {
@@ -40,7 +40,7 @@ public class Metabolism extends Glyph {
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage) {
int level = Math.max( 0, armor.level );
int level = Math.max( 0, armor.level() );
if (Random.Int( level / 2 + 5 ) >= 4) {
int healing = Math.min( defender.HT - defender.HP, Random.Int( 1, defender.HT / 5 ) );
@@ -44,7 +44,7 @@ public class Multiplicity extends Glyph {
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage) {
int level = Math.max( 0, armor.level );
int level = Math.max( 0, armor.level() );
if (Random.Int( level / 2 + 6 ) >= 5) {
@@ -41,7 +41,7 @@ public class Potential extends Glyph {
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage) {
int level = Math.max( 0, armor.level );
int level = Math.max( 0, armor.level() );
if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 7 ) >= 6) {
@@ -40,7 +40,7 @@ public class Stench extends Glyph {
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage) {
int level = Math.max( 0, armor.level );
int level = Math.max( 0, armor.level() );
if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 5 ) >= 4) {
@@ -49,7 +49,7 @@ public class Viscosity extends Glyph {
return 0;
}
int level = Math.max( 0, armor.level );
int level = Math.max( 0, armor.level() );
if (Random.Int( level + 7 ) >= 6) {