From 2a60fd7de58e032ae7c52a69f53716c4ce64051a Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 13 Sep 2023 11:13:50 -0400 Subject: [PATCH] v2.2.0: reverted scroll of transmutation change re: potions and scrolls --- .../assets/messages/items/items.properties | 2 +- .../items/scrolls/ScrollOfTransmutation.java | 30 +++++++------------ 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index 9ac8ce482..d816c795b 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -1035,7 +1035,7 @@ items.scrolls.scrolloftransmutation.name=scroll of transmutation items.scrolls.scrolloftransmutation.inv_title=Transmute an item items.scrolls.scrolloftransmutation.nothing=Nothing interesting happens. items.scrolls.scrolloftransmutation.morph=Your item morphs into something different! -items.scrolls.scrolloftransmutation.desc=This scroll contains powerful transmutation magic. When used on an eligible item it will transform it into a different item of the same type. The magic will even preserve upgrades, enchantments, and glyphs. +items.scrolls.scrolloftransmutation.desc=This scroll contains powerful transmutation magic. When used on an eligible item it will transform it into a different item of the same type. The magic will even preserve upgrades, enchantments, and glyphs. Scrolls and potions will be transmuted into their exotic equivalent, and vice-versa. items.scrolls.scrollofupgrade.name=scroll of upgrade items.scrolls.scrollofupgrade.inv_title=Upgrade an item diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTransmutation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTransmutation.java index a7e8fb235..569892b77 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTransmutation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTransmutation.java @@ -321,29 +321,19 @@ public class ScrollOfTransmutation extends InventoryScroll { } private static Scroll changeScroll( Scroll s ) { - Scroll n; - - do { - n = (Scroll)Generator.randomUsingDefaults( Generator.Category.SCROLL ); - if (s instanceof ExoticScroll){ - n = Reflection.newInstance(ExoticScroll.regToExo.get(n.getClass())); - } - } while (n.getClass() == s.getClass()); - - return n; + if (s instanceof ExoticScroll) { + return Reflection.newInstance(ExoticScroll.exoToReg.get(s.getClass())); + } else { + return Reflection.newInstance(ExoticScroll.regToExo.get(s.getClass())); + } } private static Potion changePotion( Potion p ) { - Potion n; - - do { - n = (Potion)Generator.randomUsingDefaults( Generator.Category.POTION ); - if (p instanceof ExoticPotion){ - n = Reflection.newInstance(ExoticPotion.regToExo.get(n.getClass())); - } - } while (n.getClass() == p.getClass()); - - return n; + if (p instanceof ExoticPotion) { + return Reflection.newInstance(ExoticPotion.exoToReg.get(p.getClass())); + } else { + return Reflection.newInstance(ExoticPotion.regToExo.get(p.getClass())); + } } @Override