V0.2.0c : Corrected numerous bugs with Scroll of Lullaby
This commit is contained in:
parent
eaf2fcf81b
commit
5807c17059
|
@ -368,7 +368,7 @@ public abstract class Char extends Actor {
|
||||||
|
|
||||||
sprite.showStatus( CharSprite.NEGATIVE, "bleeding" );
|
sprite.showStatus( CharSprite.NEGATIVE, "bleeding" );
|
||||||
|
|
||||||
} else if (buff instanceof Sleep || buff instanceof MagicalSleep) {
|
} else if (buff instanceof Sleep) {
|
||||||
sprite.idle();
|
sprite.idle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,41 +17,32 @@
|
||||||
*/
|
*/
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
public class Drowsy extends Buff {
|
public class Drowsy extends Buff {
|
||||||
|
|
||||||
public static final float STEP = 5f;
|
|
||||||
|
|
||||||
private boolean placed = false;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int icon() {
|
public int icon() {
|
||||||
return BuffIndicator.DROWSY;
|
return BuffIndicator.DROWSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public boolean attachTo( Char target ) {
|
||||||
public boolean act(){
|
if (super.attachTo(target)) {
|
||||||
if (placed) {
|
if (cooldown() == 0)
|
||||||
|
spend(Random.Int(3, 6));
|
||||||
if (target instanceof Hero)
|
|
||||||
if (target.HP == target.HT) {
|
|
||||||
GLog.i("You are too healthy, and resist the urge to sleep.");
|
|
||||||
} else {
|
|
||||||
GLog.i("You fall into a deep magical sleep.");
|
|
||||||
Buff.affect(target, MagicalSleep.class);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Buff.affect(target, MagicalSleep.class);
|
|
||||||
detach();
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
placed = true;
|
|
||||||
spend(STEP);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean act(){
|
||||||
|
Buff.affect(target, MagicalSleep.class);
|
||||||
|
|
||||||
|
detach();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,6 +19,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
|
|
||||||
|
@ -31,6 +32,17 @@ public class MagicalSleep extends Buff {
|
||||||
public boolean attachTo( Char target ) {
|
public boolean attachTo( Char target ) {
|
||||||
if (super.attachTo( target )) {
|
if (super.attachTo( target )) {
|
||||||
|
|
||||||
|
if (target instanceof Hero)
|
||||||
|
if (target.HP == target.HT) {
|
||||||
|
GLog.i("You are too healthy, and resist the urge to sleep.");
|
||||||
|
detach();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
GLog.i("You fall into a deep magical sleep.");
|
||||||
|
}
|
||||||
|
else if (target instanceof Mob)
|
||||||
|
((Mob)target).state = Mob.State.SLEEPING;
|
||||||
|
|
||||||
target.paralysed = true;
|
target.paralysed = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -43,6 +55,7 @@ public class MagicalSleep extends Buff {
|
||||||
public boolean act(){
|
public boolean act(){
|
||||||
if (target instanceof Hero) {
|
if (target instanceof Hero) {
|
||||||
target.HP = Math.min(target.HP+1, target.HT);
|
target.HP = Math.min(target.HP+1, target.HT);
|
||||||
|
((Hero) target).restoreHealth = true;
|
||||||
if (target.HP == target.HT) {
|
if (target.HP == target.HT) {
|
||||||
GLog.p("You wake up feeling refreshed and healthy.");
|
GLog.p("You wake up feeling refreshed and healthy.");
|
||||||
detach();
|
detach();
|
||||||
|
@ -55,6 +68,8 @@ public class MagicalSleep extends Buff {
|
||||||
@Override
|
@Override
|
||||||
public void detach() {
|
public void detach() {
|
||||||
target.paralysed = false;
|
target.paralysed = false;
|
||||||
|
if (target instanceof Hero)
|
||||||
|
((Hero) target).restoreHealth = false;
|
||||||
super.detach();
|
super.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,10 @@ import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSleep;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Sleep;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Sleep;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Wound;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Wound;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||||
|
@ -298,7 +296,7 @@ public abstract class Mob extends Char {
|
||||||
state = State.HUNTING;
|
state = State.HUNTING;
|
||||||
} 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) {
|
||||||
state = State.SLEEPING;
|
state = State.SLEEPING;
|
||||||
this.sprite().showSleep();
|
this.sprite().showSleep();
|
||||||
postpone( Sleep.SWS );
|
postpone( Sleep.SWS );
|
||||||
|
|
|
@ -336,6 +336,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
|
||||||
}
|
}
|
||||||
emo = new EmoIcon.Sleep( this );
|
emo = new EmoIcon.Sleep( this );
|
||||||
}
|
}
|
||||||
|
idle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideSleep() {
|
public void hideSleep() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user