Search in sources :

Example 6 with Char

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

the class Freezing method affect.

// Returns true, if this cell is visible
public static boolean affect(int cell, Fire fire) {
    Char ch = Actor.findChar(cell);
    if (ch != null) {
        Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(1.0f, 1.5f));
    }
    if (fire != null) {
        fire.clear(cell);
    }
    Heap heap = Dungeon.level.heaps.get(cell);
    if (heap != null) {
        heap.freeze();
    }
    if (Dungeon.visible[cell]) {
        CellEmitter.get(cell).start(SnowParticle.FACTORY, 0.2f, 6);
        return true;
    } else {
        return false;
    }
}
Also used : Char(com.watabou.pixeldungeon.actors.Char) Heap(com.watabou.pixeldungeon.items.Heap)

Example 7 with Char

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

the class Regrowth method evolve.

@Override
protected void evolve() {
    super.evolve();
    if (volume > 0) {
        boolean mapUpdated = false;
        for (int i = 0; i < LENGTH; i++) {
            if (off[i] > 0) {
                int c = Dungeon.level.map[i];
                int c1 = c;
                if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO) {
                    c1 = cur[i] > 9 ? Terrain.HIGH_GRASS : Terrain.GRASS;
                } else if (c == Terrain.GRASS && cur[i] > 9) {
                    c1 = Terrain.HIGH_GRASS;
                }
                if (c1 != c) {
                    Level.set(i, Terrain.HIGH_GRASS);
                    mapUpdated = true;
                    GameScene.updateMap(i);
                    if (Dungeon.visible[i]) {
                        GameScene.discoverTile(i, c);
                    }
                }
                Char ch = Actor.findChar(i);
                if (ch != null) {
                    Buff.prolong(ch, Roots.class, TICK);
                }
            }
        }
        if (mapUpdated) {
            Dungeon.observe();
        }
    }
}
Also used : Char(com.watabou.pixeldungeon.actors.Char)

Example 8 with Char

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

the class SacrificialFire method evolve.

@Override
protected void evolve() {
    volume = off[pos] = cur[pos];
    Char ch = Actor.findChar(pos);
    if (ch != null) {
        if (Dungeon.visible[pos] && ch.buff(Marked.class) == null) {
            ch.sprite.emitter().burst(SacrificialParticle.FACTORY, 20);
            Sample.INSTANCE.play(Assets.SND_BURNING);
        }
        Buff.prolong(ch, Marked.class, Marked.DURATION);
    }
    if (Dungeon.visible[pos]) {
        Journal.add(Feature.SACRIFICIAL_FIRE);
    }
}
Also used : Char(com.watabou.pixeldungeon.actors.Char)

Example 9 with Char

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

the class Eye method attack.

@Override
public boolean attack(Char enemy) {
    for (int i = 1; i < Ballistica.distance; i++) {
        int pos = Ballistica.trace[i];
        Char ch = Actor.findChar(pos);
        if (ch == null) {
            continue;
        }
        if (hit(this, ch, true)) {
            ch.damage(Random.NormalIntRange(14, 20), this);
            if (Dungeon.visible[pos]) {
                ch.sprite.flash();
                CellEmitter.center(pos).burst(PurpleParticle.BURST, Random.IntRange(1, 2));
            }
            if (!ch.isAlive() && ch == Dungeon.hero) {
                Dungeon.fail(Utils.format(ResultDescriptions.MOB, Utils.indefinite(name), Dungeon.depth));
                GLog.n(TXT_DEATHGAZE_KILLED, name);
            }
        } else {
            ch.sprite.showStatus(CharSprite.NEUTRAL, ch.defenseVerb());
        }
    }
    return true;
}
Also used : Char(com.watabou.pixeldungeon.actors.Char)

Example 10 with Char

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

the class Mimic method spawnAt.

public static Mimic spawnAt(int pos, List<Item> items) {
    Char ch = Actor.findChar(pos);
    if (ch != null) {
        ArrayList<Integer> candidates = new ArrayList<Integer>();
        for (int n : Level.NEIGHBOURS8) {
            int cell = pos + n;
            if ((Level.passable[cell] || Level.avoid[cell]) && Actor.findChar(cell) == null) {
                candidates.add(cell);
            }
        }
        if (candidates.size() > 0) {
            int newPos = Random.element(candidates);
            Actor.addDelayed(new Pushing(ch, ch.pos, newPos), -1);
            ch.pos = newPos;
            // FIXME
            if (ch instanceof Mob) {
                Dungeon.level.mobPress((Mob) ch);
            } else {
                Dungeon.level.press(newPos, ch);
            }
        } else {
            return null;
        }
    }
    Mimic m = new Mimic();
    m.items = new ArrayList<Item>(items);
    m.adjustStats(Dungeon.depth);
    m.HP = m.HT;
    m.pos = pos;
    m.state = m.HUNTING;
    GameScene.add(m, 1);
    m.sprite.turnTo(pos, Dungeon.hero.pos);
    if (Dungeon.visible[m.pos]) {
        CellEmitter.get(pos).burst(Speck.factory(Speck.STAR), 10);
        Sample.INSTANCE.play(Assets.SND_MIMIC);
    }
    return m;
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Char(com.watabou.pixeldungeon.actors.Char) Pushing(com.watabou.pixeldungeon.effects.Pushing) ArrayList(java.util.ArrayList)

Aggregations

Char (com.watabou.pixeldungeon.actors.Char)27 Heap (com.watabou.pixeldungeon.items.Heap)4 Actor (com.watabou.pixeldungeon.actors.Actor)2 Burning (com.watabou.pixeldungeon.actors.buffs.Burning)2 Mob (com.watabou.pixeldungeon.actors.mobs.Mob)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 Fire (com.watabou.pixeldungeon.actors.blobs.Fire)1 SnipersMark (com.watabou.pixeldungeon.actors.buffs.SnipersMark)1 NPC (com.watabou.pixeldungeon.actors.mobs.npcs.NPC)1 Flare (com.watabou.pixeldungeon.effects.Flare)1 Lightning (com.watabou.pixeldungeon.effects.Lightning)1 Pushing (com.watabou.pixeldungeon.effects.Pushing)1 Swap (com.watabou.pixeldungeon.effects.Swap)1 Item (com.watabou.pixeldungeon.items.Item)1 MissileWeapon (com.watabou.pixeldungeon.items.weapon.missiles.MissileWeapon)1 MissileSprite (com.watabou.pixeldungeon.sprites.MissileSprite)1 Callback (com.watabou.utils.Callback)1