use of com.watabou.pixeldungeon.actors.buffs.SnipersMark in project pixel-dungeon by watabou.
the class Item method cast.
public void cast(final Hero user, int dst) {
final int cell = Ballistica.cast(user.pos, dst, false, true);
user.sprite.zap(cell);
user.busy();
Sample.INSTANCE.play(Assets.SND_MISS, 0.6f, 0.6f, 1.5f);
Char enemy = Actor.findChar(cell);
QuickSlot.target(this, enemy);
// FIXME!!!
float delay = TIME_TO_THROW;
if (this instanceof MissileWeapon) {
delay *= ((MissileWeapon) this).speedFactor(user);
if (enemy != null) {
SnipersMark mark = user.buff(SnipersMark.class);
if (mark != null) {
if (mark.object == enemy.id()) {
delay *= 0.5f;
}
user.remove(mark);
}
}
}
final float finalDelay = delay;
((MissileSprite) user.sprite.parent.recycle(MissileSprite.class)).reset(user.pos, cell, this, new Callback() {
@Override
public void call() {
Item.this.detach(user.belongings.backpack).onThrow(cell);
user.spendAndNext(finalDelay);
}
});
}
Aggregations