Search in sources :

Example 1 with MirrorImage

use of com.watabou.pixeldungeon.actors.mobs.npcs.MirrorImage in project pixel-dungeon by watabou.

the class ScrollOfMirrorImage method doRead.

@Override
protected void doRead() {
    ArrayList<Integer> respawnPoints = new ArrayList<Integer>();
    for (int i = 0; i < Level.NEIGHBOURS8.length; i++) {
        int p = curUser.pos + Level.NEIGHBOURS8[i];
        if (Actor.findChar(p) == null && (Level.passable[p] || Level.avoid[p])) {
            respawnPoints.add(p);
        }
    }
    int nImages = NIMAGES;
    while (nImages > 0 && respawnPoints.size() > 0) {
        int index = Random.index(respawnPoints);
        MirrorImage mob = new MirrorImage();
        mob.duplicate(curUser);
        GameScene.add(mob);
        WandOfBlink.appear(mob, respawnPoints.get(index));
        respawnPoints.remove(index);
        nImages--;
    }
    if (nImages < NIMAGES) {
        setKnown();
    }
    Sample.INSTANCE.play(Assets.SND_READ);
    Invisibility.dispel();
    readAnimation();
}
Also used : MirrorImage(com.watabou.pixeldungeon.actors.mobs.npcs.MirrorImage) ArrayList(java.util.ArrayList)

Example 2 with MirrorImage

use of com.watabou.pixeldungeon.actors.mobs.npcs.MirrorImage in project pixel-dungeon-remix by NYRDS.

the class ScrollOfMirrorImage method doRead.

@Override
protected void doRead() {
    int nImages = NIMAGES;
    while (nImages > 0) {
        int cell = Dungeon.level.getEmptyCellNextTo(getCurUser().getPos());
        if (!Dungeon.level.cellValid(cell))
            break;
        MirrorImage mob = new MirrorImage(getCurUser());
        Dungeon.level.spawnMob(mob);
        WandOfBlink.appear(mob, cell);
        nImages--;
    }
    if (nImages < NIMAGES) {
        setKnown();
    }
    Sample.INSTANCE.play(Assets.SND_READ);
    Invisibility.dispel(getCurUser());
    getCurUser().spendAndNext(TIME_TO_READ);
}
Also used : MirrorImage(com.watabou.pixeldungeon.actors.mobs.npcs.MirrorImage)

Example 3 with MirrorImage

use of com.watabou.pixeldungeon.actors.mobs.npcs.MirrorImage in project pixel-dungeon-remix by NYRDS.

the class Multiplicity method proc.

@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
    int level = Math.max(0, armor.level());
    if (Random.Int(level / 2 + 6) >= 5) {
        int imgCell = Dungeon.level.getEmptyCellNextTo(defender.getPos());
        if (Dungeon.level.cellValid(imgCell)) {
            if (defender instanceof Hero) {
                MirrorImage img = new MirrorImage((Hero) defender);
                Dungeon.level.spawnMob(img);
                WandOfBlink.appear(img, imgCell);
            }
            if (defender instanceof Mob) {
                ((Mob) defender).split(imgCell, damage);
            }
            defender.damage(Random.IntRange(1, defender.ht() / 6), /*attacker*/
            this);
            checkOwner(defender);
        }
    }
    return damage;
}
Also used : MirrorImage(com.watabou.pixeldungeon.actors.mobs.npcs.MirrorImage) Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Hero(com.watabou.pixeldungeon.actors.hero.Hero)

Example 4 with MirrorImage

use of com.watabou.pixeldungeon.actors.mobs.npcs.MirrorImage in project pixel-dungeon by watabou.

the class Multiplicity method proc.

@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
    int level = Math.max(0, armor.effectiveLevel());
    if (Random.Int(level / 2 + 6) >= 5) {
        ArrayList<Integer> respawnPoints = new ArrayList<Integer>();
        for (int i = 0; i < Level.NEIGHBOURS8.length; i++) {
            int p = defender.pos + Level.NEIGHBOURS8[i];
            if (Actor.findChar(p) == null && (Level.passable[p] || Level.avoid[p])) {
                respawnPoints.add(p);
            }
        }
        if (respawnPoints.size() > 0) {
            MirrorImage mob = new MirrorImage();
            mob.duplicate((Hero) defender);
            GameScene.add(mob);
            WandOfBlink.appear(mob, Random.element(respawnPoints));
            defender.damage(Random.IntRange(1, defender.HT / 6), this);
            checkOwner(defender);
        }
    }
    return damage;
}
Also used : MirrorImage(com.watabou.pixeldungeon.actors.mobs.npcs.MirrorImage) ArrayList(java.util.ArrayList)

Aggregations

MirrorImage (com.watabou.pixeldungeon.actors.mobs.npcs.MirrorImage)4 ArrayList (java.util.ArrayList)2 Hero (com.watabou.pixeldungeon.actors.hero.Hero)1 Mob (com.watabou.pixeldungeon.actors.mobs.Mob)1