diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java index 1d563d86a..e44386eab 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java @@ -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 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 ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java index 4151cc559..54d4ea477 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java @@ -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 actions( Hero hero ) { ArrayList 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 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; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/WarriorArmor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/WarriorArmor.java index c9893e4d3..f4eae705f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/WarriorArmor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/WarriorArmor.java @@ -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);