Search in sources :

Example 1 with Mob

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

the class WandOfTransfusion method onZap.

@Override
protected void onZap(Ballistica beam) {
    for (int c : beam.subPath(0, beam.dist)) CellEmitter.center(c).burst(BloodParticle.BURST, 1);
    int cell = beam.collisionPos;
    Char ch = Actor.findChar(cell);
    Heap heap = Dungeon.level.heaps.get(cell);
    // if we find a character..
    if (ch != null && ch instanceof Mob) {
        processSoulMark(ch, chargesPerCast());
        // heals an ally, or a charmed enemy
        if (ch.alignment == Char.Alignment.ALLY || ch.buff(Charm.class) != null) {
            int missingHP = ch.HT - ch.HP;
            // heals 30%+3%*lvl missing HP.
            int healing = (int) Math.ceil((missingHP * (0.30f + (0.03f * level()))));
            ch.HP += healing;
            ch.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1 + level() / 2);
            ch.sprite.showStatus(CharSprite.POSITIVE, "+%dHP", healing);
        // harms the undead
        } else if (ch.properties().contains(Char.Property.UNDEAD)) {
            // deals 30%+5%*lvl total HP.
            int damage = (int) Math.ceil(ch.HT * (0.3f + (0.05f * level())));
            ch.damage(damage, this);
            ch.sprite.emitter().start(ShadowParticle.UP, 0.05f, 10 + level());
            Sample.INSTANCE.play(Assets.SND_BURNING);
        // charms an enemy
        } else {
            float duration = 5 + level();
            Buff.affect(ch, Charm.class, duration).object = curUser.id();
            duration *= Random.Float(0.75f, 1f);
            Buff.affect(curUser, Charm.class, duration).object = ch.id();
            ch.sprite.centerEmitter().start(Speck.factory(Speck.HEART), 0.2f, 5);
            curUser.sprite.centerEmitter().start(Speck.factory(Speck.HEART), 0.2f, 5);
        }
    // if we find an item...
    } else if (heap != null && heap.type == Heap.Type.HEAP) {
        Item item = heap.peek();
        // 30% + 10%*lvl chance to uncurse the item and reset it to base level if degraded.
        if (item != null && Random.Float() <= 0.3f + level() * 0.1f) {
            if (item.cursed) {
                item.cursed = false;
                CellEmitter.get(cell).start(ShadowParticle.UP, 0.05f, 10);
                Sample.INSTANCE.play(Assets.SND_BURNING);
            }
            int lvldiffFromBase = item.level() - (item instanceof Ring ? 1 : 0);
            if (lvldiffFromBase < 0) {
                item.upgrade(-lvldiffFromBase);
                CellEmitter.get(cell).start(Speck.factory(Speck.UP), 0.2f, 3);
                Sample.INSTANCE.play(Assets.SND_BURNING);
            }
        }
    // if we find some trampled grass...
    } else if (Dungeon.level.map[cell] == Terrain.GRASS) {
        // regrow one grass tile, suuuuuper useful...
        Dungeon.level.set(cell, Terrain.HIGH_GRASS);
        GameScene.updateMap(cell);
        CellEmitter.get(cell).burst(LeafParticle.LEVEL_SPECIFIC, 4);
    // If we find embers...
    } else if (Dungeon.level.map[cell] == Terrain.EMBERS) {
        // 30% + 3%*lvl chance to grow a random plant, or just regrow grass.
        if (Random.Float() <= 0.3f + level() * 0.03f) {
            Dungeon.level.plant((Plant.Seed) Generator.random(Generator.Category.SEED), cell);
            CellEmitter.get(cell).burst(LeafParticle.LEVEL_SPECIFIC, 8);
            GameScene.updateMap(cell);
        } else {
            Dungeon.level.set(cell, Terrain.HIGH_GRASS);
            GameScene.updateMap(cell);
            CellEmitter.get(cell).burst(LeafParticle.LEVEL_SPECIFIC, 4);
        }
    } else
        // don't damage the hero if we can't find a target;
        return;
    if (!freeCharge) {
        damageHero();
    } else {
        freeCharge = false;
    }
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Ring(com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring) Charm(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Charm) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Example 2 with Mob

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

the class ScrollOfRage method empoweredRead.

@Override
public void empoweredRead() {
    for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
        if (Dungeon.level.heroFOV[mob.pos]) {
            Buff.prolong(mob, Amok.class, 5f);
        }
    }
    setKnown();
    curUser.sprite.centerEmitter().start(Speck.factory(Speck.SCREAM), 0.3f, 3);
    Sample.INSTANCE.play(Assets.SND_READ);
    Invisibility.dispel();
    readAnimation();
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)

Example 3 with Mob

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

the class ScrollOfLullaby method doRead.

@Override
public void doRead() {
    curUser.sprite.centerEmitter().start(Speck.factory(Speck.NOTE), 0.3f, 5);
    Sample.INSTANCE.play(Assets.SND_LULLABY);
    Invisibility.dispel();
    for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
        if (Dungeon.level.heroFOV[mob.pos]) {
            Buff.affect(mob, Drowsy.class);
            mob.sprite.centerEmitter().start(Speck.factory(Speck.NOTE), 0.3f, 5);
        }
    }
    Buff.affect(curUser, Drowsy.class);
    GLog.i(Messages.get(this, "sooth"));
    setKnown();
    readAnimation();
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)

Example 4 with Mob

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

the class ScrollOfPsionicBlast method doRead.

@Override
public void doRead() {
    GameScene.flash(0xFFFFFF);
    Sample.INSTANCE.play(Assets.SND_BLAST);
    Invisibility.dispel();
    for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
        if (Dungeon.level.heroFOV[mob.pos]) {
            mob.damage(mob.HP, this);
        }
    }
    curUser.damage(Math.max(curUser.HT / 5, curUser.HP / 2), this);
    if (curUser.isAlive()) {
        Buff.prolong(curUser, Paralysis.class, Random.Int(4, 6));
        Buff.prolong(curUser, Blindness.class, Random.Int(6, 9));
        Dungeon.observe();
    }
    setKnown();
    readAnimation();
    if (!curUser.isAlive()) {
        Dungeon.fail(getClass());
        GLog.n(Messages.get(this, "ondeath"));
    }
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)

Example 5 with Mob

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

the class ScrollOfTerror method empoweredRead.

@Override
public void empoweredRead() {
    doRead();
    for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
        if (Dungeon.level.heroFOV[mob.pos]) {
            Terror t = mob.buff(Terror.class);
            if (t != null) {
                Buff.prolong(mob, Terror.class, Terror.DURATION * 1.5f);
                Buff.affect(mob, Paralysis.class, Terror.DURATION * .5f);
            }
        }
    }
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Terror(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror)

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