From a9331943429b11ed77a9a6cccd8fff853df04df1 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 20 Feb 2021 18:30:29 -0500 Subject: [PATCH] v0.9.2: fixed projecting not working with shared enchantments talent --- .../items/weapon/missiles/MissileWeapon.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java index 13562f55e..b9fd42b93 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java @@ -146,8 +146,20 @@ abstract public class MissileWeapon extends Weapon { @Override public int throwPos(Hero user, int dst) { - if (hasEnchant(Projecting.class, user) - && !Dungeon.level.solid[dst] && Dungeon.level.distance(user.pos, dst) <= 4){ + + boolean projecting = hasEnchant(Projecting.class, user); + if (!projecting && Random.Int(3) < user.pointsInTalent(Talent.SHARED_ENCHANTMENT)){ + if (this instanceof Dart && ((Dart) this).crossbowHasEnchant(Dungeon.hero)){ + //do nothing + } else { + SpiritBow bow = Dungeon.hero.belongings.getItem(SpiritBow.class); + if (bow != null && bow.hasEnchant(Projecting.class, user)) { + projecting = true; + } + } + } + + if (projecting && !Dungeon.level.solid[dst] && Dungeon.level.distance(user.pos, dst) <= 4){ return dst; } else { return super.throwPos(user, dst);