V0.1.1: Blandfruit implemented. All functional parts of V0.1.1 completed, need cleanup & testing

This commit is contained in:
Evan Debenham
2014-08-14 17:27:54 -04:00
parent 94591b7d32
commit 40f2ea2529
7 changed files with 103 additions and 15 deletions
@@ -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;
@@ -239,19 +240,33 @@ 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) {
count += item.quantity;
chances[index++] = item.quantity;
} else {
} else{
count = 0;
break;
}
}
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: