Search in sources :

Example 36 with Mob

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

the class ImpShopRoom method placeShopkeeper.

@Override
protected void placeShopkeeper(Level level) {
    int pos = level.pointToCell(center());
    Mob shopkeeper = new ImpShopkeeper();
    shopkeeper.pos = pos;
    level.mobs.add(shopkeeper);
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) ImpShopkeeper(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.ImpShopkeeper)

Example 37 with Mob

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

the class FlashingTrap method activate.

@Override
public void activate() {
    Char c = Actor.findChar(pos);
    if (c != null) {
        int damage = Math.max(0, (4 + Dungeon.depth) - c.drRoll());
        Buff.affect(c, Bleeding.class).set(damage);
        Buff.prolong(c, Blindness.class, 10f);
        Buff.prolong(c, Cripple.class, 20f);
        if (c instanceof Mob) {
            if (((Mob) c).state == ((Mob) c).HUNTING)
                ((Mob) c).state = ((Mob) c).WANDERING;
            ((Mob) c).beckon(Dungeon.level.randomDestination());
        }
    }
    if (Dungeon.level.heroFOV[pos]) {
        GameScene.flash(0xFFFFFF);
        Sample.INSTANCE.play(Assets.SND_BLAST);
    }
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Bleeding(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding)

Example 38 with Mob

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

the class GuardianTrap method activate.

@Override
public void activate() {
    for (Mob mob : Dungeon.level.mobs) {
        mob.beckon(pos);
    }
    if (Dungeon.level.heroFOV[pos]) {
        GLog.w(Messages.get(this, "alarm"));
        CellEmitter.center(pos).start(Speck.factory(Speck.SCREAM), 0.3f, 3);
    }
    Sample.INSTANCE.play(Assets.SND_ALERT);
    for (int i = 0; i < (Dungeon.depth - 5) / 5; i++) {
        Guardian guardian = new Guardian();
        guardian.state = guardian.WANDERING;
        guardian.pos = Dungeon.level.randomRespawnCell();
        GameScene.add(guardian);
        guardian.beckon(Dungeon.hero.pos);
    }
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)

Example 39 with Mob

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

the class CursedWand method commonEffect.

private static void commonEffect(final Wand wand, final Hero user, final Ballistica bolt) {
    switch(Random.Int(4)) {
        // anti-entropy
        case 0:
            cursedFX(user, bolt, new Callback() {

                public void call() {
                    Char target = Actor.findChar(bolt.collisionPos);
                    switch(Random.Int(2)) {
                        case 0:
                            if (target != null)
                                Buff.affect(target, Burning.class).reignite(target);
                            Buff.affect(user, Frost.class, Frost.duration(user) * Random.Float(3f, 5f));
                            break;
                        case 1:
                            Buff.affect(user, Burning.class).reignite(user);
                            if (target != null)
                                Buff.affect(target, Frost.class, Frost.duration(target) * Random.Float(3f, 5f));
                            break;
                    }
                    wand.wandUsed();
                }
            });
            break;
        // spawns some regrowth
        case 1:
            cursedFX(user, bolt, new Callback() {

                public void call() {
                    int c = Dungeon.level.map[bolt.collisionPos];
                    if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO || c == Terrain.GRASS || c == Terrain.HIGH_GRASS) {
                        GameScene.add(Blob.seed(bolt.collisionPos, 30, Regrowth.class));
                    }
                    wand.wandUsed();
                }
            });
            break;
        // random teleportation
        case 2:
            switch(Random.Int(2)) {
                case 0:
                    ScrollOfTeleportation.teleportHero(user);
                    wand.wandUsed();
                    break;
                case 1:
                    cursedFX(user, bolt, new Callback() {

                        public void call() {
                            Char ch = Actor.findChar(bolt.collisionPos);
                            if (ch == user) {
                                ScrollOfTeleportation.teleportHero(user);
                                wand.wandUsed();
                            } else if (ch != null && !ch.properties().contains(Char.Property.IMMOVABLE)) {
                                int count = 10;
                                int pos;
                                do {
                                    pos = Dungeon.level.randomRespawnCell();
                                    if (count-- <= 0) {
                                        break;
                                    }
                                } while (pos == -1);
                                if (pos == -1 || Dungeon.bossLevel()) {
                                    GLog.w(Messages.get(ScrollOfTeleportation.class, "no_tele"));
                                } else {
                                    ch.pos = pos;
                                    if (((Mob) ch).state == ((Mob) ch).HUNTING)
                                        ((Mob) ch).state = ((Mob) ch).WANDERING;
                                    ch.sprite.place(ch.pos);
                                    ch.sprite.visible = Dungeon.level.heroFOV[pos];
                                }
                            }
                            wand.wandUsed();
                        }
                    });
                    break;
            }
            break;
        // random gas at location
        case 3:
            cursedFX(user, bolt, new Callback() {

                public void call() {
                    switch(Random.Int(3)) {
                        case 0:
                            GameScene.add(Blob.seed(bolt.collisionPos, 800, ConfusionGas.class));
                            break;
                        case 1:
                            GameScene.add(Blob.seed(bolt.collisionPos, 500, ToxicGas.class));
                            break;
                        case 2:
                            GameScene.add(Blob.seed(bolt.collisionPos, 200, ParalyticGas.class));
                            break;
                    }
                    wand.wandUsed();
                }
            });
            break;
    }
}
Also used : ScrollOfTeleportation(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation) Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Callback(com.watabou.utils.Callback) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Frost(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost) Burning(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning)

