@Override public void execute(Hero hero, String action) { if (action.equals(AC_READ)) { if (hero.buff(Blindness.class) != null) GLog.w("You cannot read from the book while blinded."); else if (!isEquipped(hero)) GLog.i("You need to equip your spellbook to do that."); else if (charge == 0) GLog.i("Your spellbook is out of energy for now."); else if (cursed) GLog.i("Your cannot read from a cursed spellbook."); else { charge--; Scroll scroll; do { scroll = (Scroll) Generator.random(Generator.Category.SCROLL); } while (scroll == null || // gotta reduce the rate on these scrolls or that'll be all the item does. ((scroll instanceof ScrollOfIdentify || scroll instanceof ScrollOfRemoveCurse || scroll instanceof ScrollOfMagicMapping) && Random.Int(2) == 0)); scroll.ownedByBook = true; scroll.execute(hero, AC_READ); } } else if (action.equals(AC_ADD)) { GameScene.selectItem(itemSelector, mode, inventoryTitle); } else super.execute(hero, action); }