v0.7.0: made reset functionality less brittle for potions/scrolls/rings
This commit is contained in:
@@ -136,6 +136,15 @@ public class ItemStatusHandler<T extends Item> {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean contains( T item ){
|
||||
for (Class<?extends Item> i : items){
|
||||
if (item.getClass().equals(i)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int image( T item ) {
|
||||
return labelImages.get(label(item));
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ public class Potion extends Item {
|
||||
@Override
|
||||
public void reset(){
|
||||
super.reset();
|
||||
if (handler != null) {
|
||||
if (handler != null && handler.contains(this)) {
|
||||
image = handler.image(this);
|
||||
color = handler.label(this);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class Ring extends KindofMisc {
|
||||
|
||||
public void reset() {
|
||||
super.reset();
|
||||
if (handler != null){
|
||||
if (handler != null && handler.contains(this)){
|
||||
image = handler.image(this);
|
||||
gem = handler.label(this);
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ public abstract class Scroll extends Item {
|
||||
@Override
|
||||
public void reset(){
|
||||
super.reset();
|
||||
if (handler != null) {
|
||||
if (handler != null && handler.contains(this)) {
|
||||
image = handler.image(this);
|
||||
rune = handler.label(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user