@Override public void onSelect(Item item) { if (item != null && item instanceof Scroll && item.isIdentified()) { String scroll = convertName(item.getClass().getSimpleName()); Hero hero = Dungeon.hero; for (int i = 0; (i <= 1 && i < scrolls.size()); i++) { if (scrolls.get(i).equals(scroll)) { hero.sprite.operate(hero.pos); hero.busy(); hero.spend(2f); Sample.INSTANCE.play(Assets.SND_BURNING); hero.sprite.emitter().burst(ElmoParticle.FACTORY, 12); scrolls.remove(i); item.detach(hero.belongings.backpack); upgrade(); GLog.i("You infuse the scroll's energy into the book."); return; } } if (item != null) GLog.w("You are unable to add this scroll to the book."); } else if (item instanceof Scroll && !item.isIdentified()) GLog.w("You're not sure what type of scroll this is yet."); }
@Override public void execute(final Hero hero, String action) { if (action.equals(AC_BLESS)) { DewVial vial = hero.belongings.getItem(DewVial.class); if (vial != null) { blessed = true; vial.empty(); GLog.p(TXT_BLESS); hero.spend(1f); hero.busy(); Sample.INSTANCE.play(Assets.SND_DRINK); CellEmitter.get(hero.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3); hero.sprite.operate(hero.pos); } } else { super.execute(hero, action); } }