V0.1.1: Blandfruit implemented. All functional parts of V0.1.1 completed, need cleanup & testing
This commit is contained in:
parent
94591b7d32
commit
40f2ea2529
|
@ -1099,6 +1099,7 @@ public class Hero extends Char {
|
|||
Ankh ankh = (Ankh)belongings.getItem( Ankh.class );
|
||||
if (ankh != null && ankh.isBlessed()) {
|
||||
this.HP = HT;
|
||||
//TODO: add sparkle effect
|
||||
new Flare(8, 32).color(0xFFFF66, true).show(sprite, 2f);
|
||||
|
||||
ankh.detach(belongings.backpack);
|
||||
|
|
|
@ -79,6 +79,8 @@ public class Ankh extends Item {
|
|||
hero.spend( 1f );
|
||||
hero.busy();
|
||||
|
||||
//TODO: add sparkle effect
|
||||
|
||||
Sample.INSTANCE.play( Assets.SND_DRINK );
|
||||
hero.sprite.operate( hero.pos );
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items;
|
|||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
|
@ -240,6 +241,20 @@ public class Heap implements Bundlable {
|
|||
float chances[] = new float[items.size()];
|
||||
int count = 0;
|
||||
|
||||
|
||||
if (items.get(0) instanceof Blandfruit && items.get(1) instanceof Seed) {
|
||||
|
||||
CellEmitter.center( pos ).burst( Speck.factory( Speck.EVOKE ), 3 );
|
||||
|
||||
Blandfruit result = new Blandfruit();
|
||||
result.cook((Seed)items.get(1));
|
||||
|
||||
destroy();
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
for (Item item : items) {
|
||||
if (item instanceof Seed) {
|
||||
|
@ -251,7 +266,7 @@ public class Heap implements Bundlable {
|
|||
}
|
||||
}
|
||||
|
||||
if (count >= SEEDS_TO_POTION) {
|
||||
} else if (count >= SEEDS_TO_POTION) {
|
||||
|
||||
CellEmitter.get( pos ).burst( Speck.factory( Speck.WOOL ), 6 );
|
||||
Sample.INSTANCE.play( Assets.SND_PUFF );
|
||||
|
|
|
@ -5,12 +5,14 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.*;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Wandmaker;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.*;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.*;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
@ -25,6 +27,7 @@ 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;
|
||||
public ItemSprite.Glowing potionGlow = null;
|
||||
|
||||
|
@ -77,7 +80,7 @@ public class Blandfruit extends Food {
|
|||
Buff.affect(hero, Invisibility.class, Invisibility.DURATION);
|
||||
break;
|
||||
case 1:
|
||||
GLog.i( "You feel your skin hardens!" );
|
||||
GLog.i( "You feel your skin harden!" );
|
||||
Buff.affect( hero, Barkskin.class ).level( hero.HT / 4 );
|
||||
break;
|
||||
case 2:
|
||||
|
@ -155,7 +158,6 @@ public class Blandfruit extends Food {
|
|||
return null;
|
||||
}
|
||||
|
||||
//implement pixmap
|
||||
potionAttrib.image = ItemSpriteSheet.BLANDFRUIT;
|
||||
|
||||
if (potionAttrib instanceof PotionOfHealing){
|
||||
|
@ -165,7 +167,6 @@ public class Blandfruit extends Food {
|
|||
info = "The fruit has plumped up from its time soaking in the pot and has even absorbed the properties "+
|
||||
"of the Sungrass seed it was cooked with. It looks delicious and hearty, ready to be eaten!";
|
||||
|
||||
|
||||
} else if (potionAttrib instanceof PotionOfStrength){
|
||||
|
||||
name = "Powerfruit";
|
||||
|
@ -220,6 +221,39 @@ public class Blandfruit extends Food {
|
|||
return this;
|
||||
}
|
||||
|
||||
public static final String NAME = "name";
|
||||
|
||||
@Override
|
||||
public void storeInBundle(Bundle bundle){
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put(NAME name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle(Bundle bundle){
|
||||
super.restoreFromBundle(bundle);
|
||||
name = bundle.getString(NAME);
|
||||
|
||||
if (name == "Healthfruit")
|
||||
cook(new Sungrass.Seed());
|
||||
else if (name == "Powerfruit")
|
||||
//TODO: make sure this doesn't break anything
|
||||
cook(new Wandmaker.Rotberry.Seed());
|
||||
else if (name == "Paralyzefruit")
|
||||
cook(new Earthroot.Seed());
|
||||
else if (name == "Invisifruit")
|
||||
cook(new Blindweed.Seed());
|
||||
else if (name == "Flamefruit")
|
||||
cook(new Firebloom.Seed());
|
||||
else if (name == "Frostfruit")
|
||||
cook(new Icecap.Seed());
|
||||
else if (name == "Visionfruit")
|
||||
cook(new Fadeleaf.Seed());
|
||||
else if (name == "Toxicfruit")
|
||||
cook(new Sorrowmoss.Seed());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemSprite.Glowing glowing() {
|
||||
|
|
|
@ -52,7 +52,7 @@ public class FrozenCarpaccio extends Food {
|
|||
Buff.affect( hero, Invisibility.class, Invisibility.DURATION );
|
||||
break;
|
||||
case 1:
|
||||
GLog.i( "You feel your skin hardens!" );
|
||||
GLog.i( "You feel your skin harden!" );
|
||||
Buff.affect( hero, Barkskin.class ).level( hero.HT / 4 );
|
||||
break;
|
||||
case 2:
|
||||
|
|
|
@ -17,25 +17,63 @@
|
|||
*/
|
||||
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_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;
|
||||
|
||||
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() {
|
||||
@Override
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.watabou.utils.Random;
|
|||
public class BlandfruitBush extends Plant {
|
||||
|
||||
private static final String TXT_DESC =
|
||||
"Distant cousin of the Rotberry, the pear-shaped produce of the Blandfruit bush tastes like mushy chalk. " +
|
||||
"Distant cousin of the Rotberry, the pear-shaped produce of the Blandfruit bush tastes like caked dust. " +
|
||||
"The fruit is gross and unsubstantial but isn't poisonous. perhaps it could be cooked.";
|
||||
|
||||
{
|
||||
|
@ -30,9 +30,7 @@ public class BlandfruitBush extends Plant {
|
|||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
|
||||
if (ch != null) {
|
||||
//need to implement this
|
||||
}
|
||||
Dungeon.level.drop( new Seed(), pos ).sprite.drop();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,7 +46,7 @@ public class BlandfruitBush extends Plant {
|
|||
image = ItemSpriteSheet.SEED_BLINDWEED;
|
||||
|
||||
plantClass = BlandfruitBush.class;
|
||||
alchemyClass = PotionOfInvisibility.class;
|
||||
alchemyClass = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user