Search in sources :

Example 1 with ScrollOfUpgrade

use of com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Burning method act.

@Override
public boolean act() {
    if (target.isAlive()) {
        int damage = Random.NormalIntRange(1, 3 + target.HT / 40);
        Buff.detach(target, Chill.class);
        if (target instanceof Hero) {
            Hero hero = (Hero) target;
            if (hero.belongings.armor != null && hero.belongings.armor.hasGlyph(Brimstone.class)) {
                Buff.affect(target, Brimstone.BrimstoneShield.class);
            } else {
                hero.damage(damage, this);
                burnIncrement++;
                // at 4+ turns, there is a (turns-3)/3 chance an item burns
                if (Random.Int(3) < (burnIncrement - 3)) {
                    burnIncrement = 0;
                    ArrayList<Item> burnable = new ArrayList<>();
                    // does not reach inside of containers
                    for (Item i : hero.belongings.backpack.items) {
                        if ((i instanceof Scroll && !(i instanceof ScrollOfUpgrade || i instanceof ScrollOfMagicalInfusion)) || i instanceof MysteryMeat) {
                            burnable.add(i);
                        }
                    }
                    if (!burnable.isEmpty()) {
                        Item toBurn = Random.element(burnable).detach(hero.belongings.backpack);
                        if (toBurn instanceof MysteryMeat) {
                            ChargrilledMeat steak = new ChargrilledMeat();
                            if (!steak.collect(hero.belongings.backpack)) {
                                Dungeon.level.drop(steak, hero.pos).sprite.drop();
                            }
                        }
                        Heap.burnFX(hero.pos);
                        GLog.w(Messages.get(this, "burnsup", Messages.capitalize(toBurn.toString())));
                    }
                }
            }
        } else {
            target.damage(damage, this);
        }
        if (target instanceof Thief) {
            Item item = ((Thief) target).item;
            if (item instanceof Scroll && !(item instanceof ScrollOfUpgrade || item instanceof ScrollOfMagicalInfusion)) {
                target.sprite.emitter().burst(ElmoParticle.FACTORY, 6);
                ((Thief) target).item = null;
            } else if (item instanceof MysteryMeat) {
                target.sprite.emitter().burst(ElmoParticle.FACTORY, 6);
                ((Thief) target).item = new ChargrilledMeat();
            }
        }
    } else {
        Brimstone.BrimstoneShield brimShield = target.buff(Brimstone.BrimstoneShield.class);
        if (brimShield != null)
            brimShield.startDecay();
        detach();
    }
    if (Dungeon.level.flamable[target.pos] && Blob.volumeAt(target.pos, Fire.class) == 0) {
        GameScene.add(Blob.seed(target.pos, 4, Fire.class));
    }
    spend(TICK);
    left -= TICK;
    if (left <= 0 || (Dungeon.level.water[target.pos] && !target.flying)) {
        detach();
    }
    return true;
}
Also used : ChargrilledMeat(com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat) Thief(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief) Scroll(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll) ArrayList(java.util.ArrayList) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Brimstone(com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone) Fire(com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero) ScrollOfMagicalInfusion(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion) MysteryMeat(com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat) ScrollOfUpgrade(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade)

Example 2 with ScrollOfUpgrade

use of com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Level method create.

