use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Freezing method evolve.
@Override
protected void evolve() {
boolean[] water = Dungeon.level.water;
int cell;
Fire fire = (Fire) Dungeon.level.blobs.get(Fire.class);
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) {
if (fire != null && fire.volume > 0 && fire.cur[cell] > 0) {
fire.clear(cell);
off[cell] = cur[cell] = 0;
continue;
}
Char ch = Actor.findChar(cell);
if (ch != null && !ch.isImmune(this.getClass())) {
if (ch.buff(Frost.class) != null) {
Buff.affect(ch, Frost.class, 2f);
} else {
Buff.affect(ch, Chill.class, water[cell] ? 5f : 3f);
Chill chill = ch.buff(Chill.class);
if (chill != null && chill.cooldown() >= 10f) {
Buff.affect(ch, Frost.class, 5f);
}
}
}
Heap heap = Dungeon.level.heaps.get(cell);
if (heap != null)
heap.freeze();
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 Hero method handle.
public boolean handle(int cell) {
if (cell == -1) {
return false;
}
Char ch;
Heap heap;
if (Dungeon.level.map[cell] == Terrain.ALCHEMY && cell != pos) {
curAction = new HeroAction.Alchemy(cell);
} else if (fieldOfView[cell] && (ch = Actor.findChar(cell)) instanceof Mob) {
if (ch instanceof NPC) {
curAction = new HeroAction.Interact((NPC) ch);
} else {
curAction = new HeroAction.Attack(ch);
}
} else if ((heap = Dungeon.level.heaps.get(cell)) != null && // moving to an item doesn't auto-pickup when enemies are near...
(visibleEnemies.size() == 0 || cell == pos || // ...but only for standard heaps, chests and similar open as normal.
(heap.type != Type.HEAP && heap.type != Type.FOR_SALE))) {
switch(heap.type) {
case HEAP:
curAction = new HeroAction.PickUp(cell);
break;
case FOR_SALE:
curAction = heap.size() == 1 && heap.peek().price() > 0 ? new HeroAction.Buy(cell) : new HeroAction.PickUp(cell);
break;
default:
curAction = new HeroAction.OpenChest(cell);
}
} else if (Dungeon.level.map[cell] == Terrain.LOCKED_DOOR || Dungeon.level.map[cell] == Terrain.LOCKED_EXIT) {
curAction = new HeroAction.Unlock(cell);
} else if (cell == Dungeon.level.exit && Dungeon.depth < 26) {
curAction = new HeroAction.Descend(cell);
} else if (cell == Dungeon.level.entrance) {
curAction = new HeroAction.Ascend(cell);
} else {
curAction = new HeroAction.Move(cell);
lastAction = null;
}
if (ready)
return act();
else
return false;
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Item method cast.
public void cast(final Hero user, final int dst) {
final int cell = throwPos(user, dst);
user.sprite.zap(cell);
user.busy();
Sample.INSTANCE.play(Assets.SND_MISS, 0.6f, 0.6f, 1.5f);
Char enemy = Actor.findChar(cell);
QuickSlotButton.target(enemy);
final float delay = castDelay(user, dst);
if (enemy != null) {
((MissileSprite) user.sprite.parent.recycle(MissileSprite.class)).reset(user.sprite, enemy.sprite, this, new Callback() {
@Override
public void call() {
Item.this.detach(user.belongings.backpack).onThrow(cell);
user.spendAndNext(delay);
}
});
} else {
((MissileSprite) user.sprite.parent.recycle(MissileSprite.class)).reset(user.sprite, cell, this, new Callback() {
@Override
public void call() {
Item.this.detach(user.belongings.backpack).onThrow(cell);
user.spendAndNext(delay);
}
});
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Potion method splash.
protected void splash(int cell) {
Fire fire = (Fire) Dungeon.level.blobs.get(Fire.class);
if (fire != null)
fire.clear(cell);
final int color = ItemSprite.pick(image, 8, 10);
Char ch = Actor.findChar(cell);
if (ch != null) {
Buff.detach(ch, Burning.class);
Buff.detach(ch, Ooze.class);
Splash.at(ch.sprite.center(), color, 5);
} else {
Splash.at(cell, color, 5);
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Dungeon method flee.
public static int flee(Char ch, int cur, int from, boolean[] pass, boolean[] visible) {
setupPassable();
if (ch.flying) {
BArray.or(pass, Dungeon.level.avoid, passable);
} else {
System.arraycopy(pass, 0, passable, 0, Dungeon.level.length());
}
for (Char c : Actor.chars()) {
if (visible[c.pos]) {
passable[c.pos] = false;
}
}
passable[cur] = true;
return PathFinder.getStepBack(cur, from, passable);
}
Aggregations