use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class IncendiaryDart method onThrow.
@Override
protected void onThrow(int cell) {
Char enemy = Actor.findChar(cell);
if ((enemy == null || enemy == curUser) && Dungeon.level.flamable[cell]) {
GameScene.add(Blob.seed(cell, 4, Fire.class));
Dungeon.level.drop(new Dart(), cell).sprite.drop();
} else {
super.onThrow(cell);
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Shocking method hit.
private void hit(Char ch, int damage) {
if (damage < 1) {
return;
}
affected.add(ch);
ch.damage(Dungeon.level.water[ch.pos] && !ch.flying ? 2 * damage : damage, this);
ch.sprite.centerEmitter().burst(SparkParticle.FACTORY, 3);
ch.sprite.flash();
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
Char n = Actor.findChar(ch.pos + PathFinder.NEIGHBOURS8[i]);
if (n != null && !affected.contains(n)) {
arcs.add(new Lightning.Arc(ch.sprite.center(), n.sprite.center()));
hit(n, Random.Int(damage / 2, damage));
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class ConfusionGas method evolve.
@Override
protected void evolve() {
super.evolve();
Char ch;
int cell;
for (int i = area.left; i < area.right; i++) {
for (int j = area.top; j < area.bottom; j++) {
cell = i + j * Dungeon.level.width();
if (cur[cell] > 0 && (ch = Actor.findChar(cell)) != null) {
if (!ch.isImmune(this.getClass())) {
Buff.prolong(ch, Vertigo.class, 2);
}
}
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char 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;
}
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Freezing method affect.
// legacy functionality from before this was a proper blob. Returns true if this cell is visible
public static boolean affect(int cell, Fire fire) {
Char ch = Actor.findChar(cell);
if (ch != null) {
if (Dungeon.level.water[ch.pos]) {
Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(5f, 7.5f));
} else {
Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(1.0f, 1.5f));
}
}
if (fire != null) {
fire.clear(cell);
}
Heap heap = Dungeon.level.heaps.get(cell);
if (heap != null) {
heap.freeze();
}
if (Dungeon.level.heroFOV[cell]) {
CellEmitter.get(cell).start(SnowParticle.FACTORY, 0.2f, 6);
return true;
} else {
return false;
}
}
Aggregations