From 331c05420dc4f48df9970ceae815b3d4e5778828 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 9 Sep 2019 21:10:57 -0400 Subject: [PATCH] v0.7.5: fixed boomerang circle back buff incorrectly using curUser --- .../items/weapon/missiles/HeavyBoomerang.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/HeavyBoomerang.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/HeavyBoomerang.java index 600003baf..79ba19937 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/HeavyBoomerang.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/HeavyBoomerang.java @@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite; import com.watabou.noosa.tweeners.AlphaTweener; @@ -92,6 +93,7 @@ public class HeavyBoomerang extends MissileWeapon { left--; if (left <= 0){ final Char returnTarget = Actor.findChar(returnPos); + final Char target = this.target; MissileSprite visual = ((MissileSprite) Dungeon.hero.sprite.parent.recycle(MissileSprite.class)); visual.reset( thrownPos, returnPos, @@ -99,16 +101,16 @@ public class HeavyBoomerang extends MissileWeapon { new Callback() { @Override public void call() { - if (returnTarget == Dungeon.hero){ - if (boomerang.doPickUp(Dungeon.hero)) { + if (returnTarget == target){ + if (target instanceof Hero && boomerang.doPickUp((Hero) target)) { //grabbing the boomerang takes no time - Dungeon.hero.spend(-TIME_TO_PICK_UP); + ((Hero) target).spend(-TIME_TO_PICK_UP); } else { Dungeon.level.drop(boomerang, returnPos).sprite.drop(); } } else if (returnTarget != null){ - if (curUser.shoot( returnTarget, boomerang )) { + if (((Hero)target).shoot( returnTarget, boomerang )) { boomerang.decrementDurability(); } if (boomerang.durability > 0) { @@ -123,7 +125,7 @@ public class HeavyBoomerang extends MissileWeapon { }); visual.alpha(0f); float duration = Dungeon.level.trueDistance(thrownPos, returnPos) / 20f; - Dungeon.hero.sprite.parent.add(new AlphaTweener(visual, 1f, duration)); + target.sprite.parent.add(new AlphaTweener(visual, 1f, duration)); detach(); return false; }