From ad87d1520c25c0be84d944c8a1f749e028713cea Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 12 Aug 2014 16:59:12 -0400 Subject: [PATCH] V0.1.1: BlandFruit partially coded, not implemented. --- .../shatteredpixeldungeon/items/Item.java | 2 +- .../items/food/BlandFruit.java | 107 ++++++++++++++++++ 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/items/food/BlandFruit.java diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java index 4e2c7ec7f..5131ef601 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java @@ -63,7 +63,7 @@ public class Item implements Bundlable { public String defaultAction; protected String name = "smth"; - protected int image = 0; + public int image = 0; public boolean stackable = false; protected int quantity = 1; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/BlandFruit.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/BlandFruit.java new file mode 100644 index 000000000..e5e28e6c8 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/BlandFruit.java @@ -0,0 +1,107 @@ +package com.shatteredpixel.shatteredpixeldungeon.items.food; + +import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.*; +import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; + +/** + * Created by debenhame on 12/08/2014. + */ +public class BlandFruit extends Food { + + public String message = "You eat the BlandFruit, bleugh!"; + public String info = "So dry and insubstantial, perhaps cooking could improve it."; + public Potion potionAttrib = null; + + { + name = "BlandFruit"; + stackable = false; + image = ItemSpriteSheet.STEAK; + energy = (Hunger.STARVING - Hunger.HUNGRY)/2; + } + + @Override + public void execute( Hero hero, String action ) { + if (potionAttrib == null){ + + super.execute(hero, action); + + } else if (action.equals( AC_EAT )){ + + ((Hunger)hero.buff( Hunger.class )).satisfy( Hunger.HUNGRY ); + + detach( hero.belongings.backpack ); + + hero.spend( 1f ); + hero.busy(); + potionAttrib.apply(hero); + + Sample.INSTANCE.play( Assets.SND_EAT ); + + hero.sprite.operate(hero.pos); + + } else if (action.equals( AC_THROW )){ + + //need to finish this + GameScene.selectCell(thrower); + potionAttrib.splash(hero.pos); + + } else { + super.execute(hero, action); + } + } + + @Override + public String info() { + return info; + } + + @Override + public int price() { + return 20 * quantity; + } + + public Item cook(Seed seed){ + Class plant = seed.alchemyClass; + + + try { + potionAttrib = (Potion)plant.newInstance(); + } catch (Exception e) { + return null; + } + + //implement pixmap + potionAttrib.image = 0; + + //need to finish this + if (potionAttrib instanceof PotionOfHealing){ + name = "HealFruit"; + message = ""; + info = ""; + } else if (potionAttrib instanceof PotionOfStrength){ + + } else if (potionAttrib instanceof PotionOfParalyticGas){ + + } else if (potionAttrib instanceof PotionOfInvisibility){ + + } else if (potionAttrib instanceof PotionOfLiquidFlame){ + + } else if (potionAttrib instanceof PotionOfFrost){ + + } else if (potionAttrib instanceof PotionOfMindVision){ + + } else if (potionAttrib instanceof PotionOfToxicGas){ + + } else { + + } + return this; + } + +}