From 2be5bdd8c2cef88f3ba26686d8548d5e05795435 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 29 Jan 2023 15:08:33 -0500 Subject: [PATCH] v2.0.0: fixed some upgrade effects not working with twin upgrades --- .../items/weapon/melee/MeleeWeapon.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java index 0edd097f4..1d1c83fa2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java @@ -245,18 +245,25 @@ public class MeleeWeapon extends Weapon { return STRReq(tier, lvl); } + private static boolean evaluatingTwinUpgrades = false; @Override public int buffedLvl() { - if (isEquipped(Dungeon.hero) && Dungeon.hero.hasTalent(Talent.TWIN_UPGRADES)){ + if (!evaluatingTwinUpgrades && isEquipped(Dungeon.hero) && Dungeon.hero.hasTalent(Talent.TWIN_UPGRADES)){ KindOfWeapon other = null; if (Dungeon.hero.belongings.weapon() != this) other = Dungeon.hero.belongings.weapon(); if (Dungeon.hero.belongings.secondWep() != this) other = Dungeon.hero.belongings.secondWep(); - //weaker weapon needs to be 2/1/0 tiers lower, based on talent level - if (other instanceof MeleeWeapon - && (tier+(3-Dungeon.hero.pointsInTalent(Talent.TWIN_UPGRADES))) <= ((MeleeWeapon) other).tier - && other.level() > super.buffedLvl()){ - return other.level(); + if (other instanceof MeleeWeapon) { + evaluatingTwinUpgrades = true; + int otherLevel = other.buffedLvl(); + evaluatingTwinUpgrades = false; + + //weaker weapon needs to be 2/1/0 tiers lower, based on talent level + if ((tier + (3 - Dungeon.hero.pointsInTalent(Talent.TWIN_UPGRADES))) <= ((MeleeWeapon) other).tier + && otherLevel > super.buffedLvl()) { + return otherLevel; + } + } } return super.buffedLvl();