use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class PoisonDartTrap method activate.
@Override
public void activate() {
Char target = Actor.findChar(pos);
// find the closest char that can be aimed at
if (target == null) {
for (Char ch : Actor.chars()) {
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
if (bolt.collisionPos == ch.pos && (target == null || Dungeon.level.trueDistance(pos, ch.pos) < Dungeon.level.trueDistance(pos, target.pos))) {
target = ch;
}
}
}
if (target != null) {
final Char finalTarget = target;
final PoisonDartTrap trap = this;
if (Dungeon.level.heroFOV[pos] || Dungeon.level.heroFOV[target.pos]) {
Actor.add(new Actor() {
{
// it's a visual effect, gets priority no matter what
actPriority = VFX_PRIO;
}
@Override
protected boolean act() {
final Actor toRemove = this;
((MissileSprite) ShatteredPixelDungeon.scene().recycle(MissileSprite.class)).reset(pos, finalTarget.sprite, new PoisonDart(), new Callback() {
@Override
public void call() {
int dmg = Random.NormalIntRange(1, 4) - finalTarget.drRoll();
finalTarget.damage(dmg, trap);
if (finalTarget == Dungeon.hero && !finalTarget.isAlive()) {
Dungeon.fail(trap.getClass());
}
Buff.affect(finalTarget, Poison.class).set(4 + Dungeon.depth);
Sample.INSTANCE.play(Assets.SND_HIT, 1, 1, Random.Float(0.8f, 1.25f));
finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(), dmg);
finalTarget.sprite.flash();
Actor.remove(toRemove);
next();
}
});
return false;
}
});
} else {
finalTarget.damage(Random.NormalIntRange(1, 4) - finalTarget.drRoll(), trap);
Buff.affect(finalTarget, Poison.class).set(4 + Dungeon.depth);
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Earthroot method activate.
@Override
public void activate() {
Char ch = Actor.findChar(pos);
if (ch == Dungeon.hero) {
Buff.affect(ch, Armor.class).level(ch.HT);
}
if (Dungeon.level.heroFOV[pos]) {
CellEmitter.bottom(pos).start(EarthParticle.FACTORY, 0.05f, 8);
Camera.main.shake(1, 0.4f);
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class ToxicGas method evolve.
@Override
protected void evolve() {
super.evolve();
int levelDamage = 5 + Dungeon.depth * 5;
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())) {
int damage = (ch.HT + levelDamage) / 40;
if (Random.Int(40) < (ch.HT + levelDamage) % 40) {
damage++;
}
ch.damage(damage, this);
}
}
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class CorrosiveGas method evolve.
@Override
protected void evolve() {
super.evolve();
if (volume == 0) {
strength = 0;
} else {
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.affect(ch, Corrosion.class).set(2f, strength);
}
}
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Fire method burn.
private void burn(int pos) {
Char ch = Actor.findChar(pos);
if (ch != null && !ch.isImmune(this.getClass())) {
Buff.affect(ch, Burning.class).reignite(ch);
}
Heap heap = Dungeon.level.heaps.get(pos);
if (heap != null) {
heap.burn();
}
Plant plant = Dungeon.level.plants.get(pos);
if (plant != null) {
plant.wither();
}
}
Aggregations