Search in sources :

Example 1 with Lightning

use of com.watabou.pixeldungeon.effects.Lightning in project pixel-dungeon by watabou.

the class LightningTrap method trigger.

// 00x66CCEE
public static void trigger(int pos, Char ch) {
    if (ch != null) {
        ch.damage(Math.max(1, Random.Int(ch.HP / 3, 2 * ch.HP / 3)), LIGHTNING);
        if (ch == Dungeon.hero) {
            Camera.main.shake(2, 0.3f);
            if (!ch.isAlive()) {
                Dungeon.fail(Utils.format(ResultDescriptions.TRAP, name, Dungeon.depth));
                GLog.n("You were killed by a discharge of a lightning trap...");
            } else {
                ((Hero) ch).belongings.charge(false);
            }
        }
        int[] points = new int[2];
        points[0] = pos - Level.WIDTH;
        points[1] = pos + Level.WIDTH;
        ch.sprite.parent.add(new Lightning(points, 2, null));
        points[0] = pos - 1;
        points[1] = pos + 1;
        ch.sprite.parent.add(new Lightning(points, 2, null));
    }
    CellEmitter.center(pos).burst(SparkParticle.FACTORY, Random.IntRange(3, 4));
}
Also used : Lightning(com.watabou.pixeldungeon.effects.Lightning)

Example 2 with Lightning

use of com.watabou.pixeldungeon.effects.Lightning in project pixel-dungeon by watabou.

the class ShamanSprite method zap.

public void zap(int pos) {
    points[0] = ch.pos;
    points[1] = pos;
    parent.add(new Lightning(points, 2, (Shaman) ch));
    turnTo(ch.pos, pos);
    play(zap);
}
Also used : Lightning(com.watabou.pixeldungeon.effects.Lightning) Shaman(com.watabou.pixeldungeon.actors.mobs.Shaman)

Example 3 with Lightning

use of com.watabou.pixeldungeon.effects.Lightning in project pixel-dungeon by watabou.

the class WandOfLightning method fx.

@Override
protected void fx(int cell, Callback callback) {
    nPoints = 0;
    points[nPoints++] = Dungeon.hero.pos;
    Char ch = Actor.findChar(cell);
    if (ch != null) {
        affected.clear();
        int lvl = power();
        hit(ch, Random.Int(5 + lvl / 2, 10 + lvl));
    } else {
        points[nPoints++] = cell;
        CellEmitter.center(cell).burst(SparkParticle.FACTORY, 3);
    }
    curUser.sprite.parent.add(new Lightning(points, nPoints, callback));
}
Also used : Char(com.watabou.pixeldungeon.actors.Char) Lightning(com.watabou.pixeldungeon.effects.Lightning)

Example 4 with Lightning

use of com.watabou.pixeldungeon.effects.Lightning in project pixel-dungeon by watabou.

the class Potential 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 + 7) >= 6) {
        int dmg = Random.IntRange(1, damage);
        attacker.damage(dmg, LightningTrap.LIGHTNING);
        dmg = Random.IntRange(1, dmg);
        defender.damage(dmg, LightningTrap.LIGHTNING);
        checkOwner(defender);
        if (defender == Dungeon.hero) {
            Camera.main.shake(2, 0.3f);
        }
        int[] points = { attacker.pos, defender.pos };
        attacker.sprite.parent.add(new Lightning(points, 2, null));
    }
    return damage;
}
Also used : Lightning(com.watabou.pixeldungeon.effects.Lightning)

Example 5 with Lightning

use of com.watabou.pixeldungeon.effects.Lightning in project pixel-dungeon by watabou.

the class Shock method proc.

@Override
public boolean proc(Weapon weapon, Char attacker, Char defender, int damage) {
    // lvl 0 - 25%
    // lvl 1 - 40%
    // lvl 2 - 50%
    int level = Math.max(0, weapon.effectiveLevel());
    if (Random.Int(level + 4) >= 3) {
        points[0] = attacker.pos;
        nPoints = 1;
        affected.clear();
        affected.add(attacker);
        hit(defender, Random.Int(1, damage / 2));
        attacker.sprite.parent.add(new Lightning(points, nPoints, null));
        return true;
    } else {
        return false;
    }
}
Also used : Lightning(com.watabou.pixeldungeon.effects.Lightning)

Aggregations

Lightning (com.watabou.pixeldungeon.effects.Lightning)5 Char (com.watabou.pixeldungeon.actors.Char)1 Shaman (com.watabou.pixeldungeon.actors.mobs.Shaman)1