v0.7.2: identified items are now only required for specific recipes

This commit is contained in:
Evan Debenham 2019-01-22 16:11:17 -05:00
parent 1613c8adc4
commit a9fa21dd4e
4 changed files with 7 additions and 3 deletions

View File

@ -105,6 +105,7 @@ public abstract class Recipe {
//TODO is this right? //TODO is this right?
for (Item ingredient : ingredients){ for (Item ingredient : ingredients){
if (!ingredient.isIdentified()) return false;
for (int i = 0; i < inputs.length; i++){ for (int i = 0; i < inputs.length; i++){
if (ingredient.getClass() == inputs[i]){ if (ingredient.getClass() == inputs[i]){
needed[i] -= ingredient.quantity(); needed[i] -= ingredient.quantity();
@ -239,8 +240,7 @@ public abstract class Recipe {
} }
public static boolean usableInRecipe(Item item){ public static boolean usableInRecipe(Item item){
return item.isIdentified() return !item.cursed
&& !item.cursed
&& (!(item instanceof EquipableItem) || item instanceof Dart || item instanceof AlchemistsToolkit) && (!(item instanceof EquipableItem) || item instanceof Dart || item instanceof AlchemistsToolkit)
&& !(item instanceof Wand); && !(item instanceof Wand);
} }

View File

@ -348,6 +348,7 @@ public class Bomb extends Item {
boolean ingredient = false; boolean ingredient = false;
for (Item i : ingredients){ for (Item i : ingredients){
if (!i.isIdentified()) return false;
if (i.getClass().equals(Bomb.class)){ if (i.getClass().equals(Bomb.class)){
bomb = true; bomb = true;
} else if (validIngredients.containsKey(i.getClass())){ } else if (validIngredients.containsKey(i.getClass())){

View File

@ -333,6 +333,7 @@ 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;

View File

@ -108,7 +108,8 @@ public class QuickRecipe extends Component {
ArrayList<Item> similar = Dungeon.hero.belongings.getAllSimilar(in); ArrayList<Item> similar = Dungeon.hero.belongings.getAllSimilar(in);
int quantity = 0; int quantity = 0;
for (Item sim : similar) { for (Item sim : similar) {
if (sim.isIdentified()) quantity += sim.quantity(); //if we are looking for a specific item, it must be IDed
if (sim.getClass() != in.getClass() || sim.isIdentified()) quantity += sim.quantity();
} }
if (quantity < in.quantity()) { if (quantity < in.quantity()) {
@ -255,6 +256,7 @@ public class QuickRecipe extends Component {
for (Class<?> cls : Generator.Category.SCROLL.classes){ for (Class<?> cls : Generator.Category.SCROLL.classes){
try{ try{
Scroll scroll = (Scroll) cls.newInstance(); Scroll scroll = (Scroll) cls.newInstance();
if (!scroll.isKnown()) scroll.anonymize();
ArrayList<Item> in = new ArrayList<Item>(Arrays.asList(scroll)); ArrayList<Item> in = new ArrayList<Item>(Arrays.asList(scroll));
result.add(new QuickRecipe( r, in, r.sampleOutput(in))); result.add(new QuickRecipe( r, in, r.sampleOutput(in)));
} catch (Exception e){ } catch (Exception e){