Search in sources :

Example 11 with Mob

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

the class AlarmTrap method trigger.

// 0xDD3333
public static void trigger(int pos, Char ch) {
    for (Mob mob : Dungeon.level.mobs) {
        if (mob != ch) {
            mob.beckon(pos);
        }
    }
    if (Dungeon.visible[pos]) {
        GLog.w("The trap emits a piercing sound that echoes throughout the dungeon!");
        CellEmitter.center(pos).start(Speck.factory(Speck.SCREAM), 0.3f, 3);
    }
    Sample.INSTANCE.play(Assets.SND_ALERT);
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob)

Example 12 with Mob

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

the class Hero method handle.

public boolean handle(int cell) {
    if (cell == -1) {
        return false;
    }
    Char ch;
    Heap heap;
    if (Dungeon.level.map[cell] == Terrain.ALCHEMY && cell != pos) {
        curAction = new HeroAction.Cook(cell);
    } else if (Level.fieldOfView[cell] && (ch = Actor.findChar(cell)) instanceof Mob) {
        if (ch instanceof NPC) {
            curAction = new HeroAction.Interact((NPC) ch);
        } else {
            curAction = new HeroAction.Attack(ch);
        }
    } else if (Level.fieldOfView[cell] && (heap = Dungeon.level.heaps.get(cell)) != null && heap.type != Heap.Type.HIDDEN) {
        switch(heap.type) {
            case HEAP:
                curAction = new HeroAction.PickUp(cell);
                break;
            case FOR_SALE:
                curAction = heap.size() == 1 && heap.peek().price() > 0 ? new HeroAction.Buy(cell) : new HeroAction.PickUp(cell);
                break;
            default:
                curAction = new HeroAction.OpenChest(cell);
        }
    } else if (Dungeon.level.map[cell] == Terrain.LOCKED_DOOR || Dungeon.level.map[cell] == Terrain.LOCKED_EXIT) {
        curAction = new HeroAction.Unlock(cell);
    } else if (cell == Dungeon.level.exit) {
        curAction = new HeroAction.Descend(cell);
    } else if (cell == Dungeon.level.entrance) {
        curAction = new HeroAction.Ascend(cell);
    } else {
        curAction = new HeroAction.Move(cell);
        lastAction = null;
    }
    return act();
}
Also used : NPC(com.watabou.pixeldungeon.actors.mobs.npcs.NPC) Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Heap(com.watabou.pixeldungeon.items.Heap) Char(com.watabou.pixeldungeon.actors.Char)

Example 13 with Mob

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

the class SacrificialFire method sacrifice.

public static void sacrifice(Char ch) {
    Wound.hit(ch);
    SacrificialFire fire = (SacrificialFire) Dungeon.level.blobs.get(SacrificialFire.class);
    if (fire != null) {
        int exp = 0;
        if (ch instanceof Mob) {
            exp = ((Mob) ch).exp() * Random.IntRange(1, 3);
        } else if (ch instanceof Hero) {
            exp = ((Hero) ch).maxExp();
        }
        if (exp > 0) {
            int volume = fire.volume - exp;
            if (volume > 0) {
                fire.seed(fire.pos, volume);
                GLog.w(TXT_WORTHY);
            } else {
                fire.seed(fire.pos, 0);
                Journal.remove(Feature.SACRIFICIAL_FIRE);
                GLog.w(TXT_REWARD);
                GameScene.effect(new Flare(7, 32).color(0x66FFFF, true).show(ch.sprite.parent, DungeonTilemap.tileCenterToWorld(fire.pos), 2f));
                Dungeon.level.drop(new ScrollOfWipeOut(), fire.pos).sprite.drop();
            }
        } else {
            GLog.w(TXT_UNWORTHY);
        }
    }
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Flare(com.watabou.pixeldungeon.effects.Flare) Hero(com.watabou.pixeldungeon.actors.hero.Hero) ScrollOfWipeOut(com.watabou.pixeldungeon.items.scrolls.ScrollOfWipeOut)

Example 14 with Mob

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

the class Hero method checkVisibleMobs.

private void checkVisibleMobs() {
    ArrayList<Mob> visible = new ArrayList<Mob>();
    boolean newMob = false;
    for (Mob m : Dungeon.level.mobs) {
        if (Level.fieldOfView[m.pos] && m.hostile) {
            visible.add(m);
            if (!visibleEnemies.contains(m)) {
                newMob = true;
            }
        }
    }
    if (newMob) {
        interrupt();
        restoreHealth = false;
    }
    visibleEnemies = visible;
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) ArrayList(java.util.ArrayList)

Example 15 with Mob

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

the class Actor method init.

public static void init() {
    addDelayed(Dungeon.hero, -Float.MIN_VALUE);
    for (Mob mob : Dungeon.level.mobs) {
        add(mob);
    }
    for (Blob blob : Dungeon.level.blobs.values()) {
        add(blob);
    }
    current = null;
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Blob(com.watabou.pixeldungeon.actors.blobs.Blob)

Aggregations

Mob (com.watabou.pixeldungeon.actors.mobs.Mob)29 Heap (com.watabou.pixeldungeon.items.Heap)6 Blob (com.watabou.pixeldungeon.actors.blobs.Blob)4 Flare (com.watabou.pixeldungeon.effects.Flare)3 Plant (com.watabou.pixeldungeon.plants.Plant)3 Char (com.watabou.pixeldungeon.actors.Char)2 HeroClass (com.watabou.pixeldungeon.actors.hero.HeroClass)2 Item (com.watabou.pixeldungeon.items.Item)2 HeroSprite (com.watabou.pixeldungeon.sprites.HeroSprite)2 Point (com.watabou.utils.Point)2 ArrayList (java.util.ArrayList)2 Group (com.watabou.noosa.Group)1 SkinnedBlock (com.watabou.noosa.SkinnedBlock)1 AlphaTweener (com.watabou.noosa.tweeners.AlphaTweener)1 DungeonTilemap (com.watabou.pixeldungeon.DungeonTilemap)1 FogOfWar (com.watabou.pixeldungeon.FogOfWar)1 Actor (com.watabou.pixeldungeon.actors.Actor)1 Awareness (com.watabou.pixeldungeon.actors.buffs.Awareness)1 Blindness (com.watabou.pixeldungeon.actors.buffs.Blindness)1 Buff (com.watabou.pixeldungeon.actors.buffs.Buff)1