v3.2.0: liquid metal and arcane resin can now be made without full ID

This commit is contained in:
Evan Debenham
2025-07-10 13:12:08 -04:00
parent b85953e760
commit 8fe024add6
3 changed files with 40 additions and 24 deletions

View File

@@ -153,7 +153,7 @@ public class ArcaneResin extends Item {
public boolean testIngredients(ArrayList<Item> ingredients) { public boolean testIngredients(ArrayList<Item> ingredients) {
return ingredients.size() == 1 return ingredients.size() == 1
&& ingredients.get(0) instanceof Wand && ingredients.get(0) instanceof Wand
&& ingredients.get(0).isIdentified() && ingredients.get(0).cursedKnown
&& !ingredients.get(0).cursed; && !ingredients.get(0).cursed;
} }
@@ -165,8 +165,12 @@ public class ArcaneResin extends Item {
@Override @Override
public Item brew(ArrayList<Item> ingredients) { public Item brew(ArrayList<Item> ingredients) {
Item result = sampleOutput(ingredients); Item result = sampleOutput(ingredients);
Wand w = (Wand)ingredients.get(0);
ingredients.get(0).quantity(0); if (!w.levelKnown){
result.quantity(resinQuantity(w));
}
w.quantity(0);
return result; return result;
} }
@@ -174,15 +178,22 @@ public class ArcaneResin extends Item {
@Override @Override
public Item sampleOutput(ArrayList<Item> ingredients) { public Item sampleOutput(ArrayList<Item> ingredients) {
Wand w = (Wand)ingredients.get(0); Wand w = (Wand)ingredients.get(0);
int level = w.level() - w.resinBonus;
Item output = new ArcaneResin().quantity(2*(level+1)); if (w.levelKnown){
return new ArcaneResin().quantity(resinQuantity(w));
} else {
return new ArcaneResin();
}
}
private int resinQuantity(Wand w){
int level = w.level() - w.resinBonus;
int quantity = 2*(level+1);
if (Dungeon.hero.heroClass != HeroClass.MAGE && Dungeon.hero.hasTalent(Talent.WAND_PRESERVATION)){ if (Dungeon.hero.heroClass != HeroClass.MAGE && Dungeon.hero.hasTalent(Talent.WAND_PRESERVATION)){
output.quantity(output.quantity() + Dungeon.hero.pointsInTalent(Talent.WAND_PRESERVATION)); quantity += Dungeon.hero.pointsInTalent(Talent.WAND_PRESERVATION);
} }
return quantity;
return output;
} }
} }

View File

@@ -129,9 +129,7 @@ public class LiquidMetal extends Item {
return item instanceof MissileWeapon && !(item instanceof Dart); return item instanceof MissileWeapon && !(item instanceof Dart);
} }
//TODO this needs to fix broken thrown weapons too //TODO should we let this fix broken weapons too?
// should also only apply to IDed thrown weapons?
// TODO maybe thrown weps and wands can just be known uncursed in order to make recipe?
@Override @Override
public void onSelect( Item item ) { public void onSelect( Item item ) {
@@ -178,7 +176,7 @@ public class LiquidMetal extends Item {
public boolean testIngredients(ArrayList<Item> ingredients) { public boolean testIngredients(ArrayList<Item> ingredients) {
return ingredients.size() == 1 return ingredients.size() == 1
&& ingredients.get(0) instanceof MissileWeapon && ingredients.get(0) instanceof MissileWeapon
&& ingredients.get(0).isIdentified() && ingredients.get(0).cursedKnown
&& !ingredients.get(0).cursed; && !ingredients.get(0).cursed;
} }
@@ -190,27 +188,34 @@ public class LiquidMetal extends Item {
@Override @Override
public Item brew(ArrayList<Item> ingredients) { public Item brew(ArrayList<Item> ingredients) {
Item result = sampleOutput(ingredients); Item result = sampleOutput(ingredients);
MissileWeapon m = (MissileWeapon) ingredients.get(0);
if (!m.levelKnown){
result.quantity(metalQuantity(m));
}
MissileWeapon w = (MissileWeapon) ingredients.get(0); m.quantity(0);
w.quantity(0); Buff.affect(Dungeon.hero, MissileWeapon.UpgradedSetTracker.class).levelThresholds.put(m.setID, Integer.MAX_VALUE);
Buff.affect(Dungeon.hero, MissileWeapon.UpgradedSetTracker.class).levelThresholds.put(w.setID, Integer.MAX_VALUE);
return result; return result;
} }
@Override @Override
public Item sampleOutput(ArrayList<Item> ingredients) { public Item sampleOutput(ArrayList<Item> ingredients) {
int metalQuantity = 0; MissileWeapon m = (MissileWeapon) ingredients.get(0);
for (Item i : ingredients){ if (m.levelKnown){
MissileWeapon m = (MissileWeapon) i; return new LiquidMetal().quantity(metalQuantity(m));
float quantity = m.quantity()-1; } else {
quantity += 0.25f + 0.0075f*m.durabilityLeft(); return new LiquidMetal();
quantity *= Math.pow(2, Math.min(3, m.level()));
metalQuantity += Math.round((5*(m.tier+1))*quantity);
} }
}
return new LiquidMetal().quantity(metalQuantity); private int metalQuantity(MissileWeapon m){
//TODO a smaller quantity set (if one ever exists) should produce more metal per thrown wep?
float quantity = m.quantity()-1;
quantity += 0.25f + 0.0075f*m.durabilityLeft();
quantity *= Math.pow(2, Math.min(3, m.level()));
return Math.round((5*(m.tier+1))*quantity);
} }
} }

View File

@@ -257,10 +257,10 @@ public abstract class Recipe {
public static boolean usableInRecipe(Item item){ public static boolean usableInRecipe(Item item){
//only upgradeable thrown weapons and wands allowed among equipment items //only upgradeable thrown weapons and wands allowed among equipment items
if (item instanceof EquipableItem){ if (item instanceof EquipableItem){
return item.isIdentified() && !item.cursed && return item.cursedKnown && !item.cursed &&
item instanceof MissileWeapon && item.isUpgradable(); item instanceof MissileWeapon && item.isUpgradable();
} else if (item instanceof Wand) { } else if (item instanceof Wand) {
return item.isIdentified() && !item.cursed; return item.cursedKnown && !item.cursed;
} else { } else {
//other items can be unidentified, but not cursed //other items can be unidentified, but not cursed
return !item.cursed; return !item.cursed;