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.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;
}