Search in sources :

Example 1 with Lightning

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

the class Shocking method proc.

@Override
public int proc(Weapon weapon, Char attacker, Char defender, int damage) {
    // lvl 0 - 33%
    // lvl 1 - 50%
    // lvl 2 - 60%
    int level = Math.max(0, weapon.level());
    if (Random.Int(level + 3) >= 2) {
        affected.clear();
        affected.add(attacker);
        arcs.clear();
        arcs.add(new Lightning.Arc(attacker.sprite.center(), defender.sprite.center()));
        hit(defender, Random.Int(1, damage / 3));
        attacker.sprite.parent.addToFront(new Lightning(arcs, null));
    }
    return damage;
}
Also used : Lightning(com.shatteredpixel.shatteredpixeldungeon.effects.Lightning)

Example 2 with Lightning

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

the class ShockingDart method proc.

@Override
public int proc(Char attacker, Char defender, int damage) {
    defender.damage(Random.NormalIntRange(8, 12), this);
    CharSprite s = defender.sprite;
    ArrayList<Lightning.Arc> arcs = new ArrayList<>();
    arcs.add(new Lightning.Arc(new PointF(s.x, s.y + s.height / 2), new PointF(s.x + s.width, s.y + s.height / 2)));
    arcs.add(new Lightning.Arc(new PointF(s.x + s.width / 2, s.y), new PointF(s.x + s.width / 2, s.y + s.height)));
    defender.sprite.parent.add(new Lightning(arcs, null));
    return super.proc(attacker, defender, damage);
}
Also used : Lightning(com.shatteredpixel.shatteredpixeldungeon.effects.Lightning) PointF(com.watabou.utils.PointF) ArrayList(java.util.ArrayList) CharSprite(com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite)

Example 3 with Lightning

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

the class ShamanSprite method zap.

public void zap(int pos) {
    parent.add(new Lightning(ch.pos, pos, (Shaman) ch));
    turnTo(ch.pos, pos);
    play(zap);
}
Also used : Lightning(com.shatteredpixel.shatteredpixeldungeon.effects.Lightning) Shaman(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Shaman)

Example 4 with Lightning

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

the class Potential method proc.

@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
    int level = Math.max(0, armor.level());
    if (Random.Int(level + 20) >= 18) {
        int shockDmg = Random.NormalIntRange(2, 6);
        defender.damage(shockDmg, this);
        checkOwner(defender);
        if (defender == Dungeon.hero) {
            Dungeon.hero.belongings.charge(1f + level / 10f);
            Camera.main.shake(2, 0.3f);
        }
        attacker.sprite.parent.add(new Lightning(attacker.pos, defender.pos, null));
    }
    return damage;
}
Also used : Lightning(com.shatteredpixel.shatteredpixeldungeon.effects.Lightning)

Example 5 with Lightning

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

the class WandOfLightning method fx.

@Override
protected void fx(Ballistica bolt, Callback callback) {
    affected.clear();
    arcs.clear();
    int cell = bolt.collisionPos;
    Char ch = Actor.findChar(cell);
    if (ch != null) {
        arcs.add(new Lightning.Arc(curUser.sprite.center(), ch.sprite.center()));
        arc(ch);
    } else {
        arcs.add(new Lightning.Arc(curUser.sprite.center(), DungeonTilemap.raisedTileCenterToWorld(bolt.collisionPos)));
        CellEmitter.center(cell).burst(SparkParticle.FACTORY, 3);
    }
    // don't want to wait for the effect before processing damage.
    curUser.sprite.parent.addToFront(new Lightning(arcs, null));
    callback.call();
}
Also used : Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Lightning(com.shatteredpixel.shatteredpixeldungeon.effects.Lightning)

Aggregations

Lightning (com.shatteredpixel.shatteredpixeldungeon.effects.Lightning)5 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)1 Shaman (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Shaman)1 CharSprite (com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite)1 PointF (com.watabou.utils.PointF)1 ArrayList (java.util.ArrayList)1