v0.9.0: unidentified scrolls can now be alchemized
This commit is contained in:
+6
-1
@@ -338,7 +338,6 @@ public abstract class Scroll extends Item {
|
|||||||
@Override
|
@Override
|
||||||
public boolean testIngredients(ArrayList<Item> ingredients) {
|
public boolean testIngredients(ArrayList<Item> ingredients) {
|
||||||
if (ingredients.size() != 1
|
if (ingredients.size() != 1
|
||||||
|| !ingredients.get(0).isIdentified()
|
|
||||||
|| !(ingredients.get(0) instanceof Scroll)
|
|| !(ingredients.get(0) instanceof Scroll)
|
||||||
|| !stones.containsKey(ingredients.get(0).getClass())){
|
|| !stones.containsKey(ingredients.get(0).getClass())){
|
||||||
return false;
|
return false;
|
||||||
@@ -359,6 +358,7 @@ public abstract class Scroll extends Item {
|
|||||||
Scroll s = (Scroll) ingredients.get(0);
|
Scroll s = (Scroll) ingredients.get(0);
|
||||||
|
|
||||||
s.quantity(s.quantity() - 1);
|
s.quantity(s.quantity() - 1);
|
||||||
|
s.setKnown();
|
||||||
|
|
||||||
return Reflection.newInstance(stones.get(s.getClass())).quantity(amnts.get(s.getClass()));
|
return Reflection.newInstance(stones.get(s.getClass())).quantity(amnts.get(s.getClass()));
|
||||||
}
|
}
|
||||||
@@ -368,7 +368,12 @@ public abstract class Scroll extends Item {
|
|||||||
if (!testIngredients(ingredients)) return null;
|
if (!testIngredients(ingredients)) return null;
|
||||||
|
|
||||||
Scroll s = (Scroll) ingredients.get(0);
|
Scroll s = (Scroll) ingredients.get(0);
|
||||||
|
|
||||||
|
if (!s.isKnown()){
|
||||||
|
return new Runestone.PlaceHolder();
|
||||||
|
} else {
|
||||||
return Reflection.newInstance(stones.get(s.getClass())).quantity(amnts.get(s.getClass()));
|
return Reflection.newInstance(stones.get(s.getClass())).quantity(amnts.get(s.getClass()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user