V0.1.1: more work on lullaby.
This commit is contained in:
parent
52abd25647
commit
5c1526e430
|
@ -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(){
|
||||||
Buff.affect(target, MagicalSleep.class);
|
if (placed) {
|
||||||
GLog.i("You fall into a deep magical sleep.");
|
Buff.affect(target, MagicalSleep.class);
|
||||||
return super.act();
|
if (target instanceof Hero)
|
||||||
|
GLog.i("You fall into a deep magical sleep.");
|
||||||
|
detach();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
placed = true;
|
||||||
|
spend(STEP);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,19 +41,15 @@ public class ScrollOfLullaby extends Scroll {
|
||||||
curUser.sprite.centerEmitter().start( Speck.factory( Speck.NOTE ), 0.3f, 5 );
|
curUser.sprite.centerEmitter().start( Speck.factory( Speck.NOTE ), 0.3f, 5 );
|
||||||
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();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user