diff --git a/assets/buffs.png b/assets/buffs.png index 7c12ab545..e809c1aa3 100644 Binary files a/assets/buffs.png and b/assets/buffs.png differ diff --git a/assets/large_buffs.png b/assets/large_buffs.png index 42cd34ff8..bf930a9f9 100644 Binary files a/assets/large_buffs.png and b/assets/large_buffs.png differ diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index 393ba19f3..3ca3d5b5a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -235,6 +235,9 @@ public abstract class Char extends Actor { Buff.prolong(this, Paralysis.class, 1f); } } + if (this.buff(MagicalSleep.class) != null){ + Buff.detach(this, MagicalSleep.class); + } Class srcClass = src.getClass(); if (immunities().contains( srcClass )) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java new file mode 100644 index 000000000..083ddb4c0 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java @@ -0,0 +1,43 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2014 Oleg Dolya + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ +package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; + +import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; + +public class Drowsy extends FlavourBuff { + + public static final float DURATION = 4f; + + @Override + public int icon() { + return BuffIndicator.DROWSY; + } + + @Override + public boolean act(){ + Buff.affect(target, MagicalSleep.class); + GLog.i("You fall into a deep magical sleep."); + return super.act(); + } + + @Override + public String toString() { + return "Drowsy"; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSleep.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSleep.java new file mode 100644 index 000000000..156cdd5f0 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSleep.java @@ -0,0 +1,70 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2014 Oleg Dolya + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ +package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; + +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; + +public class MagicalSleep extends Buff { + + private static final float STEP = 1f; + public static final float SWS = 1.5f; + + @Override + public boolean attachTo( Char target ) { + if (super.attachTo( target )) { + + target.paralysed = true; + + return true; + } else { + return false; + } + } + + @Override + public boolean act(){ + if (target instanceof Hero) { + target.HP = Math.min(target.HP+1, target.HT); + if (target.HP == target.HT) { + GLog.p("You wake up feeling refreshed and healthy."); + detach(); + } + } + spend( STEP ); + return true; + } + + @Override + public void detach() { + target.paralysed = false; + super.detach(); + } + + @Override + public int icon() { + return BuffIndicator.MAGIC_SLEEP; + } + + @Override + public String toString() { + return "Magical Sleep"; + } +} \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index a88276395..310e5049f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -20,6 +20,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.hero; import java.util.ArrayList; import java.util.HashSet; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Drowsy; import com.watabou.noosa.Camera; import com.watabou.noosa.Game; import com.watabou.noosa.audio.Sample; @@ -821,6 +822,10 @@ public class Hero extends Char { @Override public void damage( int dmg, Object src ) { restoreHealth = false; + if (this.buff(Drowsy.class) != null){ + Buff.detach(this, Drowsy.class); + GLog.i("The pain helps you resist the urge to sleep."); + } super.damage( dmg, src ); if (subClass == HeroSubClass.BERSERKER && 0 < HP && HP <= HT * Fury.LEVEL) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index c92fbd38d..b571a2abc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok; 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.Terror; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; @@ -292,7 +293,7 @@ public abstract class Mob extends Char { state = State.HUNTING; } else if (buff instanceof Terror) { state = State.FLEEING; - } else if (buff instanceof Sleep) { + } else if (buff instanceof Sleep || buff instanceof MagicalSleep) { if (sprite != null) { new Flare( 4, 32 ).color( 0x44ffff, true ).show( sprite, 2f ) ; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java index edd67e0f1..c74d3e7ea 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java @@ -17,6 +17,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.scrolls; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Drowsy; import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; @@ -45,24 +46,16 @@ public class ScrollOfLullaby extends Scroll { Mob affected = null; for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) { if (Level.fieldOfView[mob.pos]) { - Buff.affect( mob, Sleep.class ); - if (mob.buff( Sleep.class ) != null) { + Buff.affect( mob, Drowsy.class ); + if (mob.buff( Drowsy.class ) != null) { affected = mob; count++; } } } - - switch (count) { - case 0: - GLog.i( "The scroll utters a soothing melody." ); - break; - case 1: - GLog.i( "The scroll utters a soothing melody and the " + affected.name + " falls asleep!" ); - break; - default: - GLog.i( "The scroll utters a soothing melody and the monsters fall asleep!" ); - } + + GLog.i( "The scroll utters a soothing melody. You feel very sleepy." ); + setKnown(); curUser.spendAndNext( TIME_TO_READ ); @@ -71,8 +64,7 @@ public class ScrollOfLullaby extends Scroll { @Override public String desc() { return - "A soothing melody will put all creatures in your field of view into a deep sleep, " + - "giving you a chance to flee or make a surprise attack on them."; + "A soothing melody will lull all who hear it into a deep magical sleep "; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java index dce94f300..2e26e817d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java @@ -62,6 +62,8 @@ public class BuffIndicator extends Component { public static final int BLEEDING = 26; public static final int MARK = 27; public static final int DEFERRED = 28; + public static final int DROWSY = 29; + public static final int MAGIC_SLEEP = 30; public static final int SIZE = 7;