Search in sources :

Example 56 with Char

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

the class IncendiaryDart method onThrow.

@Override
protected void onThrow(int cell) {
    Char enemy = Actor.findChar(cell);
    if ((enemy == null || enemy == curUser) && Dungeon.level.flamable[cell]) {
        GameScene.add(Blob.seed(cell, 4, Fire.class));
        Dungeon.level.drop(new Dart(), cell).sprite.drop();
    } else {
        super.onThrow(cell);
    }
}
Also used : Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Fire(com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire)

Example 57 with Char

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

the class Shocking method hit.

private void hit(Char ch, int damage) {
    if (damage < 1) {
        return;
    }
    affected.add(ch);
    ch.damage(Dungeon.level.water[ch.pos] && !ch.flying ? 2 * damage : damage, this);
    ch.sprite.centerEmitter().burst(SparkParticle.FACTORY, 3);
    ch.sprite.flash();
    for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
        Char n = Actor.findChar(ch.pos + PathFinder.NEIGHBOURS8[i]);
        if (n != null && !affected.contains(n)) {
            arcs.add(new Lightning.Arc(ch.sprite.center(), n.sprite.center()));
            hit(n, Random.Int(damage / 2, damage));
        }
    }
}
Also used : Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Lightning(com.shatteredpixel.shatteredpixeldungeon.effects.Lightning)

Example 58 with Char

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

the class ConfusionGas method evolve.

@Override
protected void evolve() {
    super.evolve();
    Char ch;
    int cell;
    for (int i = area.left; i < area.right; i++) {
        for (int j = area.top; j < area.bottom; j++) {
            cell = i + j * Dungeon.level.width();
            if (cur[cell] > 0 && (ch = Actor.findChar(cell)) != null) {
                if (!ch.isImmune(this.getClass())) {
                    Buff.prolong(ch, Vertigo.class, 2);
                }
            }
        }
    }
}
Also used : Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char)

Example 59 with Char

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

the class Electricity method evolve.

@Override
protected void evolve() {
    water = Dungeon.level.water;
    int cell;
    // spread first..
    for (int i = area.left - 1; i <= area.right; i++) {
        for (int j = area.top - 1; j <= area.bottom; j++) {
            cell = i + j * Dungeon.level.width();
            if (cur[cell] > 0) {
                spreadFromCell(cell, cur[cell]);
            }
        }
    }
    // ..then decrement/shock
    for (int i = area.left - 1; i <= area.right; i++) {
        for (int j = area.top - 1; j <= area.bottom; j++) {
            cell = i + j * Dungeon.level.width();
            if (cur[cell] > 0) {
                Char ch = Actor.findChar(cell);
                if (ch != null && !ch.isImmune(this.getClass())) {
                    Buff.prolong(ch, Paralysis.class, 1f);
                    if (cur[cell] % 2 == 1) {
                        ch.damage(Math.round(Random.Float(2 + Dungeon.depth / 5f)), this);
                    }
                }
                Heap h = Dungeon.level.heaps.get(cell);
                if (h != null) {
                    Item toShock = h.peek();
                    if (toShock instanceof Wand) {
                        ((Wand) toShock).gainCharge(0.333f);
                    } else if (toShock instanceof MagesStaff) {
                        ((MagesStaff) toShock).gainCharge(0.333f);
                    }
                }
                off[cell] = cur[cell] - 1;
                volume += off[cell];
            } else {
                off[cell] = 0;
            }
        }
    }
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) MagesStaff(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff) Wand(com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Example 60 with Char

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

the class Freezing method affect.

// legacy functionality from before this was a proper blob. Returns true if this cell is visible
public static boolean affect(int cell, Fire fire) {
    Char ch = Actor.findChar(cell);
    if (ch != null) {
        if (Dungeon.level.water[ch.pos]) {
            Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(5f, 7.5f));
        } else {
            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.level.heroFOV[cell]) {
        CellEmitter.get(cell).start(SnowParticle.FACTORY, 0.2f, 6);
        return true;
    } else {
        return false;
    }
}
Also used : Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Aggregations

Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)65 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)13 Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)13 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)8 Callback (com.watabou.utils.Callback)8 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)7 Ballistica (com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica)5 ArrayList (java.util.ArrayList)4 Actor (com.shatteredpixel.shatteredpixeldungeon.actors.Actor)3 Fire (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire)3 Buff (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff)3 Burning (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning)3 Frost (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost)3 Bleeding (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding)2 Chill (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Chill)2 Paralysis (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis)2 Lightning (com.shatteredpixel.shatteredpixeldungeon.effects.Lightning)2 Blob (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob)1 CorrosiveGas (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.CorrosiveGas)1 Regrowth (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Regrowth)1