From 8fe024add6fb91dee97cd572546d4d0f8b038807 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 10 Jul 2025 13:12:08 -0400 Subject: [PATCH] v3.2.0: liquid metal and arcane resin can now be made without full ID --- .../items/ArcaneResin.java | 25 +++++++++---- .../items/LiquidMetal.java | 35 +++++++++++-------- .../shatteredpixeldungeon/items/Recipe.java | 4 +-- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/ArcaneResin.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/ArcaneResin.java index 63d55de07..187145f80 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/ArcaneResin.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/ArcaneResin.java @@ -153,7 +153,7 @@ public class ArcaneResin extends Item { public boolean testIngredients(ArrayList ingredients) { return ingredients.size() == 1 && ingredients.get(0) instanceof Wand - && ingredients.get(0).isIdentified() + && ingredients.get(0).cursedKnown && !ingredients.get(0).cursed; } @@ -165,8 +165,12 @@ public class ArcaneResin extends Item { @Override public Item brew(ArrayList 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; } @@ -174,15 +178,22 @@ public class ArcaneResin extends Item { @Override public Item sampleOutput(ArrayList ingredients) { 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)){ - output.quantity(output.quantity() + Dungeon.hero.pointsInTalent(Talent.WAND_PRESERVATION)); + quantity += Dungeon.hero.pointsInTalent(Talent.WAND_PRESERVATION); } - - return output; + return quantity; } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/LiquidMetal.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/LiquidMetal.java index 834eab975..b8a4c79db 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/LiquidMetal.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/LiquidMetal.java @@ -129,9 +129,7 @@ public class LiquidMetal extends Item { return item instanceof MissileWeapon && !(item instanceof Dart); } - //TODO this needs to fix broken thrown 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? + //TODO should we let this fix broken weapons too? @Override public void onSelect( Item item ) { @@ -178,7 +176,7 @@ public class LiquidMetal extends Item { public boolean testIngredients(ArrayList ingredients) { return ingredients.size() == 1 && ingredients.get(0) instanceof MissileWeapon - && ingredients.get(0).isIdentified() + && ingredients.get(0).cursedKnown && !ingredients.get(0).cursed; } @@ -190,27 +188,34 @@ public class LiquidMetal extends Item { @Override public Item brew(ArrayList ingredients) { Item result = sampleOutput(ingredients); + MissileWeapon m = (MissileWeapon) ingredients.get(0); + if (!m.levelKnown){ + result.quantity(metalQuantity(m)); + } - MissileWeapon w = (MissileWeapon) ingredients.get(0); - w.quantity(0); - Buff.affect(Dungeon.hero, MissileWeapon.UpgradedSetTracker.class).levelThresholds.put(w.setID, Integer.MAX_VALUE); + m.quantity(0); + Buff.affect(Dungeon.hero, MissileWeapon.UpgradedSetTracker.class).levelThresholds.put(m.setID, Integer.MAX_VALUE); return result; } @Override public Item sampleOutput(ArrayList ingredients) { - int metalQuantity = 0; + MissileWeapon m = (MissileWeapon) ingredients.get(0); - for (Item i : ingredients){ - MissileWeapon m = (MissileWeapon) i; - float quantity = m.quantity()-1; - quantity += 0.25f + 0.0075f*m.durabilityLeft(); - quantity *= Math.pow(2, Math.min(3, m.level())); - metalQuantity += Math.round((5*(m.tier+1))*quantity); + if (m.levelKnown){ + return new LiquidMetal().quantity(metalQuantity(m)); + } else { + return new LiquidMetal(); } + } - 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); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Recipe.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Recipe.java index 96720b10c..eefc7185b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Recipe.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Recipe.java @@ -257,10 +257,10 @@ public abstract class Recipe { public static boolean usableInRecipe(Item item){ //only upgradeable thrown weapons and wands allowed among equipment items if (item instanceof EquipableItem){ - return item.isIdentified() && !item.cursed && + return item.cursedKnown && !item.cursed && item instanceof MissileWeapon && item.isUpgradable(); } else if (item instanceof Wand) { - return item.isIdentified() && !item.cursed; + return item.cursedKnown && !item.cursed; } else { //other items can be unidentified, but not cursed return !item.cursed;