V0.1.1: more work on lullaby.

This commit is contained in:
Evan Debenham 2014-08-13 00:26:16 -04:00
parent 52abd25647
commit 5c1526e430
3 changed files with 22 additions and 13 deletions

View File

@ -17,12 +17,15 @@
*/ */
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class Drowsy extends FlavourBuff { public class Drowsy extends Buff {
public static final float DURATION = 4f; public static final float STEP = 5f;
private boolean placed = false;
@Override @Override
public int icon() { public int icon() {
@ -31,9 +34,17 @@ public class Drowsy extends FlavourBuff {
@Override @Override
public boolean act(){ public boolean act(){
if (placed) {
Buff.affect(target, MagicalSleep.class); Buff.affect(target, MagicalSleep.class);
if (target instanceof Hero)
GLog.i("You fall into a deep magical sleep."); GLog.i("You fall into a deep magical sleep.");
return super.act(); detach();
return true;
} else {
placed = true;
spend(STEP);
return true;
}
} }
@Override @Override

View File

@ -295,9 +295,11 @@ public abstract class Mob extends Char {
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) { if (sprite != null) {
new Flare( 4, 32 ).color( 0x44ffff, true ).show( sprite, 2f ) ; //new Flare( 4, 32 ).color( 0x44ffff, true ).show( sprite, 2f ) ;
this.sprite().showSleep();
} }
state = State.SLEEPING; state = State.SLEEPING;
this.sprite().showSleep();
postpone( Sleep.SWS ); postpone( Sleep.SWS );
} }
} }

View File

@ -42,18 +42,14 @@ public class ScrollOfLullaby extends Scroll {
Sample.INSTANCE.play( Assets.SND_LULLABY ); Sample.INSTANCE.play( Assets.SND_LULLABY );
Invisibility.dispel(); Invisibility.dispel();
int count = 0;
Mob affected = null;
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 );
if (mob.buff( Drowsy.class ) != null) {
affected = mob;
count++;
}
} }
} }
Buff.affect( curUser, Drowsy.class );
GLog.i( "The scroll utters a soothing melody. You feel very sleepy." ); GLog.i( "The scroll utters a soothing melody. You feel very sleepy." );
setKnown(); setKnown();