@Override public boolean doPickUp(Hero hero) { DewVial vial = hero.belongings.getItem(DewVial.class); if (vial == null || vial.isFull()) { int value = 2 + (Dungeon.depth - 1) / 5; if (hero.heroClass == HeroClass.HUNTRESS) { value++; } int effect = Math.min(hero.HT - hero.HP, value * quantity); if (effect > 0) { hero.HP += effect; hero.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1); hero.sprite.showStatus(CharSprite.POSITIVE, TXT_VALUE, effect); } } else if (vial != null) { vial.collectDew(this); } Sample.INSTANCE.play(Assets.SND_DEWDROP); hero.spendAndNext(TIME_TO_PICK_UP); return true; }
@Override public ArrayList<String> actions(Hero hero) { ArrayList<String> actions = super.actions(hero); DewVial vial = hero.belongings.getItem(DewVial.class); if (vial != null && vial.isFull() && !blessed) actions.add(AC_BLESS); return actions; }
@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); } }