v2.3.0: standardized healing over time buff behaviours:

- only show healing when healing occurs
- only interrupt hero when they reach HT or when buff expires
This commit is contained in:
Evan Debenham
2023-12-10 16:46:57 -05:00
parent 0c27cc8b6f
commit 3ae042f3ac
6 changed files with 46 additions and 16 deletions
@@ -59,6 +59,9 @@ public class Healing extends Buff {
healingLeft -= healingThisTick();
if (healingLeft <= 0){
if (target instanceof Hero) {
((Hero) target).resting = false;
}
detach();
}
@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
@@ -43,10 +44,17 @@ public class WellFed extends Buff {
left --;
if (left < 0){
detach();
if (target instanceof Hero) {
((Hero) target).resting = false;
}
return true;
} else if (left % 18 == 0){
target.HP = Math.min(target.HT, target.HP + 1);
} else if (left % 18 == 0 && target.HP < target.HT){
target.HP += 1;
target.sprite.showStatusWithIcon(CharSprite.POSITIVE, "1", FloatingText.HEALING);
if (target.HP == target.HT && target instanceof Hero) {
((Hero) target).resting = false;
}
}
spend(TICK);
@@ -168,9 +168,13 @@ public class ChaliceOfBlood extends Artifact {
if (Random.Float() < heal%1){
heal++;
}
if (heal >= 1f) {
if (heal >= 1f && target.HP < target.HT) {
target.HP = Math.min(target.HT, target.HP + (int)heal);
target.sprite.showStatusWithIcon(CharSprite.POSITIVE, Integer.toString((int)heal), FloatingText.HEALING);
if (target.HP == target.HT && target instanceof Hero) {
((Hero) target).resting = false;
}
}
}
@@ -310,7 +310,7 @@ public class DriedRose extends Artifact {
}
updateQuickslot();
}
} else {
} else if (ghost.HP < ghost.HT) {
int heal = Math.round((1 + level()/3f)*amount);
ghost.HP = Math.min( ghost.HT, ghost.HP + heal);
ghost.sprite.showStatusWithIcon(CharSprite.POSITIVE, Integer.toString(heal), FloatingText.HEALING);
@@ -83,14 +83,24 @@ public class ElixirOfAquaticRejuvenation extends Elixir {
} else {
healAmt = (float)Math.floor(healAmt);
}
target.HP += healAmt;
left -= healAmt;
target.HP += (int)healAmt;
left -= (int)healAmt;
target.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
target.sprite.showStatusWithIcon( CharSprite.POSITIVE, "1", FloatingText.HEALING );
target.sprite.showStatusWithIcon( CharSprite.POSITIVE, Integer.toString((int)healAmt), FloatingText.HEALING );
if (target.HP >= target.HT) {
target.HP = target.HT;
if (target instanceof Hero) {
((Hero) target).resting = false;
}
}
}
if (left <= 0){
detach();
if (target instanceof Hero) {
((Hero) target).resting = false;
}
} else {
spend(TICK);
}
@@ -92,15 +92,20 @@ public class Sungrass extends Plant {
partialHeal += (40 + target.HT)/150f;
if (partialHeal > 1){
target.HP += (int)partialHeal;
level -= (int)partialHeal;
partialHeal -= (int)partialHeal;
target.sprite.showStatusWithIcon(CharSprite.POSITIVE, "1", FloatingText.HEALING);
if (target.HP >= target.HT) {
target.HP = target.HT;
if (target instanceof Hero){
((Hero)target).resting = false;
int healThisTurn = (int)partialHeal;
partialHeal -= healThisTurn;
level -= healThisTurn;
if (target.HP < target.HT) {
target.HP += healThisTurn;
target.sprite.showStatusWithIcon(CharSprite.POSITIVE, Integer.toString(healThisTurn), FloatingText.HEALING);
if (target.HP >= target.HT) {
target.HP = target.HT;
if (target instanceof Hero) {
((Hero) target).resting = false;
}
}
}
}