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 );
|
Ankh ankh = (Ankh)belongings.getItem( Ankh.class );
|
||||||
if (ankh != null && ankh.isBlessed()) {
|
if (ankh != null && ankh.isBlessed()) {
|
||||||
this.HP = HT;
|
this.HP = HT;
|
||||||
|
//TODO: add sparkle effect
|
||||||
new Flare(8, 32).color(0xFFFF66, true).show(sprite, 2f);
|
new Flare(8, 32).color(0xFFFF66, true).show(sprite, 2f);
|
||||||
|
|
||||||
ankh.detach(belongings.backpack);
|
ankh.detach(belongings.backpack);
|
||||||
|
|
|
@ -79,6 +79,8 @@ public class Ankh extends Item {
|
||||||
hero.spend( 1f );
|
hero.spend( 1f );
|
||||||
hero.busy();
|
hero.busy();
|
||||||
|
|
||||||
|
//TODO: add sparkle effect
|
||||||
|
|
||||||
Sample.INSTANCE.play( Assets.SND_DRINK );
|
Sample.INSTANCE.play( Assets.SND_DRINK );
|
||||||
hero.sprite.operate( hero.pos );
|
hero.sprite.operate( hero.pos );
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||||
|
@ -240,18 +241,32 @@ public class Heap implements Bundlable {
|
||||||
float chances[] = new float[items.size()];
|
float chances[] = new float[items.size()];
|
||||||
int count = 0;
|
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;
|
int index = 0;
|
||||||
for (Item item : items) {
|
for (Item item : items) {
|
||||||
if (item instanceof Seed) {
|
if (item instanceof Seed) {
|
||||||
count += item.quantity;
|
count += item.quantity;
|
||||||
chances[index++] = item.quantity;
|
chances[index++] = item.quantity;
|
||||||
} else {
|
} else{
|
||||||
count = 0;
|
count = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count >= SEEDS_TO_POTION) {
|
} else if (count >= SEEDS_TO_POTION) {
|
||||||
|
|
||||||
CellEmitter.get( pos ).burst( Speck.factory( Speck.WOOL ), 6 );
|
CellEmitter.get( pos ).burst( Speck.factory( Speck.WOOL ), 6 );
|
||||||
Sample.INSTANCE.play( Assets.SND_PUFF );
|
Sample.INSTANCE.play( Assets.SND_PUFF );
|
||||||
|
|
|
@ -5,12 +5,14 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.*;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.*;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
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.Speck;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.*;
|
import com.shatteredpixel.shatteredpixeldungeon.items.potions.*;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed;
|
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.plants.*;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
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 message = "You eat the Blandfruit, bleugh!";
|
||||||
public String info = "So dry and insubstantial, perhaps cooking could improve it.";
|
public String info = "So dry and insubstantial, perhaps cooking could improve it.";
|
||||||
|
|
||||||
public Potion potionAttrib = null;
|
public Potion potionAttrib = null;
|
||||||
public ItemSprite.Glowing potionGlow = null;
|
public ItemSprite.Glowing potionGlow = null;
|
||||||
|
|
||||||
|
@ -77,7 +80,7 @@ public class Blandfruit extends Food {
|
||||||
Buff.affect(hero, Invisibility.class, Invisibility.DURATION);
|
Buff.affect(hero, Invisibility.class, Invisibility.DURATION);
|
||||||
break;
|
break;
|
||||||
case 1:
|
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 );
|
Buff.affect( hero, Barkskin.class ).level( hero.HT / 4 );
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -155,7 +158,6 @@ public class Blandfruit extends Food {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//implement pixmap
|
|
||||||
potionAttrib.image = ItemSpriteSheet.BLANDFRUIT;
|
potionAttrib.image = ItemSpriteSheet.BLANDFRUIT;
|
||||||
|
|
||||||
if (potionAttrib instanceof PotionOfHealing){
|
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 "+
|
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!";
|
"of the Sungrass seed it was cooked with. It looks delicious and hearty, ready to be eaten!";
|
||||||
|
|
||||||
|
|
||||||
} else if (potionAttrib instanceof PotionOfStrength){
|
} else if (potionAttrib instanceof PotionOfStrength){
|
||||||
|
|
||||||
name = "Powerfruit";
|
name = "Powerfruit";
|
||||||
|
@ -220,6 +221,39 @@ public class Blandfruit extends Food {
|
||||||
return this;
|
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
|
@Override
|
||||||
public ItemSprite.Glowing glowing() {
|
public ItemSprite.Glowing glowing() {
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class FrozenCarpaccio extends Food {
|
||||||
Buff.affect( hero, Invisibility.class, Invisibility.DURATION );
|
Buff.affect( hero, Invisibility.class, Invisibility.DURATION );
|
||||||
break;
|
break;
|
||||||
case 1:
|
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 );
|
Buff.affect( hero, Barkskin.class ).level( hero.HT / 4 );
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
|
|
@ -17,24 +17,62 @@
|
||||||
*/
|
*/
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.levels.features;
|
package com.shatteredpixel.shatteredpixeldungeon.levels.features;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
public class AlchemyPot {
|
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 Hero hero;
|
||||||
private static int pos;
|
private static int pos;
|
||||||
|
|
||||||
|
public static boolean cookingFruit;
|
||||||
|
|
||||||
public static void operate( Hero hero, int pos ) {
|
public static void operate( Hero hero, int pos ) {
|
||||||
|
|
||||||
AlchemyPot.hero = hero;
|
AlchemyPot.hero = hero;
|
||||||
AlchemyPot.pos = pos;
|
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() {
|
private static final WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||||
|
|
|
@ -18,7 +18,7 @@ import com.watabou.utils.Random;
|
||||||
public class BlandfruitBush extends Plant {
|
public class BlandfruitBush extends Plant {
|
||||||
|
|
||||||
private static final String TXT_DESC =
|
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.";
|
"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 ) {
|
public void activate( Char ch ) {
|
||||||
super.activate( ch );
|
super.activate( ch );
|
||||||
|
|
||||||
if (ch != null) {
|
Dungeon.level.drop( new Seed(), pos ).sprite.drop();
|
||||||
//need to implement this
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,7 +46,7 @@ public class BlandfruitBush extends Plant {
|
||||||
image = ItemSpriteSheet.SEED_BLINDWEED;
|
image = ItemSpriteSheet.SEED_BLINDWEED;
|
||||||
|
|
||||||
plantClass = BlandfruitBush.class;
|
plantClass = BlandfruitBush.class;
|
||||||
alchemyClass = PotionOfInvisibility.class;
|
alchemyClass = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user