V0.1.1: Blandfruit implemented. All functional parts of V0.1.1 completed, need cleanup & testing
This commit is contained in:
@@ -17,24 +17,62 @@
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.levels.features;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class AlchemyPot {
|
||||
|
||||
private static final String TXT_SELECT_SEED = "Select a seed to throw";
|
||||
private static final String TXT_SELECT_SEED = "Select a seed to throw";
|
||||
private static final String TXT_POT = "Alchemy Pot";
|
||||
private static final String TXT_FRUIT = "Cook a Blandfruit";
|
||||
private static final String TXT_POTION = "Brew a Potion";
|
||||
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 boolean cookingFruit;
|
||||
|
||||
public static void operate( Hero hero, int pos ) {
|
||||
|
||||
AlchemyPot.hero = hero;
|
||||
AlchemyPot.pos = pos;
|
||||
|
||||
GameScene.selectItem( itemSelector, WndBag.Mode.SEED, TXT_SELECT_SEED );
|
||||
|
||||
Iterator<Item> items = hero.belongings.iterator();
|
||||
Item curItem = null;
|
||||
cookingFruit = false;
|
||||
Heap heap = Dungeon.level.heaps.get( pos );
|
||||
|
||||
if (heap == null)
|
||||
while (items.hasNext() && cookingFruit == false){
|
||||
curItem = items.next();
|
||||
if (curItem instanceof Blandfruit)
|
||||
if (((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;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (cookingFruit) {
|
||||
curItem.cast( hero, pos );
|
||||
} else {
|
||||
GameScene.selectItem(itemSelector, WndBag.Mode.SEED, TXT_SELECT_SEED);
|
||||
}
|
||||
}
|
||||
|
||||
private static final WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
|
||||
Reference in New Issue
Block a user