Search in sources :

Example 11 with Char

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

the class Bomb method onThrow.

@Override
protected void onThrow(int cell) {
    if (Level.pit[cell]) {
        super.onThrow(cell);
    } else {
        Sample.INSTANCE.play(Assets.SND_BLAST, 2);
        if (Dungeon.visible[cell]) {
            CellEmitter.center(cell).burst(BlastParticle.FACTORY, 30);
        }
        boolean terrainAffected = false;
        for (int n : Level.NEIGHBOURS9) {
            int c = cell + n;
            if (c >= 0 && c < Level.LENGTH) {
                if (Dungeon.visible[c]) {
                    CellEmitter.get(c).burst(SmokeParticle.FACTORY, 4);
                }
                if (Level.flamable[c]) {
                    Dungeon.level.destroy(c);
                    GameScene.updateMap(c);
                    terrainAffected = true;
                }
                Char ch = Actor.findChar(c);
                if (ch != null) {
                    int dmg = Random.Int(1 + Dungeon.depth, 10 + Dungeon.depth * 2) - Random.Int(ch.dr());
                    if (dmg > 0) {
                        ch.damage(dmg, this);
                        if (ch.isAlive()) {
                            Buff.prolong(ch, Paralysis.class, 2);
                        } else if (ch == Dungeon.hero) {
                            Dungeon.fail(Utils.format(ResultDescriptions.BOMB, Dungeon.depth));
                            GLog.n("You killed yourself with a bomb...");
                        }
                    }
                }
            }
        }
        if (terrainAffected) {
            Dungeon.observe();
        }
    }
}
Also used : Char(com.watabou.pixeldungeon.actors.Char)

Example 12 with Char

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

the class Web method evolve.

@Override
protected void evolve() {
    for (int i = 0; i < LENGTH; i++) {
        int offv = cur[i] > 0 ? cur[i] - 1 : 0;
        off[i] = offv;
        if (offv > 0) {
            volume += offv;
            Char ch = Actor.findChar(i);
            if (ch != null) {
                Buff.prolong(ch, Roots.class, TICK);
            }
        }
    }
}
Also used : Char(com.watabou.pixeldungeon.actors.Char)

Example 13 with Char

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

the class Fire method burn.

private void burn(int pos) {
    Char ch = Actor.findChar(pos);
    if (ch != null) {
        Buff.affect(ch, Burning.class).reignite(ch);
    }
    Heap heap = Dungeon.level.heaps.get(pos);
    if (heap != null) {
        heap.burn();
    }
}
Also used : Char(com.watabou.pixeldungeon.actors.Char) Heap(com.watabou.pixeldungeon.items.Heap) Burning(com.watabou.pixeldungeon.actors.buffs.Burning)

Example 14 with Char

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

the class ParalyticGas method evolve.

@Override
protected void evolve() {
    super.evolve();
    Char ch;
    for (int i = 0; i < LENGTH; i++) {
        if (cur[i] > 0 && (ch = Actor.findChar(i)) != null) {
            Buff.prolong(ch, Paralysis.class, Paralysis.duration(ch));
        }
    }
}
Also used : Char(com.watabou.pixeldungeon.actors.Char)

Example 15 with Char

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

the class ToxicGas method evolve.

@Override
protected void evolve() {
    super.evolve();
    int levelDamage = 5 + Dungeon.depth * 5;
    Char ch;
    for (int i = 0; i < LENGTH; i++) {
        if (cur[i] > 0 && (ch = Actor.findChar(i)) != null) {
            int damage = (ch.HT + levelDamage) / 40;
            if (Random.Int(40) < (ch.HT + levelDamage) % 40) {
                damage++;
            }
            ch.damage(damage, this);
        }
    }
    Blob blob = Dungeon.level.blobs.get(ParalyticGas.class);
    if (blob != null) {
        int[] par = blob.cur;
        for (int i = 0; i < LENGTH; i++) {
            int t = cur[i];
            int p = par[i];
            if (p >= t) {
                volume -= t;
                cur[i] = 0;
            } else {
                blob.volume -= p;
                par[i] = 0;
            }
        }
    }
}
Also used : Char(com.watabou.pixeldungeon.actors.Char)

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