V0.1.1: overhauled scroll of lullaby pt. 1 (currently untested)
This commit is contained in:
parent
a7e1455cff
commit
4f56f63053
BIN
assets/buffs.png
BIN
assets/buffs.png
Binary file not shown.
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 5.6 KiB |
|
@ -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 )) {
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
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";
|
||||
}
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
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";
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
|
|
|
@ -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 ) ;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user