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));
}
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);
}
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));
}
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;
}
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;
}
}