use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WandOfBlastWave method onZap.
@Override
protected void onZap(Ballistica bolt) {
Sample.INSTANCE.play(Assets.SND_BLAST);
BlastWave.blast(bolt.collisionPos);
int damage = damageRoll();
// presses all tiles in the AOE first
for (int i : PathFinder.NEIGHBOURS9) {
Dungeon.level.press(bolt.collisionPos + i, Actor.findChar(bolt.collisionPos + i), true);
}
// throws other chars around the center.
for (int i : PathFinder.NEIGHBOURS8) {
Char ch = Actor.findChar(bolt.collisionPos + i);
if (ch != null) {
processSoulMark(ch, chargesPerCast());
ch.damage(Math.round(damage * 0.667f), this);
if (ch.isAlive()) {
Ballistica trajectory = new Ballistica(ch.pos, ch.pos + i, Ballistica.MAGIC_BOLT);
int strength = 1 + Math.round(level() / 2f);
throwChar(ch, trajectory, strength);
}
}
}
// throws the char at the center of the blast
Char ch = Actor.findChar(bolt.collisionPos);
if (ch != null) {
processSoulMark(ch, chargesPerCast());
ch.damage(damage, this);
if (ch.isAlive() && bolt.path.size() > bolt.dist + 1) {
Ballistica trajectory = new Ballistica(ch.pos, bolt.path.get(bolt.dist + 1), Ballistica.MAGIC_BOLT);
int strength = level() + 3;
throwChar(ch, trajectory, strength);
}
}
if (!curUser.isAlive()) {
Dungeon.fail(getClass());
GLog.n(Messages.get(this, "ondeath"));
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WandOfFireblast method onZap.
@Override
protected void onZap(Ballistica bolt) {
for (int cell : affectedCells) {
// ignore caster cell
if (cell == bolt.sourcePos) {
continue;
}
// only ignite cells directly near caster if they are flammable
if (!Dungeon.level.adjacent(bolt.sourcePos, cell) || Dungeon.level.flamable[cell]) {
GameScene.add(Blob.seed(cell, 1 + chargesPerCast(), Fire.class));
}
Char ch = Actor.findChar(cell);
if (ch != null) {
processSoulMark(ch, chargesPerCast());
ch.damage(damageRoll(), this);
Buff.affect(ch, Burning.class).reignite(ch);
switch(chargesPerCast()) {
case 1:
// no effects
break;
case 2:
Buff.affect(ch, Cripple.class, 4f);
break;
case 3:
Buff.affect(ch, Paralysis.class, 4f);
break;
}
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WandOfLightning method arc.
private void arc(Char ch) {
affected.add(ch);
int dist;
if (Dungeon.level.water[ch.pos] && !ch.flying)
dist = 2;
else
dist = 1;
PathFinder.buildDistanceMap(ch.pos, BArray.not(Dungeon.level.solid, null), dist);
for (int i = 0; i < PathFinder.distance.length; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
Char n = Actor.findChar(i);
if (n == Dungeon.hero && PathFinder.distance[i] > 1)
// the hero is only zapped if they are adjacent
continue;
else if (n != null && !affected.contains(n)) {
arcs.add(new Lightning.Arc(ch.sprite.center(), n.sprite.center()));
arc(n);
}
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WandOfPrismaticLight method onZap.
@Override
protected void onZap(Ballistica beam) {
Char ch = Actor.findChar(beam.collisionPos);
if (ch != null) {
processSoulMark(ch, chargesPerCast());
affectTarget(ch);
}
affectMap(beam);
if (Dungeon.level.viewDistance < 6) {
if (Dungeon.isChallenged(Challenges.DARKNESS)) {
Buff.prolong(curUser, Light.class, 2f + level());
} else {
Buff.prolong(curUser, Light.class, 10f + level() * 5);
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WandOfMagicMissile method onZap.
@Override
protected void onZap(Ballistica bolt) {
Char ch = Actor.findChar(bolt.collisionPos);
if (ch != null) {
processSoulMark(ch, chargesPerCast());
ch.damage(damageRoll(), this);
ch.sprite.burst(0xFFFFFFFF, level() / 2 + 2);
} else {
Dungeon.level.press(bolt.collisionPos, null, true);
}
}
Aggregations