V0.1.1: more work on blandfruit, still not implemented
This commit is contained in:
parent
230f814736
commit
1fc6bf5b92
BIN
assets/items.png
BIN
assets/items.png
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 17 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.3 KiB |
|
@ -1,27 +1,35 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.items.food;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
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.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
|
||||
/**
|
||||
* Created by debenhame on 12/08/2014.
|
||||
*/
|
||||
public class BlandFruit extends Food {
|
||||
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 Potion potionAttrib = null;
|
||||
|
||||
{
|
||||
name = "BlandFruit";
|
||||
name = "Blandfruit";
|
||||
stackable = false;
|
||||
image = ItemSpriteSheet.STEAK;
|
||||
image = ItemSpriteSheet.BLANDFRUIT;
|
||||
energy = (Hunger.STARVING - Hunger.HUNGRY)/2;
|
||||
}
|
||||
|
||||
|
@ -29,7 +37,20 @@ public class BlandFruit extends Food {
|
|||
public void execute( Hero hero, String action ) {
|
||||
if (potionAttrib == null){
|
||||
|
||||
super.execute(hero, action);
|
||||
detach( hero.belongings.backpack );
|
||||
|
||||
((Hunger)hero.buff( Hunger.class )).satisfy( energy );
|
||||
GLog.i(message);
|
||||
|
||||
hero.sprite.operate( hero.pos );
|
||||
hero.busy();
|
||||
SpellSprite.show(hero, SpellSprite.FOOD);
|
||||
Sample.INSTANCE.play( Assets.SND_EAT );
|
||||
|
||||
hero.spend( 1f );
|
||||
|
||||
Statistics.foodEaten++;
|
||||
Badges.validateFoodEaten();
|
||||
|
||||
} else if (action.equals( AC_EAT )){
|
||||
|
||||
|
@ -45,11 +66,27 @@ public class BlandFruit extends Food {
|
|||
|
||||
hero.sprite.operate(hero.pos);
|
||||
|
||||
switch (hero.heroClass) {
|
||||
case WARRIOR:
|
||||
if (hero.HP < hero.HT) {
|
||||
hero.HP = Math.min( hero.HP + 5, hero.HT );
|
||||
hero.sprite.emitter().burst( Speck.factory(Speck.HEALING), 1 );
|
||||
}
|
||||
break;
|
||||
case MAGE:
|
||||
hero.belongings.charge( false );
|
||||
ScrollOfRecharging.charge(hero);
|
||||
break;
|
||||
case ROGUE:
|
||||
case HUNTRESS:
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (action.equals( AC_THROW )){
|
||||
|
||||
//need to finish this
|
||||
GameScene.selectCell(thrower);
|
||||
potionAttrib.splash(hero.pos);
|
||||
//potionAttrib.splash(hero.pos);
|
||||
|
||||
} else {
|
||||
super.execute(hero, action);
|
||||
|
@ -77,31 +114,78 @@ public class BlandFruit extends Food {
|
|||
}
|
||||
|
||||
//implement pixmap
|
||||
potionAttrib.image = 0;
|
||||
potionAttrib.image = ItemSpriteSheet.BLANDFRUIT;
|
||||
|
||||
//need to finish this
|
||||
if (potionAttrib instanceof PotionOfHealing){
|
||||
name = "HealFruit";
|
||||
message = "";
|
||||
info = "";
|
||||
|
||||
name = "Healthfruit";
|
||||
//message = "You eat the HealthFruit, your whole body tingles.";
|
||||
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";
|
||||
//message = "";
|
||||
info = "The fruit has plumped up from its time soaking in the pot and has even absorbed the properties "+
|
||||
"of the Rotberry seed it was cooked with. It looks delicious and powerful, ready to be eaten!";
|
||||
|
||||
} else if (potionAttrib instanceof PotionOfParalyticGas){
|
||||
|
||||
name = "Paralyzefruit";
|
||||
//message = "";
|
||||
info = "The fruit has plumped up from its time soaking in the pot and has even absorbed the properties "+
|
||||
"of the Earthroot seed it was cooked with. It looks delicious and firm, but eating it is probably a bad idea.";
|
||||
|
||||
} else if (potionAttrib instanceof PotionOfInvisibility){
|
||||
|
||||
name = "Invisifruit";
|
||||
//message = "";
|
||||
info = "The fruit has plumped up from its time soaking in the pot and has even absorbed the properties "+
|
||||
"of the Blindweed seed it was cooked with. It looks delicious and shiny, ready to be eaten!";
|
||||
|
||||
} else if (potionAttrib instanceof PotionOfLiquidFlame){
|
||||
|
||||
name = "Flamefruit";
|
||||
//message = "";
|
||||
info = "The fruit has plumped up from its time soaking in the pot and has even absorbed the properties "+
|
||||
"of the Firebloom seed it was cooked with. It looks delicious and spicy, but eating it is probably a bad idea.";
|
||||
|
||||
} else if (potionAttrib instanceof PotionOfFrost){
|
||||
|
||||
name = "Frostfruit";
|
||||
//message = "";
|
||||
info = "The fruit has plumped up from its time soaking in the pot and has even absorbed the properties "+
|
||||
"of the Icecap seed it was cooked with. It looks delicious and refreshing, ready to be eaten!";
|
||||
|
||||
} else if (potionAttrib instanceof PotionOfMindVision){
|
||||
|
||||
name = "Visionfruit";
|
||||
//message = "";
|
||||
info = "The fruit has plumped up from its time soaking in the pot and has even absorbed the properties "+
|
||||
"of the Fadeleaf seed it was cooked with. It looks delicious and shadowy, ready to be eaten!";
|
||||
|
||||
} else if (potionAttrib instanceof PotionOfToxicGas){
|
||||
|
||||
name = "Toxicfruit";
|
||||
//message = "";
|
||||
info = "The fruit has plumped up from its time soaking in the pot and has even absorbed the properties "+
|
||||
"of the Sorrowmoss seed it was cooked with. It looks delicious and crisp, but eating it is probably a bad idea.";
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final ItemSprite.Glowing GREEN = new ItemSprite.Glowing( 0x2EE62E );
|
||||
|
||||
@Override
|
||||
public ItemSprite.Glowing glowing() {
|
||||
return (potionAttrib != null) ? GREEN : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ public class Potion extends Item {
|
|||
}
|
||||
}
|
||||
|
||||
protected void apply( Hero hero ) {
|
||||
public void apply( Hero hero ) {
|
||||
shatter( hero.pos );
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public class PotionOfExperience extends Potion {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void apply( Hero hero ) {
|
||||
public void apply( Hero hero ) {
|
||||
setKnown();
|
||||
hero.earnExp( hero.maxExp() - hero.exp );
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class PotionOfHealing extends Potion {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void apply( Hero hero ) {
|
||||
public void apply( Hero hero ) {
|
||||
setKnown();
|
||||
heal( Dungeon.hero );
|
||||
GLog.p( "Your wounds heal completely." );
|
||||
|
|
|
@ -35,7 +35,7 @@ public class PotionOfInvisibility extends Potion {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void apply( Hero hero ) {
|
||||
public void apply( Hero hero ) {
|
||||
setKnown();
|
||||
Buff.affect( hero, Invisibility.class, Invisibility.DURATION );
|
||||
GLog.i( "You see your hands turn invisible!" );
|
||||
|
|
|
@ -29,7 +29,7 @@ public class PotionOfLevitation extends Potion {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void apply( Hero hero ) {
|
||||
public void apply( Hero hero ) {
|
||||
setKnown();
|
||||
Buff.affect( hero, Levitation.class, Levitation.DURATION );
|
||||
GLog.i( "You float into the air!" );
|
||||
|
|
|
@ -28,7 +28,7 @@ public class PotionOfMight extends PotionOfStrength {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void apply( Hero hero ) {
|
||||
public void apply( Hero hero ) {
|
||||
setKnown();
|
||||
|
||||
hero.STR++;
|
||||
|
|
|
@ -30,7 +30,7 @@ public class PotionOfMindVision extends Potion {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void apply( Hero hero ) {
|
||||
public void apply( Hero hero ) {
|
||||
setKnown();
|
||||
Buff.affect( hero, MindVision.class, MindVision.DURATION );
|
||||
Dungeon.observe();
|
||||
|
|
|
@ -106,7 +106,7 @@ public class PotionOfPurity extends Potion {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void apply( Hero hero ) {
|
||||
public void apply( Hero hero ) {
|
||||
GLog.w( TXT_NO_SMELL );
|
||||
Buff.prolong( hero, GasesImmunity.class, GasesImmunity.DURATION );
|
||||
setKnown();
|
||||
|
|
|
@ -29,7 +29,7 @@ public class PotionOfStrength extends Potion {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void apply( Hero hero ) {
|
||||
public void apply( Hero hero ) {
|
||||
setKnown();
|
||||
|
||||
hero.STR++;
|
||||
|
|
|
@ -152,6 +152,7 @@ public class ItemSpriteSheet {
|
|||
public static final int STEAK = 114;
|
||||
public static final int OVERPRICED = 115;
|
||||
public static final int CARPACCIO = 116;
|
||||
public static final int BLANDFRUIT = 117;
|
||||
|
||||
// Bags
|
||||
public static final int POUCH = 83;
|
||||
|
|
Loading…
Reference in New Issue
Block a user