V0.1.1: fixed bugs and cleaned up some effects.

This commit is contained in:
Evan Debenham
2014-08-14 22:26:58 -04:00
parent 94591b7d32
commit faa9140e05
7 changed files with 27 additions and 12 deletions
@@ -367,7 +367,7 @@ public abstract class Char extends Actor {
sprite.showStatus( CharSprite.NEGATIVE, "bleeding" ); sprite.showStatus( CharSprite.NEGATIVE, "bleeding" );
} else if (buff instanceof Sleep) { } else if (buff instanceof Sleep || buff instanceof MagicalSleep) {
sprite.idle(); sprite.idle();
} }
@@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Drowsy; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Drowsy;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.watabou.noosa.Camera; import com.watabou.noosa.Camera;
import com.watabou.noosa.Game; import com.watabou.noosa.Game;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
@@ -823,7 +824,7 @@ public class Hero extends Char {
restoreHealth = false; restoreHealth = false;
if (this.buff(Drowsy.class) != null){ if (this.buff(Drowsy.class) != null){
Buff.detach(this, Drowsy.class); Buff.detach(this, Drowsy.class);
GLog.i("The pain helps you resist the urge to sleep."); GLog.w("The pain helps you resist the urge to sleep.");
} }
super.damage( dmg, src ); super.damage( dmg, src );
@@ -1100,6 +1101,7 @@ public class Hero extends Char {
if (ankh != null && ankh.isBlessed()) { if (ankh != null && ankh.isBlessed()) {
this.HP = HT; this.HP = HT;
new Flare(8, 32).color(0xFFFF66, true).show(sprite, 2f); new Flare(8, 32).color(0xFFFF66, true).show(sprite, 2f);
CellEmitter.get(this.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
ankh.detach(belongings.backpack); ankh.detach(belongings.backpack);
@@ -294,10 +294,6 @@ public abstract class Mob extends Char {
} else if (buff instanceof Terror) { } else if (buff instanceof Terror) {
state = State.FLEEING; state = State.FLEEING;
} else if (buff instanceof Sleep || buff instanceof MagicalSleep) { } else if (buff instanceof Sleep || buff instanceof MagicalSleep) {
if (sprite != null) {
//new Flare( 4, 32 ).color( 0x44ffff, true ).show( sprite, 2f ) ;
this.sprite().showSleep();
}
state = State.SLEEPING; state = State.SLEEPING;
this.sprite().showSleep(); this.sprite().showSleep();
postpone( Sleep.SWS ); postpone( Sleep.SWS );
@@ -19,6 +19,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; 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.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@@ -80,6 +82,7 @@ public class Ankh extends Item {
hero.busy(); hero.busy();
Sample.INSTANCE.play( Assets.SND_DRINK ); Sample.INSTANCE.play( Assets.SND_DRINK );
CellEmitter.get(hero.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
hero.sprite.operate( hero.pos ); hero.sprite.operate( hero.pos );
} }
} else { } else {
@@ -125,7 +125,7 @@ public class Blandfruit extends Food {
potionAttrib instanceof PotionOfParalyticGas || potionAttrib instanceof PotionOfParalyticGas ||
potionAttrib instanceof PotionOfFrost){ potionAttrib instanceof PotionOfFrost){
potionAttrib.execute(hero, action); 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 { } else {
super.execute(hero, action); super.execute(hero, action);
} }
@@ -151,6 +151,7 @@ public class Blandfruit extends Food {
try { try {
potionAttrib = (Potion)plant.newInstance(); potionAttrib = (Potion)plant.newInstance();
potionAttrib.ownedByFruit = true;
} catch (Exception e) { } catch (Exception e) {
return null; return null;
} }
@@ -87,6 +87,8 @@ public class Potion extends Item {
private String color; private String color;
public boolean ownedByFruit = false;
{ {
stackable = true; stackable = true;
defaultAction = AC_DRINK; defaultAction = AC_DRINK;
@@ -218,20 +220,30 @@ public class Potion extends Item {
splash( cell ); 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() { public boolean isKnown() {
return handler.isKnown( this ); return handler.isKnown( this );
} }
public void setKnown() { public void setKnown() {
if (!isKnown()) { if (!ownedByFruit) {
handler.know( this ); if (!isKnown()) {
} handler.know(this);
}
Badges.validateAllPotionsIdentified(); Badges.validateAllPotionsIdentified();
}
} }
@Override @Override
public Item identify() { public Item identify() {
setKnown(); setKnown();
return this; return this;
} }
@@ -45,6 +45,7 @@ public class ScrollOfLullaby extends Scroll {
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) { for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (Level.fieldOfView[mob.pos]) { if (Level.fieldOfView[mob.pos]) {
Buff.affect( mob, Drowsy.class ); Buff.affect( mob, Drowsy.class );
mob.sprite.centerEmitter().start( Speck.factory( Speck.NOTE ), 0.3f, 5 );
} }
} }