From 9eb0b3400861ab87690116dc97415f662241c8da Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 14 Jan 2021 21:58:04 -0500 Subject: [PATCH] v0.9.2: adjusted wand imbuing text to reflect wand preservation --- .../assets/messages/items/items.properties | 4 ++- .../items/weapon/melee/MagesStaff.java | 28 ++++++++++++++----- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index 8bd541eb9..c534357db 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -1400,7 +1400,9 @@ items.weapon.melee.magesstaff.preserved=The previous wand was preserved! items.weapon.melee.magesstaff.conflict=The conflicting magics erase the enchantment on your staff. items.weapon.melee.magesstaff.id_first=You'll need to identify this wand first. items.weapon.melee.magesstaff.cursed=You can't use a cursed wand. -items.weapon.melee.magesstaff.warning=Are you sure you want to imbue your staff with this wand? The previous imbue will be lost.\n\nIf the wand being imbued is the same or higher level than the staff, the staff will inherit the level of that wand plus a single one of its own upgrades.\n\nThis imbue will result in a level %d staff. +items.weapon.melee.magesstaff.imbue_desc=Are you sure you want to imbue your staff with this wand?\n\nIf the wand being imbued is the same or higher level than the staff, the staff will inherit the level of that wand plus a single one of its own upgrades.\n\nThis imbue will result in a level %d staff. +items.weapon.melee.magesstaff.imbue_lost=The wand currently imbued in your staff will be lost. +items.weapon.melee.magesstaff.imbue_talent=The wand currently imbued in your staff has a %1$d%% chance to be returned at +0. Wand returns remaining: %2$d. items.weapon.melee.magesstaff.yes=Yes, I'm sure. items.weapon.melee.magesstaff.no=No, I changed my mind items.weapon.melee.magesstaff.desc=Crafted by the Mage himself, this staff is a unique magical weapon which can be imbued with a wand. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java index fe0d83c56..9c02c8915 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java @@ -360,15 +360,29 @@ public class MagesStaff extends MeleeWeapon { if (wand == null){ applyWand((Wand)item); } else { - final int newLevel = - item.level() >= level() ? - level() > 0 ? - item.level() + 1 - : item.level() - : level(); + int newLevel; + if (item.level() >= level()){ + if (level() > 0) newLevel = item.level() + 1; + else newLevel = item.level(); + } else { + newLevel = level(); + } + + String bodyText = Messages.get(MagesStaff.class, "imbue_desc", newLevel); + int preservesLeft = Dungeon.hero.hasTalent(Talent.WAND_PRESERVATION) ? 3 : 0; + if (Dungeon.hero.buff(Talent.WandPreservationCounter.class) != null){ + preservesLeft -= Dungeon.hero.buff(Talent.WandPreservationCounter.class).count(); + } + if (preservesLeft > 0){ + int preserveChance = Dungeon.hero.pointsInTalent(Talent.WAND_PRESERVATION) == 1 ? 67 : 100; + bodyText += "\n\n" + Messages.get(MagesStaff.class, "imbue_talent", preserveChance, preservesLeft); + } else { + bodyText += "\n\n" + Messages.get(MagesStaff.class, "imbue_lost"); + } + GameScene.show( new WndOptions("", - Messages.get(MagesStaff.class, "warning", newLevel), + bodyText, Messages.get(MagesStaff.class, "yes"), Messages.get(MagesStaff.class, "no")) { @Override