Search in sources :

Example 1 with Thief

use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief 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 Thief

use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Frost method attachTo.

@Override
public boolean attachTo(Char target) {
    if (super.attachTo(target)) {
        target.paralysed++;
        Buff.detach(target, Burning.class);
        Buff.detach(target, Chill.class);
        if (target instanceof Hero) {
            Hero hero = (Hero) target;
            ArrayList<Item> freezable = new ArrayList<>();
            // does not reach inside of containers
            for (Item i : hero.belongings.backpack.items) {
                if ((i instanceof Potion && !(i instanceof PotionOfStrength || i instanceof PotionOfMight)) || i instanceof MysteryMeat) {
                    freezable.add(i);
                }
            }
            if (!freezable.isEmpty()) {
                Item toFreeze = Random.element(freezable).detach(hero.belongings.backpack);
                if (toFreeze instanceof Potion) {
                    ((Potion) toFreeze).shatter(hero.pos);
                } else if (toFreeze instanceof MysteryMeat) {
                    FrozenCarpaccio carpaccio = new FrozenCarpaccio();
                    if (!carpaccio.collect(hero.belongings.backpack)) {
                        Dungeon.level.drop(carpaccio, target.pos).sprite.drop();
                    }
                }
                GLog.w(Messages.get(this, "freezes", toFreeze.toString()));
            }
        } else if (target instanceof Thief) {
            Item item = ((Thief) target).item;
            if (item instanceof Potion && !(item instanceof PotionOfStrength || item instanceof PotionOfMight)) {
                ((Potion) ((Thief) target).item).shatter(target.pos);
                ((Thief) target).item = null;
            } else if (item instanceof MysteryMeat) {
                ((Thief) target).item = new FrozenCarpaccio();
                ;
            }
        }
        return true;
    } else {
        return false;
    }
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) FrozenCarpaccio(com.shatteredpixel.shatteredpixeldungeon.items.food.FrozenCarpaccio) PotionOfMight(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight) Potion(com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion) PotionOfStrength(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength) Thief(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero) ArrayList(java.util.ArrayList) MysteryMeat(com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat)

Example 3 with Thief

use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Multiplicity method proc.

@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
    if (Random.Int(20) == 0) {
        ArrayList<Integer> spawnPoints = new ArrayList<>();
        for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
            int p = defender.pos + PathFinder.NEIGHBOURS8[i];
            if (Actor.findChar(p) == null && (Dungeon.level.passable[p] || Dungeon.level.avoid[p])) {
                spawnPoints.add(p);
            }
        }
        if (spawnPoints.size() > 0) {
            Mob m = null;
            if (Random.Int(2) == 0 && defender instanceof Hero) {
                m = new MirrorImage();
                ((MirrorImage) m).duplicate((Hero) defender);
            } else {
                // FIXME should probably have a mob property for this
                if (attacker.properties().contains(Char.Property.BOSS) || attacker.properties().contains(Char.Property.MINIBOSS) || attacker instanceof Mimic || attacker instanceof Statue) {
                    m = Dungeon.level.createMob();
                } else {
                    try {
                        Actor.fixTime();
                        m = (Mob) attacker.getClass().newInstance();
                        Bundle store = new Bundle();
                        attacker.storeInBundle(store);
                        m.restoreFromBundle(store);
                        m.HP = m.HT;
                        // If a thief has stolen an item, that item is not duplicated.
                        if (m instanceof Thief) {
                            ((Thief) m).item = null;
                        }
                    } catch (Exception e) {
                        ShatteredPixelDungeon.reportException(e);
                        m = null;
                    }
                }
            }
            if (m != null) {
                GameScene.add(m);
                ScrollOfTeleportation.appear(m, Random.element(spawnPoints));
            }
        }
    }
    return damage;
}
Also used : MirrorImage(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.MirrorImage) Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Mimic(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic) Statue(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue) Bundle(com.watabou.utils.Bundle) Thief(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief) ArrayList(java.util.ArrayList) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)

Aggregations

Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)3 Thief (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief)3 ArrayList (java.util.ArrayList)3 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)2 MysteryMeat (com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat)2 Fire (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire)1 Mimic (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic)1 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)1 Statue (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue)1 MirrorImage (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.MirrorImage)1 Brimstone (com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone)1 ChargrilledMeat (com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat)1 FrozenCarpaccio (com.shatteredpixel.shatteredpixeldungeon.items.food.FrozenCarpaccio)1 Potion (com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion)1 PotionOfMight (com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight)1 PotionOfStrength (com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength)1 Scroll (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll)1 ScrollOfMagicalInfusion (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion)1 ScrollOfUpgrade (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade)1 Bundle (com.watabou.utils.Bundle)1