Search in sources :

Example 1 with MagesStaff

use of com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff 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)

Aggregations

Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)1 Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)1 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)1 Wand (com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand)1 MagesStaff (com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff)1