Search in sources :

Example 1 with MissileSprite

use of com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Item method cast.

public void cast(final Hero user, final int dst) {
    final int cell = throwPos(user, dst);
    user.sprite.zap(cell);
    user.busy();
    Sample.INSTANCE.play(Assets.SND_MISS, 0.6f, 0.6f, 1.5f);
    Char enemy = Actor.findChar(cell);
    QuickSlotButton.target(enemy);
    final float delay = castDelay(user, dst);
    if (enemy != null) {
        ((MissileSprite) user.sprite.parent.recycle(MissileSprite.class)).reset(user.sprite, enemy.sprite, this, new Callback() {

            @Override
            public void call() {
                Item.this.detach(user.belongings.backpack).onThrow(cell);
                user.spendAndNext(delay);
            }
        });
    } else {
        ((MissileSprite) user.sprite.parent.recycle(MissileSprite.class)).reset(user.sprite, cell, this, new Callback() {

            @Override
            public void call() {
                Item.this.detach(user.belongings.backpack).onThrow(cell);
                user.spendAndNext(delay);
            }
        });
    }
}
Also used : Callback(com.watabou.utils.Callback) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) MissileSprite(com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite)

Example 2 with MissileSprite

use of com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite in project shattered-pixel-dungeon-gdx by 00-Evan.

the class HuntressArmor method doSpecial.

@Override
public void doSpecial() {
    Item proto = new Shuriken();
    for (Mob mob : Dungeon.level.mobs) {
        if (Dungeon.level.heroFOV[mob.pos]) {
            Callback callback = new Callback() {

                @Override
                public void call() {
                    curUser.attack(targets.get(this));
                    targets.remove(this);
                    if (targets.isEmpty()) {
                        curUser.spendAndNext(curUser.attackDelay());
                    }
                }
            };
            ((MissileSprite) curUser.sprite.parent.recycle(MissileSprite.class)).reset(curUser.pos, mob.pos, proto, callback);
            targets.put(callback, mob);
        }
    }
    if (targets.size() == 0) {
        GLog.w(Messages.get(this, "no_enemies"));
        return;
    }
    curUser.HP -= (curUser.HP / 3);
    curUser.sprite.zap(curUser.pos);
    curUser.busy();
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Callback(com.watabou.utils.Callback) Shuriken(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken) MissileSprite(com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite)

Aggregations

MissileSprite (com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite)2 Callback (com.watabou.utils.Callback)2 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)1 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)1 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)1 Shuriken (com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken)1