Example 40 with Mob

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

the class WandOfCorruption method onZap.

@Override
protected void onZap(Ballistica bolt) {
    Char ch = Actor.findChar(bolt.collisionPos);
    if (ch != null) {
        if (!(ch instanceof Mob)) {
            return;
        }
        Mob enemy = (Mob) ch;
        float corruptingPower = 2 + level();
        // base enemy resistance is usually based on their exp, but in special cases it is based on other criteria
        float enemyResist = 1 + enemy.EXP;
        if (ch instanceof Mimic || ch instanceof Statue) {
            enemyResist = 1 + Dungeon.depth;
        } else if (ch instanceof Piranha || ch instanceof Bee) {
            enemyResist = 1 + Dungeon.depth / 2f;
        } else if (ch instanceof Wraith) {
            // this is so low because wraiths are always at max hp
            enemyResist = 0.5f + Dungeon.depth / 8f;
        } else if (ch instanceof Yog.BurningFist || ch instanceof Yog.RottingFist) {
            enemyResist = 1 + 30;
        } else if (ch instanceof Yog.Larva || ch instanceof King.Undead) {
            enemyResist = 1 + 5;
        } else if (ch instanceof Swarm) {
            // child swarms don't give exp, so we force this here.
            enemyResist = 1 + 3;
        }
        // 100% health: 3x resist   75%: 2.1x resist   50%: 1.5x resist   25%: 1.1x resist
        enemyResist *= 1 + 2 * Math.pow(enemy.HP / (float) enemy.HT, 2);
        // debuffs placed on the enemy reduce their resistance
        for (Buff buff : enemy.buffs()) {
            if (MAJOR_DEBUFFS.containsKey(buff.getClass()))
                enemyResist *= MAJOR_DEBUFF_WEAKEN;
            else if (MINOR_DEBUFFS.containsKey(buff.getClass()))
                enemyResist *= MINOR_DEBUFF_WEAKEN;
            else if (buff.type == Buff.buffType.NEGATIVE)
                enemyResist *= MINOR_DEBUFF_WEAKEN;
        }
        // cannot re-corrupt or doom an enemy, so give them a major debuff instead
        if (enemy.buff(Corruption.class) != null || enemy.buff(Doom.class) != null) {
            enemyResist = corruptingPower * .99f;
        }
        if (corruptingPower > enemyResist) {
            corruptEnemy(enemy);
        } else {
            float debuffChance = corruptingPower / enemyResist;
            if (Random.Float() < debuffChance) {
                debuffEnemy(enemy, MAJOR_DEBUFFS);
            } else {
                debuffEnemy(enemy, MINOR_DEBUFFS);
            }
        }
        processSoulMark(ch, chargesPerCast());
    } else {
        Dungeon.level.press(bolt.collisionPos, null, true);
    }
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Bee(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bee) Mimic(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic) Piranha(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Piranha) FlavourBuff(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff) Buff(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff) Yog(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Yog) Swarm(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Swarm) King(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.King) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Statue(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue) Wraith(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Wraith)

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