From 47d01ebe00c1c4932e2a7655352f3b40bbf50073 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 22 Nov 2018 01:54:31 -0500 Subject: [PATCH] v0.7.1: added conversion logic for huntress boomerangs --- .../shatteredpixeldungeon/Dungeon.java | 24 +++++++++++++++++++ .../ShatteredPixelDungeon.java | 5 ++++ 2 files changed, 29 insertions(+) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index 1b18f690c..5166c3a19 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -41,6 +41,8 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose; import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; +import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.SpiritBow; import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.levels.CavesBossLevel; import com.shatteredpixel.shatteredpixeldungeon.levels.CavesLevel; @@ -395,6 +397,28 @@ public class Dungeon { hero.curAction = hero.lastAction = null; + //pre-0.7.1 saves. Adjusting for spirit bows in weapon slot or with upgrades. + SpiritBow bow; + if (hero.belongings.weapon instanceof SpiritBow){ + bow = (SpiritBow)hero.belongings.weapon; + hero.belongings.weapon = null; + + if (!bow.collect()){ + level.drop(bow, hero.pos); + } + } else { + bow = hero.belongings.getItem(SpiritBow.class); + } + + if (bow != null && bow.spentUpgrades() > 0){ + ScrollOfUpgrade refund = new ScrollOfUpgrade(); + refund.quantity(bow.spentUpgrades()); + bow.level(0); + if (!refund.collect()){ + level.drop(refund, hero.pos); + } + } + observe(); try { saveAll(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java index 642981e3c..7577a0011 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java @@ -143,6 +143,11 @@ public class ShatteredPixelDungeon extends Game { com.shatteredpixel.shatteredpixeldungeon.items.spells.MagicalInfusion.class, "com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion" ); + //v0.7.1 + com.watabou.utils.Bundle.addAlias( + com.shatteredpixel.shatteredpixeldungeon.items.weapon.SpiritBow.class, + "com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang" ); + } @Override