v0.7.5: fixed boomerang circle back buff incorrectly using curUser

This commit is contained in:
Evan Debenham 2019-09-09 21:10:57 -04:00
parent 6d6900687f
commit 331c05420d

View File

@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; 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.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite;
import com.watabou.noosa.tweeners.AlphaTweener; import com.watabou.noosa.tweeners.AlphaTweener;
@ -92,6 +93,7 @@ public class HeavyBoomerang extends MissileWeapon {
left--; left--;
if (left <= 0){ if (left <= 0){
final Char returnTarget = Actor.findChar(returnPos); final Char returnTarget = Actor.findChar(returnPos);
final Char target = this.target;
MissileSprite visual = ((MissileSprite) Dungeon.hero.sprite.parent.recycle(MissileSprite.class)); MissileSprite visual = ((MissileSprite) Dungeon.hero.sprite.parent.recycle(MissileSprite.class));
visual.reset( thrownPos, visual.reset( thrownPos,
returnPos, returnPos,
@ -99,16 +101,16 @@ public class HeavyBoomerang extends MissileWeapon {
new Callback() { new Callback() {
@Override @Override
public void call() { public void call() {
if (returnTarget == Dungeon.hero){ if (returnTarget == target){
if (boomerang.doPickUp(Dungeon.hero)) { if (target instanceof Hero && boomerang.doPickUp((Hero) target)) {
//grabbing the boomerang takes no time //grabbing the boomerang takes no time
Dungeon.hero.spend(-TIME_TO_PICK_UP); ((Hero) target).spend(-TIME_TO_PICK_UP);
} else { } else {
Dungeon.level.drop(boomerang, returnPos).sprite.drop(); Dungeon.level.drop(boomerang, returnPos).sprite.drop();
} }
} else if (returnTarget != null){ } else if (returnTarget != null){
if (curUser.shoot( returnTarget, boomerang )) { if (((Hero)target).shoot( returnTarget, boomerang )) {
boomerang.decrementDurability(); boomerang.decrementDurability();
} }
if (boomerang.durability > 0) { if (boomerang.durability > 0) {
@ -123,7 +125,7 @@ public class HeavyBoomerang extends MissileWeapon {
}); });
visual.alpha(0f); visual.alpha(0f);
float duration = Dungeon.level.trueDistance(thrownPos, returnPos) / 20f; 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(); detach();
return false; return false;
} }