public void create() {
    Random.seed(Dungeon.seedCurDepth());
    if (!(Dungeon.bossLevel() || Dungeon.depth == 21)) /*final shop floor*/
    {
        if (Dungeon.isChallenged(Challenges.NO_FOOD)) {
            addItemToSpawn(new SmallRation());
        } else {
            addItemToSpawn(Generator.random(Generator.Category.FOOD));
        }
        if (Dungeon.isChallenged(Challenges.DARKNESS)) {
            addItemToSpawn(new Torch());
        }
        if (Dungeon.posNeeded()) {
            addItemToSpawn(new PotionOfStrength());
            Dungeon.LimitedDrops.STRENGTH_POTIONS.count++;
        }
        if (Dungeon.souNeeded()) {
            addItemToSpawn(new ScrollOfUpgrade());
            Dungeon.LimitedDrops.UPGRADE_SCROLLS.count++;
        }
        if (Dungeon.asNeeded()) {
            addItemToSpawn(new Stylus());
            Dungeon.LimitedDrops.ARCANE_STYLI.count++;
        }
        DriedRose rose = Dungeon.hero.belongings.getItem(DriedRose.class);
        if (rose != null && rose.isIdentified() && !rose.cursed) {
            // aim to drop 1 petal every 2 floors
            int petalsNeeded = (int) Math.ceil((float) ((Dungeon.depth / 2) - rose.droppedPetals) / 3);
            for (int i = 1; i <= petalsNeeded; i++) {
                // the player may miss a single petal and still max their rose.
                if (rose.droppedPetals < 11) {
                    addItemToSpawn(new DriedRose.Petal());
                    rose.droppedPetals++;
                }
            }
        }
        if (Dungeon.depth > 1) {
            switch(Random.Int(10)) {
                case 0:
                    if (!Dungeon.bossLevel(Dungeon.depth + 1)) {
                        feeling = Feeling.CHASM;
                    }
                    break;
                case 1:
                    feeling = Feeling.WATER;
                    break;
                case 2:
                    feeling = Feeling.GRASS;
                    break;
                case 3:
                    feeling = Feeling.DARK;
                    addItemToSpawn(new Torch());
                    viewDistance = Math.round(viewDistance / 2f);
                    break;
            }
        }
    }
    do {
        width = height = length = 0;
        mobs = new HashSet<>();
        heaps = new SparseArray<>();
        blobs = new HashMap<>();
        plants = new SparseArray<>();
        traps = new SparseArray<>();
        customTiles = new HashSet<>();
        customWalls = new HashSet<>();
    } while (!build());
    buildFlagMaps();
    cleanWalls();
    createMobs();
    createItems();
    Random.seed();
}
Also used : PotionOfStrength(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength) SmallRation(com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation) DriedRose(com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose) ScrollOfUpgrade(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade) Point(com.watabou.utils.Point) Torch(com.shatteredpixel.shatteredpixeldungeon.items.Torch) Stylus(com.shatteredpixel.shatteredpixeldungeon.items.Stylus)

Example 3 with ScrollOfUpgrade

use of com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Heap method burn.

public void burn() {
    if (type == Type.MIMIC) {
        Mimic m = Mimic.spawnAt(pos, items);
        if (m != null) {
            Buff.affect(m, Burning.class).reignite(m);
            m.sprite.emitter().burst(FlameParticle.FACTORY, 5);
            destroy();
        }
    }
    if (type != Type.HEAP) {
        return;
    }
    boolean burnt = false;
    boolean evaporated = false;
    for (Item item : items.toArray(new Item[0])) {
        if (item instanceof Scroll && !(item instanceof ScrollOfUpgrade || item instanceof ScrollOfMagicalInfusion)) {
            items.remove(item);
            burnt = true;
        } else if (item instanceof Dewdrop) {
            items.remove(item);
            evaporated = true;
        } else if (item instanceof MysteryMeat) {
            replace(item, ChargrilledMeat.cook((MysteryMeat) item));
            burnt = true;
        } else if (item instanceof Bomb) {
            items.remove(item);
            ((Bomb) item).explode(pos);
            // stop processing the burning, it will be replaced by the explosion.
            return;
        }
    }
    if (burnt || evaporated) {
        if (Dungeon.level.heroFOV[pos]) {
            if (burnt) {
                burnFX(pos);
            } else {
                evaporateFX(pos);
            }
        }
        if (isEmpty()) {
            destroy();
        } else if (sprite != null) {
            sprite.view(items.peek());
        }
    }
}
Also used : Mimic(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic) Scroll(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll) ScrollOfMagicalInfusion(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion) MysteryMeat(com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat) ScrollOfUpgrade(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade) Burning(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning)

Example 4 with ScrollOfUpgrade

use of com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade 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

ScrollOfUpgrade (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade)4 ScrollOfMagicalInfusion (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion)3 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)2 MysteryMeat (com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat)2 PotionOfStrength (com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength)2 Scroll (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll)2 Fire (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire)1 Burning (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning)1 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)1 Mimic (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic)1 Thief (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief)1 Dewdrop (com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop)1 Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)1 Stylus (com.shatteredpixel.shatteredpixeldungeon.items.Stylus)1 Torch (com.shatteredpixel.shatteredpixeldungeon.items.Torch)1 Brimstone (com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone)1 DriedRose (com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose)1 TimekeepersHourglass (com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass)1 ChargrilledMeat (com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat)1 SmallRation (com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation)1