@Override public int attackProc(Char enemy, int damage) { int reg = Math.min(damage, HT - HP); if (reg > 0) { HP += reg; sprite.emitter().burst(Speck.factory(Speck.HEALING), 1); } return damage; }
@Override public void activate(Char ch) { super.activate(ch); if (ch != null) { int len = Random.Int(5, 10); Buff.prolong(ch, Blindness.class, len); Buff.prolong(ch, Cripple.class, len); if (ch instanceof Mob) { if (((Mob) ch).state == ((Mob) ch).HUNTING) ((Mob) ch).state = ((Mob) ch).WANDERING; ((Mob) ch).beckon(Dungeon.level.randomDestination()); } } if (Dungeon.visible[pos]) { CellEmitter.get(pos).burst(Speck.factory(Speck.LIGHT), 4); } }
@Override public void execute(Hero hero, String action) { if (action.equals(AC_EAT)) { detach(hero.belongings.backpack); ((Hunger) hero.buff(Hunger.class)).satisfy(energy); GLog.i(message); switch (hero.heroClass) { case WARRIOR: if (hero.HP < hero.HT) { hero.HP = Math.min(hero.HP + 5, hero.HT); hero.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1); } break; case MAGE: hero.belongings.charge(false); ScrollOfRecharging.charge(hero); break; case ROGUE: case HUNTRESS: break; } hero.sprite.operate(hero.pos); hero.busy(); SpellSprite.show(hero, SpellSprite.FOOD); Sample.INSTANCE.play(Assets.SND_EAT); hero.spend(TIME_TO_EAT); Statistics.foodEaten++; Badges.validateFoodEaten(); } else { super.execute(hero, action); } }
/* * @Override public void draw() { GLES20.glBlendFunc( GL10.GL_SRC_ALPHA, * GL10.GL_ONE ); super.draw(); GLES20.glBlendFunc( GL10.GL_SRC_ALPHA, * GL10.GL_ONE_MINUS_SRC_ALPHA ); } */ @Override public void die() { super.die(); emitter().start(ShaftParticle.FACTORY, 0.3f, 4); emitter().start(Speck.factory(Speck.LIGHT), 0.2f, 3); }
@Override public void use(BlobEmitter emitter) { super.use(emitter); emitter.pour(Speck.factory(Speck.STENCH), 0.6f); }