V0.1.1: overhauled scroll of lullaby pt. 1 (currently untested)

This commit is contained in:
Evan Debenham
2014-08-11 17:17:05 -04:00
parent a7e1455cff
commit 4f56f63053
9 changed files with 132 additions and 16 deletions
@@ -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 ) ;
}