diff --git a/assets/items.png b/assets/items.png index 9fd3e9be4..1012c62bd 100644 Binary files a/assets/items.png and b/assets/items.png differ diff --git a/assets/plants.png b/assets/plants.png index af9f52a3e..be7ee6222 100644 Binary files a/assets/plants.png and b/assets/plants.png differ diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java index c19675663..c199faf08 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java @@ -184,8 +184,9 @@ public class Generator { Sungrass.Seed.class, Earthroot.Seed.class, Fadeleaf.Seed.class, - Rotberry.Seed.class }; - Category.SEED.probs = new float[]{ 1, 1, 1, 1, 1, 1, 1, 0 }; + Rotberry.Seed.class, + BlandfruitBush.Seed.class}; + Category.SEED.probs = new float[]{ 7, 7, 7, 7, 7, 7, 7, 0, 1 }; } public static void reset() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java index 357d1f83f..5215e6b38 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java @@ -242,12 +242,13 @@ public class Heap implements Bundlable { int count = 0; - if (items.get(0) instanceof Blandfruit && items.get(1) instanceof Seed) { + if (items.size() == 2 && items.get(0) instanceof Seed && items.get(1) instanceof Blandfruit ) { + Sample.INSTANCE.play( Assets.SND_PUFF ); CellEmitter.center( pos ).burst( Speck.factory( Speck.EVOKE ), 3 ); Blandfruit result = new Blandfruit(); - result.cook((Seed)items.get(1)); + result.cook((Seed)items.get(0)); destroy(); @@ -266,7 +267,7 @@ public class Heap implements Bundlable { } } - } else if (count >= SEEDS_TO_POTION) { + if (count >= SEEDS_TO_POTION) { CellEmitter.get( pos ).burst( Speck.factory( Speck.WOOL ), 6 ); Sample.INSTANCE.play( Assets.SND_PUFF ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java index 617d7cc88..9ff6170c0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java @@ -18,6 +18,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.audio.Sample; +import com.watabou.utils.Bundle; import com.watabou.utils.Random; /** @@ -232,22 +233,22 @@ public class Blandfruit extends Food { super.restoreFromBundle(bundle); name = bundle.getString(NAME); - if (name == "Healthfruit") + if (name.equals("Healthfruit")) cook(new Sungrass.Seed()); - else if (name == "Powerfruit") + else if (name.equals("Powerfruit")) //TODO: make sure this doesn't break anything cook(new Wandmaker.Rotberry.Seed()); - else if (name == "Paralyzefruit") + else if (name.equals("Paralyzefruit")) cook(new Earthroot.Seed()); - else if (name == "Invisifruit") + else if (name.equals("Invisifruit")) cook(new Blindweed.Seed()); - else if (name == "Flamefruit") + else if (name.equals("Flamefruit")) cook(new Firebloom.Seed()); - else if (name == "Frostfruit") + else if (name.equals("Frostfruit")) cook(new Icecap.Seed()); - else if (name == "Visionfruit") + else if (name.equals("Visionfruit")) cook(new Fadeleaf.Seed()); - else if (name == "Toxicfruit") + else if (name.equals("Toxicfruit")) cook(new Sorrowmoss.Seed()); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 2fa995b18..fa9828576 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -23,6 +23,8 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; +import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; +import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush; import com.watabou.noosa.Scene; import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; @@ -504,7 +506,8 @@ public abstract class Level implements Bundlable { public Heap drop( Item item, int cell ) { - if ((map[cell] == Terrain.ALCHEMY) && !(item instanceof Plant.Seed)) { + if ((map[cell] == Terrain.ALCHEMY) && (item instanceof BlandfruitBush.Seed || !(item instanceof Plant.Seed || + (item instanceof Blandfruit && ((Blandfruit) item).potionAttrib == null && heaps.get(cell) == null)))) { int n; do { n = cell + NEIGHBOURS8[Random.Int( 8 )]; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/AlchemyPot.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/AlchemyPot.java index 382e38adc..1486ca18c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/AlchemyPot.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/AlchemyPot.java @@ -37,10 +37,11 @@ public class AlchemyPot { private static final String TXT_OPTIONS = "Do you want to cook a Blandfruit with a seed, or brew a Potion from seeds?"; - private static Hero hero; - private static int pos; + public static Hero hero; + public static int pos; - public static boolean cookingFruit; + public static boolean foundFruit; + public static Item curItem = null; public static void operate( Hero hero, int pos ) { @@ -48,31 +49,30 @@ public class AlchemyPot { AlchemyPot.pos = pos; Iterator items = hero.belongings.iterator(); - Item curItem = null; - cookingFruit = false; + foundFruit = false; Heap heap = Dungeon.level.heaps.get( pos ); if (heap == null) - while (items.hasNext() && cookingFruit == false){ + while (items.hasNext() && !foundFruit){ curItem = items.next(); - if (curItem instanceof Blandfruit) - if (((Blandfruit) curItem).potionAttrib == null) + if (curItem instanceof Blandfruit && ((Blandfruit) curItem).potionAttrib == null){ GameScene.show( - new WndOptions( TXT_POT, TXT_OPTIONS, TXT_FRUIT, TXT_POTION ){ - @Override - protected void onSelect( int index ) { - if (index == 0) - cookingFruit = true; + new WndOptions(TXT_POT, TXT_OPTIONS, TXT_FRUIT, TXT_POTION) { + @Override + protected void onSelect(int index) { + if (index == 0) { + curItem.cast( AlchemyPot.hero, AlchemyPot.pos ); + } else + GameScene.selectItem(itemSelector, WndBag.Mode.SEED, TXT_SELECT_SEED); + } } - } - ); + ); + foundFruit = true; + } } - if (cookingFruit) { - curItem.cast( hero, pos ); - } else { + if (!foundFruit) GameScene.selectItem(itemSelector, WndBag.Mode.SEED, TXT_SELECT_SEED); - } } private static final WndBag.Listener itemSelector = new WndBag.Listener() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/plants/BlandfruitBush.java b/src/com/shatteredpixel/shatteredpixeldungeon/plants/BlandfruitBush.java index 27d5eaf4b..8e8e4e5e2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/plants/BlandfruitBush.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/plants/BlandfruitBush.java @@ -2,15 +2,8 @@ package com.shatteredpixel.shatteredpixeldungeon.plants; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple; -import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; -import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; -import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; -import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfInvisibility; +import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; -import com.watabou.utils.Random; /** * Created by Evan on 13/08/2014. @@ -30,7 +23,7 @@ public class BlandfruitBush extends Plant { public void activate( Char ch ) { super.activate( ch ); - Dungeon.level.drop( new Seed(), pos ).sprite.drop(); + Dungeon.level.drop( new Blandfruit(), pos ).sprite.drop(); } @Override @@ -43,7 +36,7 @@ public class BlandfruitBush extends Plant { plantName = "Blandfruit"; name = "seed of " + plantName; - image = ItemSpriteSheet.SEED_BLINDWEED; + image = ItemSpriteSheet.SEED_BLANDFRUIT; plantClass = BlandfruitBush.class; alchemyClass = null; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java index 82892ff69..123cc48df 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java @@ -129,6 +129,7 @@ public class ItemSpriteSheet { public static final int SEED_EARTHROOT = 93; public static final int SEED_FADELEAF = 94; public static final int SEED_ROTBERRY = 95; + public static final int SEED_BLANDFRUIT = 118; // Quest items public static final int ROSE = 100;