@Override public void execute( Hero hero, String action ) { if (action.equals( AC_EAT ) && potionAttrib == null) { GLog.w( Messages.get(this, "raw")); return; } super.execute(hero, action); if (action.equals( AC_EAT ) && potionAttrib != null){ potionAttrib.apply(hero); } }
@Override public boolean isSimilar( Item item ) { if ( super.isSimilar(item) ){ Blandfruit other = (Blandfruit) item; if (potionAttrib == null && other.potionAttrib == null) { return true; } else if (potionAttrib != null && other.potionAttrib != null && potionAttrib.isSimilar(other.potionAttrib)){ return true; } } return false; }
@Override protected void onThrow(int cell) { if (Dungeon.level.map[cell] == Terrain.WELL || Dungeon.level.pit[cell]) { super.onThrow( cell ); } else if (potionAttrib instanceof PotionOfLiquidFlame || potionAttrib instanceof PotionOfToxicGas || potionAttrib instanceof PotionOfParalyticGas || potionAttrib instanceof PotionOfFrost || potionAttrib instanceof PotionOfLevitation || potionAttrib instanceof PotionOfPurity) { potionAttrib.shatter( cell ); Dungeon.level.drop(new Chunks(), cell).sprite.drop(); } else { super.onThrow( cell ); } }
@Override public void execute( Hero hero, String action ) { super.execute( hero, action ); if (action.equals( AC_EAT )) { detach( hero.belongings.backpack ); satisfy(hero); GLog.i( message ); foodProc( hero ); 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(); } }
@Override protected void satisfy(Hero hero) { super.satisfy(hero); effect(hero); }
result.add(null); result.add(new QuickRecipe( new MeatPie.Recipe(), new ArrayList<Item>(Arrays.asList(new Pasty(), new Food(), new MysteryMeat.PlaceHolder())), new MeatPie())); result.add(null);
@Override public void reset() { if (potionAttrib != null) imbuePotion(potionAttrib); else super.reset(); }
@Override public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); if (bundle.contains(POTIONATTRIB)) { imbuePotion((Potion) bundle.get(POTIONATTRIB)); } }
@Override public String desc() { if (potionAttrib== null) { return super.desc(); } else { String desc = Messages.get(this, "desc_cooked") + "\n\n"; if (potionAttrib instanceof PotionOfFrost || potionAttrib instanceof PotionOfLiquidFlame || potionAttrib instanceof PotionOfToxicGas || potionAttrib instanceof PotionOfParalyticGas) { desc += Messages.get(this, "desc_throw"); } else { desc += Messages.get(this, "desc_eat"); } return desc; } }
hero.buff(Hunger.class).satisfy((Hunger.STARVING/10) * chargesToUse); Food.foodProc( hero );
@Override public void execute( Hero hero, String action ) { super.execute( hero, action ); if (action.equals( AC_EAT )) { detach( hero.belongings.backpack ); satisfy(hero); GLog.i( message ); foodProc( hero ); 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(); } }
@Override protected void satisfy(Hero hero) { super.satisfy(hero); effect(hero); }
private static void initCommon( Hero hero ) { Item i = new ClothArmor().identify(); if (!Challenges.isItemBlocked(i)) hero.belongings.armor = (ClothArmor)i; i = new Food(); if (!Challenges.isItemBlocked(i)) i.collect(); if (Dungeon.isChallenged(Challenges.NO_FOOD)){ new SmallRation().collect(); } new ScrollOfIdentify().identify(); }
@Override public void reset() { if (potionAttrib != null) imbuePotion(potionAttrib); else super.reset(); }
@Override public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); if (bundle.contains(POTIONATTRIB)) { imbuePotion((Potion) bundle.get(POTIONATTRIB)); } }
@Override public String desc() { if (potionAttrib== null) { return super.desc(); } else { String desc = Messages.get(this, "desc_cooked") + "\n\n"; if (potionAttrib instanceof PotionOfFrost || potionAttrib instanceof PotionOfLiquidFlame || potionAttrib instanceof PotionOfToxicGas || potionAttrib instanceof PotionOfParalyticGas) { desc += Messages.get(this, "desc_throw"); } else { desc += Messages.get(this, "desc_eat"); } return desc; } }
hero.buff(Hunger.class).satisfy((Hunger.STARVING/10) * chargesToUse); Food.foodProc( hero );
@Override protected void satisfy(Hero hero) { super.satisfy(hero); effect(hero); }
private static void initCommon( Hero hero ) { Item i = new ClothArmor().identify(); if (!Challenges.isItemBlocked(i)) hero.belongings.armor = (ClothArmor)i; i = new Food(); if (!Challenges.isItemBlocked(i)) i.collect(); if (Dungeon.isChallenged(Challenges.NO_FOOD)){ new SmallRation().collect(); } new ScrollOfIdentify().identify(); }
@Override public void reset() { super.reset(); switch(holiday){ case NONE: name = Messages.get(this, "pasty"); image = ItemSpriteSheet.PASTY; break; case HWEEN: name = Messages.get(this, "pie"); image = ItemSpriteSheet.PUMPKIN_PIE; break; case XMAS: name = Messages.get(this, "cane"); image = ItemSpriteSheet.CANDY_CANE; break; } }