Search in sources :

Example 1 with ScrollOfWipeOut

use of com.watabou.pixeldungeon.items.scrolls.ScrollOfWipeOut in project pixel-dungeon by watabou.

the class SacrificialFire method sacrifice.

public static void sacrifice(Char ch) {
    Wound.hit(ch);
    SacrificialFire fire = (SacrificialFire) Dungeon.level.blobs.get(SacrificialFire.class);
    if (fire != null) {
        int exp = 0;
        if (ch instanceof Mob) {
            exp = ((Mob) ch).exp() * Random.IntRange(1, 3);
        } else if (ch instanceof Hero) {
            exp = ((Hero) ch).maxExp();
        }
        if (exp > 0) {
            int volume = fire.volume - exp;
            if (volume > 0) {
                fire.seed(fire.pos, volume);
                GLog.w(TXT_WORTHY);
            } else {
                fire.seed(fire.pos, 0);
                Journal.remove(Feature.SACRIFICIAL_FIRE);
                GLog.w(TXT_REWARD);
                GameScene.effect(new Flare(7, 32).color(0x66FFFF, true).show(ch.sprite.parent, DungeonTilemap.tileCenterToWorld(fire.pos), 2f));
                Dungeon.level.drop(new ScrollOfWipeOut(), fire.pos).sprite.drop();
            }
        } else {
            GLog.w(TXT_UNWORTHY);
        }
    }
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Flare(com.watabou.pixeldungeon.effects.Flare) Hero(com.watabou.pixeldungeon.actors.hero.Hero) ScrollOfWipeOut(com.watabou.pixeldungeon.items.scrolls.ScrollOfWipeOut)

Aggregations

Hero (com.watabou.pixeldungeon.actors.hero.Hero)1 Mob (com.watabou.pixeldungeon.actors.mobs.Mob)1 Flare (com.watabou.pixeldungeon.effects.Flare)1 ScrollOfWipeOut (com.watabou.pixeldungeon.items.scrolls.ScrollOfWipeOut)1