use of com.shatteredpixel.shatteredpixeldungeon.items.Heap in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WandOfFrost method onZap.
@Override
protected void onZap(Ballistica bolt) {
Heap heap = Dungeon.level.heaps.get(bolt.collisionPos);
if (heap != null) {
heap.freeze();
}
Char ch = Actor.findChar(bolt.collisionPos);
if (ch != null) {
int damage = damageRoll();
if (ch.buff(Frost.class) != null) {
// do nothing, can't affect a frozen target
return;
}
if (ch.buff(Chill.class) != null) {
// 7.5% less damage per turn of chill remaining
float chill = ch.buff(Chill.class).cooldown();
damage = (int) Math.round(damage * Math.pow(0.9f, chill));
} else {
ch.sprite.burst(0xFF99CCFF, level() / 2 + 2);
}
processSoulMark(ch, chargesPerCast());
ch.damage(damage, this);
if (ch.isAlive()) {
if (Dungeon.level.water[ch.pos])
Buff.prolong(ch, Chill.class, 4 + level());
else
Buff.prolong(ch, Chill.class, 2 + level());
}
} else {
Dungeon.level.press(bolt.collisionPos, null, true);
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Heap in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Hero method actBuy.
private boolean actBuy(HeroAction.Buy action) {
int dst = action.dst;
if (pos == dst || Dungeon.level.adjacent(pos, dst)) {
ready();
Heap heap = Dungeon.level.heaps.get(dst);
if (heap != null && heap.type == Type.FOR_SALE && heap.size() == 1) {
GameScene.show(new WndTradeItem(heap, true));
}
return false;
} else if (getCloser(dst)) {
return true;
} else {
ready();
return false;
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Heap 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.items.Heap 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;
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Heap in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Hero method actPickUp.
private boolean actPickUp(HeroAction.PickUp action) {
int dst = action.dst;
if (pos == dst) {
Heap heap = Dungeon.level.heaps.get(pos);
if (heap != null) {
Item item = heap.peek();
if (item.doPickUp(this)) {
heap.pickUp();
if (item instanceof Dewdrop || item instanceof TimekeepersHourglass.sandBag || item instanceof DriedRose.Petal || item instanceof Key) {
// Do Nothing
} else {
boolean important = ((item instanceof ScrollOfUpgrade || item instanceof ScrollOfMagicalInfusion) && ((Scroll) item).isKnown()) || ((item instanceof PotionOfStrength || item instanceof PotionOfMight) && ((Potion) item).isKnown());
if (important) {
GLog.p(Messages.get(this, "you_now_have", item.name()));
} else {
GLog.i(Messages.get(this, "you_now_have", item.name()));
}
}
curAction = null;
} else {
heap.sprite.drop();
ready();
}
} else {
ready();
}
return false;
} else if (getCloser(dst)) {
return true;
} else {
ready();
return false;
}
}
Aggregations