Search in sources :

Example 26 with Heap

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);
    }
}
Also used : Chill(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Chill) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Frost(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Example 27 with Heap

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;
    }
}
Also used : WndTradeItem(com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Example 28 with Heap

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;
            }
        }
    }
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) MagesStaff(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff) Wand(com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Example 29 with Heap

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;
    }
}
Also used : Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Example 30 with Heap

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;
    }
}
Also used : PotionOfMight(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight) TimekeepersHourglass(com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass) PotionOfStrength(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) WndTradeItem(com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem) Dewdrop(com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop) ScrollOfMagicalInfusion(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion) IronKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey) SkeletonKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey) GoldenKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey) Key(com.shatteredpixel.shatteredpixeldungeon.items.keys.Key) CrystalKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.CrystalKey) ScrollOfUpgrade(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade)

Aggregations

Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)33 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)14 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)13 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)11 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)5 GoldenKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey)4 Plant (com.shatteredpixel.shatteredpixeldungeon.plants.Plant)4 ArrayList (java.util.ArrayList)4 CrystalKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.CrystalKey)3 Blob (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob)2 Awareness (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness)2 Chill (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Chill)2 Frost (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost)2 MindVision (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision)2 IronKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey)2 SkeletonKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey)2 Trap (com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap)2 CustomTiledVisual (com.shatteredpixel.shatteredpixeldungeon.tiles.CustomTiledVisual)2 WndInfoMob (com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoMob)2 WndInfoPlant (com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoPlant)2