v0.2.2: fixed a visual sync bug with bones system

This commit is contained in:
Evan Debenham 2014-10-25 14:11:46 -04:00
parent 2d176b4b62
commit bd4405a805
6 changed files with 31 additions and 14 deletions

View File

@ -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 {

View File

@ -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 );
}

View File

@ -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<String> actions( Hero hero ) {

View File

@ -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 );
}

View File

@ -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<String> actions( Hero hero ) {

View File

@ -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<String> actions( Hero hero ) {