From bd8fed898cb8a44c165df22e9e33f61d25867e54 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 31 Dec 2020 22:35:13 -0500 Subject: [PATCH] v0.9.1b: fixed imp. projectiles targeting chars spawned by throw an item --- .../shatteredpixeldungeon/items/Item.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java index 95a739ba9..051b37e67 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java @@ -547,14 +547,14 @@ public class Item implements Bundlable { @Override public void call() { curUser = user; - Item.this.detach(user.belongings.backpack).onThrow(cell); + Item i = Item.this.detach(user.belongings.backpack); + if (i != null) i.onThrow(cell); if (curUser.hasTalent(Talent.IMPROVISED_PROJECTILES) && !(Item.this instanceof MissileWeapon) && curUser.buff(Talent.ImprovisedProjectileCooldown.class) == null){ - Char ch = Actor.findChar(cell); - if (ch != null && ch.alignment != curUser.alignment){ + if (enemy != null && enemy.alignment != curUser.alignment){ Sample.INSTANCE.play(Assets.Sounds.HIT); - Buff.affect(ch, Blindness.class, 1f + curUser.pointsInTalent(Talent.IMPROVISED_PROJECTILES)); + Buff.affect(enemy, Blindness.class, 1f + curUser.pointsInTalent(Talent.IMPROVISED_PROJECTILES)); Buff.affect(curUser, Talent.ImprovisedProjectileCooldown.class, 30f); } } @@ -572,16 +572,6 @@ public class Item implements Bundlable { curUser = user; Item i = Item.this.detach(user.belongings.backpack); if (i != null) i.onThrow(cell); - if (curUser.hasTalent(Talent.IMPROVISED_PROJECTILES) - && !(Item.this instanceof MissileWeapon) - && curUser.buff(Talent.ImprovisedProjectileCooldown.class) == null){ - Char ch = Actor.findChar(cell); - if (ch != null && ch.alignment != curUser.alignment){ - Sample.INSTANCE.play(Assets.Sounds.HIT); - Buff.affect(ch, Blindness.class, 1f + curUser.pointsInTalent(Talent.IMPROVISED_PROJECTILES)); - Buff.affect(curUser, Talent.ImprovisedProjectileCooldown.class, 30f); - } - } user.spendAndNext(delay); } });