v0.6.1: significant mechanics adjustments to healing potions

This commit is contained in:
Evan Debenham 2017-06-18 20:04:56 -04:00
parent 667d84191a
commit 154bd94f80
5 changed files with 93 additions and 6 deletions

View File

@ -0,0 +1,75 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2017 Evan Debenham
*
* 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.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.watabou.utils.GameMath;
public class Healing extends Buff {
private int healingLeft;
private float percentHealPerTick;
private int flatHealPerTick;
@Override
public boolean act(){
int healingThisTick = Math.round(healingLeft * percentHealPerTick) + flatHealPerTick;
healingThisTick = (int)GameMath.gate(1, healingThisTick, healingLeft);
target.HP = Math.min(target.HT, target.HP + healingThisTick);
target.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1 );
target.sprite.showStatus(CharSprite.POSITIVE, Messages.get(this, "value", healingThisTick));
healingLeft -= healingThisTick;
if (healingLeft == 0){
detach();
}
spend( TICK );
return true;
}
public void setHeal(int amount, float percentPerTick, int flatPerTick){
healingLeft = amount;
percentHealPerTick = percentPerTick;
flatHealPerTick = flatPerTick;
}
public void increaseHeal( int amount ){
healingLeft += amount;
}
@Override
public void fx(boolean on) {
if (on) target.sprite.add( CharSprite.State.HEALING );
else if (target.invisible == 0) target.sprite.remove( CharSprite.State.HEALING );
}
}

View File

@ -25,10 +25,10 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Healing;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -49,13 +49,13 @@ public class PotionOfHealing extends Potion {
public static void heal( Hero hero ) { public static void heal( Hero hero ) {
hero.HP = hero.HT; //starts out healing 30 hp, equalizes with hero health total at level 11
Buff.affect( hero, Healing.class ).setHeal((int)(0.8f*hero.HT + 14), 0.5f, 0);
Buff.detach( hero, Poison.class ); Buff.detach( hero, Poison.class );
Buff.detach( hero, Cripple.class ); Buff.detach( hero, Cripple.class );
Buff.detach( hero, Weakness.class ); Buff.detach( hero, Weakness.class );
Buff.detach( hero, Bleeding.class ); Buff.detach( hero, Bleeding.class );
hero.sprite.emitter().start( Speck.factory( Speck.HEALING ), 0.4f, 4 );
} }
@Override @Override

View File

@ -78,7 +78,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
protected float shadowOffset = 0.25f; protected float shadowOffset = 0.25f;
public enum State { public enum State {
BURNING, LEVITATING, INVISIBLE, PARALYSED, FROZEN, ILLUMINATED, CHILLED, DARKENED, MARKED BURNING, LEVITATING, INVISIBLE, PARALYSED, FROZEN, ILLUMINATED, CHILLED, DARKENED, MARKED, HEALING
} }
protected Animation idle; protected Animation idle;
@ -96,6 +96,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
protected Emitter chilled; protected Emitter chilled;
protected Emitter marked; protected Emitter marked;
protected Emitter levitation; protected Emitter levitation;
protected Emitter health;
protected IceBlock iceBlock; protected IceBlock iceBlock;
protected DarkBlock darkBlock; protected DarkBlock darkBlock;
@ -320,6 +321,9 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
marked = emitter(); marked = emitter();
marked.pour(ShadowParticle.UP, 0.1f); marked.pour(ShadowParticle.UP, 0.1f);
break; break;
case HEALING:
health = emitter();
health.pour(Speck.factory(Speck.HEALING), 0.5f);
} }
} }
@ -377,6 +381,12 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
marked = null; marked = null;
} }
break; break;
case HEALING:
if (health != null){
health.on = false;
health = null;
}
break;
} }
} }

View File

@ -116,6 +116,8 @@ actors.buffs.fury.desc=You are angry, enemies won't like you when you're angry.\
actors.buffs.gasesimmunity.name=Immune to gases actors.buffs.gasesimmunity.name=Immune to gases
actors.buffs.gasesimmunity.desc=Some strange force is filtering out the air around you, it's not causing you any harm, but it blocks out everything but air so effectively you can't even smell anything!\n\nYou are immune to the effects of all gasses while this buff lasts.\n\nTurns of gas immunity remaining: %s. actors.buffs.gasesimmunity.desc=Some strange force is filtering out the air around you, it's not causing you any harm, but it blocks out everything but air so effectively you can't even smell anything!\n\nYou are immune to the effects of all gasses while this buff lasts.\n\nTurns of gas immunity remaining: %s.
actors.buffs.healing.value=%+dHP
actors.buffs.hunger.hungry=Hungry actors.buffs.hunger.hungry=Hungry
actors.buffs.hunger.starving=Starving actors.buffs.hunger.starving=Starving
actors.buffs.hunger.onhungry=You are hungry. actors.buffs.hunger.onhungry=You are hungry.

View File

@ -419,8 +419,8 @@ items.potions.potionoffrost.name=potion of frost
items.potions.potionoffrost.desc=Upon exposure to open air this chemical will evaporate into a freezing cloud, causing any creature that contacts it to be frozen in place unable to act and move. The freezing effect is much stronger if the environment is wet. items.potions.potionoffrost.desc=Upon exposure to open air this chemical will evaporate into a freezing cloud, causing any creature that contacts it to be frozen in place unable to act and move. The freezing effect is much stronger if the environment is wet.
items.potions.potionofhealing.name=potion of healing items.potions.potionofhealing.name=potion of healing
items.potions.potionofhealing.heal=Your wounds heal completely. items.potions.potionofhealing.heal=Your wounds begin to close.
items.potions.potionofhealing.desc=An elixir that will instantly return you to full health and cure poison. items.potions.potionofhealing.desc=This elixir will rapidly restore your health and instantly cure many ailments.
items.potions.potionofinvisibility.name=potion of invisibility items.potions.potionofinvisibility.name=potion of invisibility
items.potions.potionofinvisibility.invisible=You see your hands turn invisible! items.potions.potionofinvisibility.invisible=You see your hands turn invisible!