V0.1.1: Blandfruit now half implemented, almost finished...

This commit is contained in:
Evan Debenham 2014-08-14 01:31:39 -04:00
parent ffa746be18
commit a7caea1598
3 changed files with 106 additions and 10 deletions

View File

@ -3,7 +3,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.food;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.*;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite; import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
@ -16,6 +16,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Random;
/** /**
* Created by debenhame on 12/08/2014. * Created by debenhame on 12/08/2014.
@ -61,13 +62,41 @@ public class Blandfruit extends Food {
} else if (action.equals( AC_EAT )){ } else if (action.equals( AC_EAT )){
((Hunger)hero.buff( Hunger.class )).satisfy( Hunger.HUNGRY ); ((Hunger)hero.buff( Hunger.class )).satisfy(Hunger.HUNGRY);
detach( hero.belongings.backpack ); detach( hero.belongings.backpack );
hero.spend( 1f ); hero.spend( 1f );
hero.busy(); hero.busy();
potionAttrib.apply(hero);
if (potionAttrib instanceof PotionOfFrost){
GLog.i( "the Frostfruit takes a bit like Frozen Carpaccio." );
switch (Random.Int(5)) {
case 0:
GLog.i( "You see your hands turn invisible!" );
Buff.affect(hero, Invisibility.class, Invisibility.DURATION);
break;
case 1:
GLog.i( "You feel your skin hardens!" );
Buff.affect( hero, Barkskin.class ).level( hero.HT / 4 );
break;
case 2:
GLog.i( "Refreshing!" );
Buff.detach( hero, Poison.class );
Buff.detach( hero, Cripple.class );
Buff.detach( hero, Weakness.class );
Buff.detach( hero, Bleeding.class );
break;
case 3:
GLog.i( "You feel better!" );
if (hero.HP < hero.HT) {
hero.HP = Math.min( hero.HP + hero.HT / 4, hero.HT );
hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
}
break;
}
} else
potionAttrib.apply(hero);
Sample.INSTANCE.play( Assets.SND_EAT ); Sample.INSTANCE.play( Assets.SND_EAT );
@ -93,7 +122,8 @@ public class Blandfruit extends Food {
if (potionAttrib instanceof PotionOfLiquidFlame || if (potionAttrib instanceof PotionOfLiquidFlame ||
potionAttrib instanceof PotionOfToxicGas || potionAttrib instanceof PotionOfToxicGas ||
potionAttrib instanceof PotionOfParalyticGas){ potionAttrib instanceof PotionOfParalyticGas ||
potionAttrib instanceof PotionOfFrost){
potionAttrib.execute(hero, action); potionAttrib.execute(hero, action);
detach( hero.belongings.backpack ); detach( hero.belongings.backpack );
} else { } else {
@ -185,8 +215,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 Sorrowmoss seed it was cooked with. It looks crisp and volatile, I shouldn't eat this."; "of the Sorrowmoss seed it was cooked with. It looks crisp and volatile, I shouldn't eat this.";
} else {
} }
return this; return this;

View File

@ -22,6 +22,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room; import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass; import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass;
import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush;
import com.watabou.utils.Random; import com.watabou.utils.Random;
public class GardenPainter extends Painter { public class GardenPainter extends Painter {
@ -34,10 +35,18 @@ public class GardenPainter extends Painter {
room.entrance().set( Room.Door.Type.REGULAR ); room.entrance().set( Room.Door.Type.REGULAR );
int bushes = Random.Int( 3 ) == 0 ? (Random.Int( 5 ) == 0 ? 2 : 1) : 0; int bushes = Random.Int( 3 );
for (int i=0; i < bushes; i++) { if (bushes == 0) {
level.plant( new Sungrass.Seed(), room.random() ); level.plant(new Sungrass.Seed(), room.random());
} } else if (bushes == 1) {
level.plant(new BlandfruitBush.Seed(), room.random() );
} else {
bushes = Random.Int( 5 );
if (bushes == 0){
level.plant(new Sungrass.Seed(), room.random());
level.plant(new BlandfruitBush.Seed(), room.random() );
}
}
Foliage light = (Foliage)level.blobs.get( Foliage.class ); Foliage light = (Foliage)level.blobs.get( Foliage.class );
if (light == null) { if (light == null) {

View File

@ -0,0 +1,59 @@
package com.shatteredpixel.shatteredpixeldungeon.plants;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfInvisibility;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Random;
/**
* Created by Evan on 13/08/2014.
*/
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. " +
"The fruit is gross and unsubstantial but isn't poisonous. perhaps it could be cooked.";
{
image = 8;
plantName = "Blandfruit";
}
@Override
public void activate( Char ch ) {
super.activate( ch );
if (ch != null) {
//need to implement this
}
}
@Override
public String desc() {
return TXT_DESC;
}
public static class Seed extends Plant.Seed {
{
plantName = "Blandfruit";
name = "seed of " + plantName;
image = ItemSpriteSheet.SEED_BLINDWEED;
plantClass = BlandfruitBush.class;
alchemyClass = PotionOfInvisibility.class;
}
@Override
public String desc() {
return TXT_DESC;
}
}
}