diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Bones.java b/src/com/shatteredpixel/shatteredpixeldungeon/Bones.java index 18f9e3c28..7b6a65d10 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Bones.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Bones.java @@ -99,7 +99,7 @@ public class Bones { if (!items.isEmpty()) { item = Random.element(items); if (item.stackable){ - item.quantity(Random.NormalIntRange(1, (int)Math.sqrt(item.quantity()))); + item.quantity((int)Math.sqrt(item.quantity())); } } } @@ -147,9 +147,7 @@ public class Bones { } } - if (item instanceof Ring) { - ((Ring)item).syncGem(); - } + item.syncVisuals(); return item; } else { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java index 3b4bb6c3b..a4f910295 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java @@ -111,8 +111,12 @@ public class Item implements Bundlable { hero.spendAndNext( TIME_TO_DROP ); Dungeon.level.drop( detachAll( hero.belongings.backpack ), hero.pos ).sprite.drop( hero.pos ); } - - public void doThrow( Hero hero ) { + + public void syncVisuals(){ + //do nothing by default, as most items need no visual syncing. + } + + public void doThrow( Hero hero ) { GameScene.selectCell( thrower ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java index ae2aaf8d4..2b2d3196f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java @@ -110,9 +110,14 @@ public class Potion extends Item { public Potion() { super(); - image = handler.image( this ); - color = handler.label( this ); + syncVisuals(); } + + @Override + public void syncVisuals(){ + image = handler.image( this ); + color = handler.label( this ); + }; @Override public ArrayList actions( Hero hero ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java index 29e7cffdb..5ca12dfd1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java @@ -93,10 +93,10 @@ public class Ring extends KindofMisc { public Ring() { super(); - syncGem(); + syncVisuals(); } - public void syncGem() { + public void syncVisuals() { image = handler.image( this ); gem = handler.label( this ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java index 154f38f8c..51bbf1ea8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java @@ -92,9 +92,14 @@ public abstract class Scroll extends Item { public Scroll() { super(); - image = handler.image( this ); - rune = handler.label( this ); + syncVisuals(); } + + @Override + public void syncVisuals(){ + image = handler.image( this ); + rune = handler.label( this ); + }; @Override public ArrayList actions( Hero hero ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java index b2d43b2fa..53d3bc552 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java @@ -125,12 +125,17 @@ public abstract class Wand extends KindOfWeapon { calculateDamage(); try { - image = handler.image( this ); - wood = handler.label( this ); + syncVisuals(); } catch (Exception e) { // Wand of Magic Missile } } + + @Override + public void syncVisuals(){ + image = handler.image( this ); + wood = handler.label( this ); + } @Override public ArrayList actions( Hero hero ) {