Search in sources :

Example 1 with Mob

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

the class Level method create.

public void create() {
    resizingNeeded = false;
    map = new int[LENGTH];
    visited = new boolean[LENGTH];
    Arrays.fill(visited, false);
    mapped = new boolean[LENGTH];
    Arrays.fill(mapped, false);
    mobs = new HashSet<Mob>();
    heaps = new SparseArray<Heap>();
    blobs = new HashMap<Class<? extends Blob>, Blob>();
    plants = new SparseArray<Plant>();
    if (!Dungeon.bossLevel()) {
        addItemToSpawn(Generator.random(Generator.Category.FOOD));
        if (Dungeon.posNeeded()) {
            addItemToSpawn(new PotionOfStrength());
            Dungeon.potionOfStrength++;
        }
        if (Dungeon.souNeeded()) {
            addItemToSpawn(new ScrollOfUpgrade());
            Dungeon.scrollsOfUpgrade++;
        }
        if (Dungeon.soeNeeded()) {
            addItemToSpawn(new ScrollOfEnchantment());
            Dungeon.scrollsOfEnchantment++;
        }
        if (Dungeon.depth > 1) {
            switch(Random.Int(10)) {
                case 0:
                    if (!Dungeon.bossLevel(Dungeon.depth + 1)) {
                        feeling = Feeling.CHASM;
                    }
                    break;
                case 1:
                    feeling = Feeling.WATER;
                    break;
                case 2:
                    feeling = Feeling.GRASS;
                    break;
            }
        }
    }
    boolean pitNeeded = Dungeon.depth > 1 && weakFloorCreated;
    do {
        Arrays.fill(map, feeling == Feeling.CHASM ? Terrain.CHASM : Terrain.WALL);
        pitRoomNeeded = pitNeeded;
        weakFloorCreated = false;
    } while (!build());
    decorate();
    buildFlagMaps();
    cleanWalls();
    createMobs();
    createItems();
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Blob(com.watabou.pixeldungeon.actors.blobs.Blob) ScrollOfEnchantment(com.watabou.pixeldungeon.items.scrolls.ScrollOfEnchantment) PotionOfStrength(com.watabou.pixeldungeon.items.potions.PotionOfStrength) Heap(com.watabou.pixeldungeon.items.Heap) Plant(com.watabou.pixeldungeon.plants.Plant) HeroClass(com.watabou.pixeldungeon.actors.hero.HeroClass) ScrollOfUpgrade(com.watabou.pixeldungeon.items.scrolls.ScrollOfUpgrade)

Example 2 with Mob

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

the class PrisonBossLevel method press.

@Override
public void press(int cell, Char ch) {
    super.press(cell, ch);
    if (ch == Dungeon.hero && !enteredArena && roomExit.inside(cell)) {
        enteredArena = true;
        int pos;
        do {
            pos = roomExit.random();
        } while (pos == cell || Actor.findChar(pos) != null);
        Mob boss = Bestiary.mob(Dungeon.depth);
        boss.state = boss.HUNTING;
        boss.pos = pos;
        GameScene.add(boss);
        boss.notice();
        mobPress(boss);
        set(arenaDoor, Terrain.LOCKED_DOOR);
        GameScene.updateMap(arenaDoor);
        Dungeon.observe();
    }
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Point(com.watabou.utils.Point)

Example 3 with Mob

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

the class HuntressArmor method doSpecial.

@Override
public void doSpecial() {
    Item proto = new Shuriken();
    for (Mob mob : Dungeon.level.mobs) {
        if (Level.fieldOfView[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(TXT_NO_ENEMIES);
        return;
    }
    curUser.HP -= (curUser.HP / 3);
    curUser.sprite.zap(curUser.pos);
    curUser.busy();
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Callback(com.watabou.utils.Callback) Shuriken(com.watabou.pixeldungeon.items.weapon.missiles.Shuriken) MissileSprite(com.watabou.pixeldungeon.sprites.MissileSprite)

Example 4 with Mob

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

the class Bounce method proc.

@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
    int level = Math.max(0, armor.effectiveLevel());
    if (Level.adjacent(attacker.pos, defender.pos) && Random.Int(level + 5) >= 4) {
        for (int i = 0; i < Level.NEIGHBOURS8.length; i++) {
            int ofs = Level.NEIGHBOURS8[i];
            if (attacker.pos - defender.pos == ofs) {
                int newPos = attacker.pos + ofs;
                if ((Level.passable[newPos] || Level.avoid[newPos]) && Actor.findChar(newPos) == null) {
                    Actor.addDelayed(new Pushing(attacker, attacker.pos, newPos), -1);
                    attacker.pos = newPos;
                    // FIXME
                    if (attacker instanceof Mob) {
                        Dungeon.level.mobPress((Mob) attacker);
                    } else {
                        Dungeon.level.press(newPos, attacker);
                    }
                }
                break;
            }
        }
    }
    return damage;
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Pushing(com.watabou.pixeldungeon.effects.Pushing)

Example 5 with Mob

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

the class ScrollOfChallenge method doRead.

@Override
protected void doRead() {
    for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
        mob.beckon(curUser.pos);
        if (Dungeon.visible[mob.pos]) {
            Buff.affect(mob, Rage.class, Level.distance(curUser.pos, mob.pos));
        }
    }
    for (Heap heap : Dungeon.level.heaps.values()) {
        if (heap.type == Heap.Type.MIMIC) {
            Mimic m = Mimic.spawnAt(heap.pos, heap.items);
            if (m != null) {
                m.beckon(curUser.pos);
                heap.destroy();
            }
        }
    }
    GLog.w("The scroll emits a challenging roar that echoes throughout the dungeon!");
    setKnown();
    curUser.sprite.centerEmitter().start(Speck.factory(Speck.SCREAM), 0.3f, 3);
    Sample.INSTANCE.play(Assets.SND_CHALLENGE);
    Invisibility.dispel();
    readAnimation();
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Mimic(com.watabou.pixeldungeon.actors.mobs.Mimic) Heap(com.watabou.pixeldungeon.items.Heap)

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