Merging 1.7.5 Source: items/armor changes

This commit is contained in:
Evan Debenham 2015-02-03 23:55:28 -05:00
parent 3f126e7a4f
commit 1acebb380c
3 changed files with 32 additions and 21 deletions

View File

@ -32,7 +32,7 @@ import java.util.ArrayList;
public class Stylus extends Item {
private static final String TXT_SELECT_ARMOR = "Select an armor to inscribe on";
private static final String TXT_INSCRIBED = "you inscribed the %s on your %s";
private static final String TXT_INSCRIBED = "you inscribed the your %s with the stylus";
private static final float TIME_TO_INSCRIBE = 2;
@ -81,16 +81,10 @@ public class Stylus extends Item {
private void inscribe( Armor armor ) {
detach( curUser.belongings.backpack );
GLog.w( TXT_INSCRIBED, armor.name() );
Class<? extends Armor.Glyph> oldGlyphClass = armor.glyph != null ? armor.glyph.getClass() : null;
Armor.Glyph glyph = Armor.Glyph.random();
while (glyph.getClass() == oldGlyphClass) {
glyph = Armor.Glyph.random();
}
GLog.w( TXT_INSCRIBED, glyph.name(), armor.name() );
armor.inscribe( glyph );
armor.inscribe();
curUser.sprite.operate( curUser.pos );
curUser.sprite.centerEmitter().start( PurpleParticle.BURST, 0.05f, 10 );

View File

@ -35,7 +35,9 @@ import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class Armor extends EquipableItem {
private static final int HITS_TO_KNOW = 10;
private static final String TXT_EQUIP_CURSED = "your %s constricts around you painfully";
private static final String TXT_IDENTIFY = "you are now familiar enough with your %s to identify it. It is %s.";
@ -50,7 +52,7 @@ public class Armor extends EquipableItem {
public int STR;
public int DR;
private int hitsToKnow = 10;
private int hitsToKnow = HITS_TO_KNOW;
public Glyph glyph;
@ -61,21 +63,26 @@ public class Armor extends EquipableItem {
STR = typicalSTR();
DR = typicalDR();
}
private static final String GLYPH = "glyph";
private static final String UNFAMILIRIARITY = "unfamiliarity";
private static final String GLYPH = "glyph";
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle( bundle );
bundle.put( UNFAMILIRIARITY, hitsToKnow );
bundle.put( GLYPH, glyph );
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
glyph = (Glyph)bundle.get( GLYPH );
if ((hitsToKnow = bundle.getInt( UNFAMILIRIARITY )) == 0) {
hitsToKnow = HITS_TO_KNOW;
}
inscribe( (Glyph)bundle.get( GLYPH ) );
}
@Override
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero );
@ -271,7 +278,7 @@ public class Armor extends EquipableItem {
}
if (Random.Int( 10 ) == 0) {
inscribe( Glyph.random() );
inscribe();
}
return this;
@ -319,7 +326,18 @@ public class Armor extends EquipableItem {
return this;
}
public Armor inscribe() {
Class<? extends Glyph> oldGlyphClass = glyph != null ? glyph.getClass() : null;
Glyph gl = Glyph.random();
while (gl.getClass() == oldGlyphClass) {
gl = Armor.Glyph.random();
}
return inscribe( gl );
}
public boolean isInscribed() {
return glyph != null;
}

View File

@ -17,7 +17,6 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
import com.watabou.noosa.Camera;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
@ -98,7 +97,7 @@ public class WarriorArmor extends ClassArmor {
final int dest = cell;
curUser.busy();
((HeroSprite)curUser.sprite).jump(curUser.pos, cell, new Callback() {
curUser.sprite.jump(curUser.pos, cell, new Callback() {
@Override
public void call() {
curUser.move(dest);