Merge remote-tracking branch 'origin/master'

This commit is contained in:
Evan Debenham
2014-08-15 09:11:47 -04:00
8 changed files with 38 additions and 15 deletions
@@ -19,6 +19,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@@ -82,6 +84,7 @@ public class Ankh extends Item {
//TODO: add sparkle effect
Sample.INSTANCE.play( Assets.SND_DRINK );
CellEmitter.get(hero.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
hero.sprite.operate( hero.pos );
}
} else {
@@ -128,7 +128,7 @@ public class Blandfruit extends Food {
potionAttrib instanceof PotionOfParalyticGas ||
potionAttrib instanceof PotionOfFrost){
potionAttrib.execute(hero, action);
detach( hero.belongings.backpack );
//detaches in Potion.cast, this is an awkward workaround due to throwing being on a different thread.
} else {
super.execute(hero, action);
}
@@ -154,6 +154,7 @@ public class Blandfruit extends Food {
try {
potionAttrib = (Potion)plant.newInstance();
potionAttrib.ownedByFruit = true;
} catch (Exception e) {
return null;
}
@@ -86,6 +86,8 @@ public class Potion extends Item {
private static ItemStatusHandler<Potion> handler;
private String color;
public boolean ownedByFruit = false;
{
stackable = true;
@@ -217,21 +219,31 @@ public class Potion extends Item {
Sample.INSTANCE.play( Assets.SND_SHATTER );
splash( cell );
}
@Override
public void cast( final Hero user, int dst ) {
super.cast(user, dst);
//if this potion is owned by a fruit, finds it and detaches it.
//TODO: add remove code here
}
public boolean isKnown() {
return handler.isKnown( this );
}
public void setKnown() {
if (!isKnown()) {
handler.know( this );
}
Badges.validateAllPotionsIdentified();
if (!ownedByFruit) {
if (!isKnown()) {
handler.know(this);
}
Badges.validateAllPotionsIdentified();
}
}
@Override
public Item identify() {
setKnown();
return this;
}
@@ -45,6 +45,7 @@ public class ScrollOfLullaby extends Scroll {
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (Level.fieldOfView[mob.pos]) {
Buff.affect( mob, Drowsy.class );
mob.sprite.centerEmitter().start( Speck.factory( Speck.NOTE ), 0.3f, 5 );
}
}