Search in sources :

Example 1 with WndSadGhost

use of com.watabou.pixeldungeon.windows.WndSadGhost in project pixel-dungeon-remix by NYRDS.

the class Ghost method interact.

@Override
public boolean interact(final Hero hero) {
    getSprite().turnTo(getPos(), hero.getPos());
    if (hero.heroClass.equals(HeroClass.NECROMANCER)) {
        if (!introduced) {
            window = new WndSadGhostNecro();
            GameScene.show(window);
            introduced = true;
            return true;
        } else {
            if (window != null) {
                persuade = window.getPersuade();
            }
        }
    }
    Sample.INSTANCE.play(Assets.SND_GHOST);
    if (persuade || Quest.given) {
        Item item = Quest.alternative ? hero.belongings.getItem(RatSkull.class) : hero.belongings.getItem(DriedRose.class);
        if (persuade) {
            item = Quest.alternative ? new RatSkull() : new DriedRose();
        }
        if (persuade || item != null) {
            GameScene.show(new WndSadGhost(this, item));
        } else {
            GameScene.show(new WndQuest(this, Quest.alternative ? TXT_RAT2 : TXT_ROSE2));
            int newPos = -1;
            for (int i = 0; i < 10; i++) {
                newPos = Dungeon.level.randomRespawnCell();
                if (newPos != -1) {
                    break;
                }
            }
            if (newPos != -1) {
                Actor.freeCell(getPos());
                CellEmitter.get(getPos()).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
                setPos(newPos);
                getSprite().place(getPos());
                getSprite().setVisible(Dungeon.visible[getPos()]);
            }
        }
    } else {
        GameScene.show(new WndQuest(this, Quest.alternative ? TXT_RAT1 : TXT_ROSE1));
        Quest.given = true;
        Journal.add(Journal.Feature.GHOST.desc());
    }
    return true;
}
Also used : Item(com.watabou.pixeldungeon.items.Item) WndQuest(com.watabou.pixeldungeon.windows.WndQuest) WndSadGhostNecro(com.nyrds.pixeldungeon.windows.WndSadGhostNecro) WndSadGhost(com.watabou.pixeldungeon.windows.WndSadGhost) DriedRose(com.watabou.pixeldungeon.items.quest.DriedRose) RatSkull(com.watabou.pixeldungeon.items.quest.RatSkull)

Aggregations

WndSadGhostNecro (com.nyrds.pixeldungeon.windows.WndSadGhostNecro)1 Item (com.watabou.pixeldungeon.items.Item)1 DriedRose (com.watabou.pixeldungeon.items.quest.DriedRose)1 RatSkull (com.watabou.pixeldungeon.items.quest.RatSkull)1 WndQuest (com.watabou.pixeldungeon.windows.WndQuest)1 WndSadGhost (com.watabou.pixeldungeon.windows.WndSadGhost)1