use of com.watabou.pixeldungeon.actors.Char in project pixel-dungeon by watabou.
the class Freezing method affect.
// Returns true, if this cell is visible
public static boolean affect(int cell, Fire fire) {
Char ch = Actor.findChar(cell);
if (ch != null) {
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.visible[cell]) {
CellEmitter.get(cell).start(SnowParticle.FACTORY, 0.2f, 6);
return true;
} else {
return false;
}
}
use of com.watabou.pixeldungeon.actors.Char in project pixel-dungeon by watabou.
the class Regrowth method evolve.
@Override
protected void evolve() {
super.evolve();
if (volume > 0) {
boolean mapUpdated = false;
for (int i = 0; i < LENGTH; i++) {
if (off[i] > 0) {
int c = Dungeon.level.map[i];
int c1 = c;
if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO) {
c1 = cur[i] > 9 ? Terrain.HIGH_GRASS : Terrain.GRASS;
} else if (c == Terrain.GRASS && cur[i] > 9) {
c1 = Terrain.HIGH_GRASS;
}
if (c1 != c) {
Level.set(i, Terrain.HIGH_GRASS);
mapUpdated = true;
GameScene.updateMap(i);
if (Dungeon.visible[i]) {
GameScene.discoverTile(i, c);
}
}
Char ch = Actor.findChar(i);
if (ch != null) {
Buff.prolong(ch, Roots.class, TICK);
}
}
}
if (mapUpdated) {
Dungeon.observe();
}
}
}
use of com.watabou.pixeldungeon.actors.Char in project pixel-dungeon by watabou.
the class SacrificialFire method evolve.
@Override
protected void evolve() {
volume = off[pos] = cur[pos];
Char ch = Actor.findChar(pos);
if (ch != null) {
if (Dungeon.visible[pos] && ch.buff(Marked.class) == null) {
ch.sprite.emitter().burst(SacrificialParticle.FACTORY, 20);
Sample.INSTANCE.play(Assets.SND_BURNING);
}
Buff.prolong(ch, Marked.class, Marked.DURATION);
}
if (Dungeon.visible[pos]) {
Journal.add(Feature.SACRIFICIAL_FIRE);
}
}
use of com.watabou.pixeldungeon.actors.Char in project pixel-dungeon by watabou.
the class Eye method attack.
@Override
public boolean attack(Char enemy) {
for (int i = 1; i < Ballistica.distance; i++) {
int pos = Ballistica.trace[i];
Char ch = Actor.findChar(pos);
if (ch == null) {
continue;
}
if (hit(this, ch, true)) {
ch.damage(Random.NormalIntRange(14, 20), this);
if (Dungeon.visible[pos]) {
ch.sprite.flash();
CellEmitter.center(pos).burst(PurpleParticle.BURST, Random.IntRange(1, 2));
}
if (!ch.isAlive() && ch == Dungeon.hero) {
Dungeon.fail(Utils.format(ResultDescriptions.MOB, Utils.indefinite(name), Dungeon.depth));
GLog.n(TXT_DEATHGAZE_KILLED, name);
}
} else {
ch.sprite.showStatus(CharSprite.NEUTRAL, ch.defenseVerb());
}
}
return true;
}
use of com.watabou.pixeldungeon.actors.Char in project pixel-dungeon by watabou.
the class Mimic method spawnAt.
public static Mimic spawnAt(int pos, List<Item> items) {
Char ch = Actor.findChar(pos);
if (ch != null) {
ArrayList<Integer> candidates = new ArrayList<Integer>();
for (int n : Level.NEIGHBOURS8) {
int cell = pos + n;
if ((Level.passable[cell] || Level.avoid[cell]) && Actor.findChar(cell) == null) {
candidates.add(cell);
}
}
if (candidates.size() > 0) {
int newPos = Random.element(candidates);
Actor.addDelayed(new Pushing(ch, ch.pos, newPos), -1);
ch.pos = newPos;
// FIXME
if (ch instanceof Mob) {
Dungeon.level.mobPress((Mob) ch);
} else {
Dungeon.level.press(newPos, ch);
}
} else {
return null;
}
}
Mimic m = new Mimic();
m.items = new ArrayList<Item>(items);
m.adjustStats(Dungeon.depth);
m.HP = m.HT;
m.pos = pos;
m.state = m.HUNTING;
GameScene.add(m, 1);
m.sprite.turnTo(pos, Dungeon.hero.pos);
if (Dungeon.visible[m.pos]) {
CellEmitter.get(pos).burst(Speck.factory(Speck.STAR), 10);
Sample.INSTANCE.play(Assets.SND_MIMIC);
}
return m;
}
Aggregations