Search in sources :

Example 21 with Mob

use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.

the class CavesBossLevel method press.

@Override
public void press(int cell, Char hero) {
    super.press(cell, hero);
    if (!enteredArena && outsideEntraceRoom(cell) && hero == Dungeon.hero) {
        enteredArena = true;
        seal();
        for (Mob m : mobs) {
            // bring the first ally with you
            if (m.alignment == Char.Alignment.ALLY) {
                m.pos = Dungeon.hero.pos + (Random.Int(2) == 0 ? +1 : -1);
                m.sprite.place(m.pos);
                break;
            }
        }
        DM300 boss = new DM300();
        boss.state = boss.WANDERING;
        do {
            boss.pos = Random.Int(length());
        } while (!passable[boss.pos] || !outsideEntraceRoom(boss.pos) || heroFOV[boss.pos]);
        GameScene.add(boss);
        set(arenaDoor, Terrain.WALL);
        GameScene.updateMap(arenaDoor);
        Dungeon.observe();
        CellEmitter.get(arenaDoor).start(Speck.factory(Speck.ROCK), 0.07f, 10);
        Camera.main.shake(3, 0.7f);
        Sample.INSTANCE.play(Assets.SND_ROCKS);
    }
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) DM300(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.DM300)

Example 22 with Mob

use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.

the class CityBossLevel method press.

@Override
public void press(int cell, Char hero) {
    super.press(cell, hero);
    if (!enteredArena && outsideEntraceRoom(cell) && hero == Dungeon.hero) {
        enteredArena = true;
        seal();
        for (Mob m : mobs) {
            // bring the first ally with you
            if (m.alignment == Char.Alignment.ALLY) {
                m.pos = Dungeon.hero.pos + (Random.Int(2) == 0 ? +1 : -1);
                m.sprite.place(m.pos);
                break;
            }
        }
        King boss = new King();
        boss.state = boss.WANDERING;
        int count = 0;
        do {
            boss.pos = Random.Int(length());
        } while (!passable[boss.pos] || !outsideEntraceRoom(boss.pos) || (heroFOV[boss.pos] && count++ < 20));
        GameScene.add(boss);
        if (heroFOV[boss.pos]) {
            boss.notice();
            boss.sprite.alpha(0);
            boss.sprite.parent.add(new AlphaTweener(boss.sprite, 1, 0.1f));
        }
        set(arenaDoor, Terrain.LOCKED_DOOR);
        GameScene.updateMap(arenaDoor);
        Dungeon.observe();
    }
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) King(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.King) AlphaTweener(com.watabou.noosa.tweeners.AlphaTweener)

Example 23 with Mob

use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob 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)

Example 24 with Mob

use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.

the class MageArmor method doSpecial.

@Override
public void doSpecial() {
    for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
        if (Dungeon.level.heroFOV[mob.pos]) {
            Buff.affect(mob, Burning.class).reignite(mob);
            Buff.prolong(mob, Roots.class, 3);
        }
    }
    curUser.HP -= (curUser.HP / 3);
    curUser.spend(Actor.TICK);
    curUser.sprite.operate(curUser.pos);
    curUser.busy();
    curUser.sprite.centerEmitter().start(ElmoParticle.FACTORY, 0.15f, 4);
    Sample.INSTANCE.play(Assets.SND_READ);
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Burning(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning)

Example 25 with Mob

use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Multiplicity method proc.

@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
    if (Random.Int(20) == 0) {
        ArrayList<Integer> spawnPoints = new ArrayList<>();
        for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
            int p = defender.pos + PathFinder.NEIGHBOURS8[i];
            if (Actor.findChar(p) == null && (Dungeon.level.passable[p] || Dungeon.level.avoid[p])) {
                spawnPoints.add(p);
            }
        }
        if (spawnPoints.size() > 0) {
            Mob m = null;
            if (Random.Int(2) == 0 && defender instanceof Hero) {
                m = new MirrorImage();
                ((MirrorImage) m).duplicate((Hero) defender);
            } else {
                // FIXME should probably have a mob property for this
                if (attacker.properties().contains(Char.Property.BOSS) || attacker.properties().contains(Char.Property.MINIBOSS) || attacker instanceof Mimic || attacker instanceof Statue) {
                    m = Dungeon.level.createMob();
                } else {
                    try {
                        Actor.fixTime();
                        m = (Mob) attacker.getClass().newInstance();
                        Bundle store = new Bundle();
                        attacker.storeInBundle(store);
                        m.restoreFromBundle(store);
                        m.HP = m.HT;
                        // If a thief has stolen an item, that item is not duplicated.
                        if (m instanceof Thief) {
                            ((Thief) m).item = null;
                        }
                    } catch (Exception e) {
                        ShatteredPixelDungeon.reportException(e);
                        m = null;
                    }
                }
            }
            if (m != null) {
                GameScene.add(m);
                ScrollOfTeleportation.appear(m, Random.element(spawnPoints));
            }
        }
    }
    return damage;
}
Also used : MirrorImage(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.MirrorImage) Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Mimic(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic) Statue(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue) Bundle(com.watabou.utils.Bundle) Thief(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief) ArrayList(java.util.ArrayList) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)

Aggregations

Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)49 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)13 Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)11 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)9 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)7 ArrayList (java.util.ArrayList)6 Plant (com.shatteredpixel.shatteredpixeldungeon.plants.Plant)4 Blob (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob)3 Mimic (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic)3 Trap (com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap)3 CustomTiledVisual (com.shatteredpixel.shatteredpixeldungeon.tiles.CustomTiledVisual)3 Point (com.watabou.utils.Point)3 Awareness (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness)2 Buff (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff)2 Burning (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning)2 MindVision (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision)2 Terror (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror)2 King (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.King)2 Statue (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue)2 Flare (com.shatteredpixel.shatteredpixeldungeon.effects.Flare)2