use of com.watabou.pixeldungeon.actors.Char in project pixel-dungeon by watabou.
the class Bomb method onThrow.
@Override
protected void onThrow(int cell) {
if (Level.pit[cell]) {
super.onThrow(cell);
} else {
Sample.INSTANCE.play(Assets.SND_BLAST, 2);
if (Dungeon.visible[cell]) {
CellEmitter.center(cell).burst(BlastParticle.FACTORY, 30);
}
boolean terrainAffected = false;
for (int n : Level.NEIGHBOURS9) {
int c = cell + n;
if (c >= 0 && c < Level.LENGTH) {
if (Dungeon.visible[c]) {
CellEmitter.get(c).burst(SmokeParticle.FACTORY, 4);
}
if (Level.flamable[c]) {
Dungeon.level.destroy(c);
GameScene.updateMap(c);
terrainAffected = true;
}
Char ch = Actor.findChar(c);
if (ch != null) {
int dmg = Random.Int(1 + Dungeon.depth, 10 + Dungeon.depth * 2) - Random.Int(ch.dr());
if (dmg > 0) {
ch.damage(dmg, this);
if (ch.isAlive()) {
Buff.prolong(ch, Paralysis.class, 2);
} else if (ch == Dungeon.hero) {
Dungeon.fail(Utils.format(ResultDescriptions.BOMB, Dungeon.depth));
GLog.n("You killed yourself with a bomb...");
}
}
}
}
}
if (terrainAffected) {
Dungeon.observe();
}
}
}
use of com.watabou.pixeldungeon.actors.Char in project pixel-dungeon by watabou.
the class Web method evolve.
@Override
protected void evolve() {
for (int i = 0; i < LENGTH; i++) {
int offv = cur[i] > 0 ? cur[i] - 1 : 0;
off[i] = offv;
if (offv > 0) {
volume += offv;
Char ch = Actor.findChar(i);
if (ch != null) {
Buff.prolong(ch, Roots.class, TICK);
}
}
}
}
use of com.watabou.pixeldungeon.actors.Char in project pixel-dungeon by watabou.
the class Fire method burn.
private void burn(int pos) {
Char ch = Actor.findChar(pos);
if (ch != null) {
Buff.affect(ch, Burning.class).reignite(ch);
}
Heap heap = Dungeon.level.heaps.get(pos);
if (heap != null) {
heap.burn();
}
}
use of com.watabou.pixeldungeon.actors.Char in project pixel-dungeon by watabou.
the class ParalyticGas method evolve.
@Override
protected void evolve() {
super.evolve();
Char ch;
for (int i = 0; i < LENGTH; i++) {
if (cur[i] > 0 && (ch = Actor.findChar(i)) != null) {
Buff.prolong(ch, Paralysis.class, Paralysis.duration(ch));
}
}
}
use of com.watabou.pixeldungeon.actors.Char in project pixel-dungeon by watabou.
the class ToxicGas method evolve.
@Override
protected void evolve() {
super.evolve();
int levelDamage = 5 + Dungeon.depth * 5;
Char ch;
for (int i = 0; i < LENGTH; i++) {
if (cur[i] > 0 && (ch = Actor.findChar(i)) != null) {
int damage = (ch.HT + levelDamage) / 40;
if (Random.Int(40) < (ch.HT + levelDamage) % 40) {
damage++;
}
ch.damage(damage, this);
}
}
Blob blob = Dungeon.level.blobs.get(ParalyticGas.class);
if (blob != null) {
int[] par = blob.cur;
for (int i = 0; i < LENGTH; i++) {
int t = cur[i];
int p = par[i];
if (p >= t) {
volume -= t;
cur[i] = 0;
} else {
blob.volume -= p;
par[i] = 0;
}
}
}
}
Aggregations