v2.0.0: fixed some upgrade effects not working with twin upgrades

This commit is contained in:
Evan Debenham
2023-01-29 15:08:33 -05:00
parent 908bfe61b2
commit 2be5bdd8c2
@@ -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();