v0.8.1: BuffIndicator.refreshHero() is now always called when hero acts

This commit is contained in:
Evan Debenham 2020-05-06 21:08:32 -04:00
parent 13ecf57edf
commit 05b70dce87
19 changed files with 10 additions and 41 deletions

View File

@ -27,6 +27,8 @@ import com.watabou.utils.Bundle;
public class AdrenalineSurge extends Buff { public class AdrenalineSurge extends Buff {
public static float DURATION = 800f;
{ {
type = buffType.POSITIVE; type = buffType.POSITIVE;
} }
@ -60,6 +62,11 @@ public class AdrenalineSurge extends Buff {
return BuffIndicator.FURY; return BuffIndicator.FURY;
} }
@Override
public float iconFadePercent() {
return Math.max(0, (DURATION - visualcooldown()) / DURATION);
}
@Override @Override
public String toString() { public String toString() {
return Messages.get(this, "name"); return Messages.get(this, "name");

View File

@ -96,7 +96,6 @@ public class Berserk extends Buff {
} else { } else {
state = State.RECOVERING; state = State.RECOVERING;
levelRecovery = LEVEL_RECOVER_START; levelRecovery = LEVEL_RECOVER_START;
BuffIndicator.refreshHero();
if (buff != null) buff.absorbDamage(buff.shielding()); if (buff != null) buff.absorbDamage(buff.shielding());
power = 0f; power = 0f;
} }
@ -106,7 +105,6 @@ public class Berserk extends Buff {
if (power <= 0){ if (power <= 0){
detach(); detach();
} }
BuffIndicator.refreshHero();
} }
spend(TICK); spend(TICK);
return true; return true;
@ -123,7 +121,6 @@ public class Berserk extends Buff {
WarriorShield shield = target.buff(WarriorShield.class); WarriorShield shield = target.buff(WarriorShield.class);
if (shield != null){ if (shield != null){
state = State.BERSERK; state = State.BERSERK;
BuffIndicator.refreshHero();
shield.supercharge(shield.maxShield() * 10); shield.supercharge(shield.maxShield() * 10);
SpellSprite.show(target, SpellSprite.BERSERK); SpellSprite.show(target, SpellSprite.BERSERK);
@ -139,13 +136,11 @@ public class Berserk extends Buff {
public void damage(int damage){ public void damage(int damage){
if (state == State.RECOVERING) return; if (state == State.RECOVERING) return;
power = Math.min(1.1f, power + (damage/(float)target.HT)/3f ); power = Math.min(1.1f, power + (damage/(float)target.HT)/3f );
BuffIndicator.refreshHero();
} }
public void recover(float percent){ public void recover(float percent){
if (levelRecovery > 0){ if (levelRecovery > 0){
levelRecovery -= percent; levelRecovery -= percent;
BuffIndicator.refreshHero();
if (levelRecovery <= 0) { if (levelRecovery <= 0) {
state = State.NORMAL; state = State.NORMAL;
levelRecovery = 0; levelRecovery = 0;

View File

@ -147,7 +147,6 @@ public class Burning extends Buff implements Hero.Doom {
spend( TICK ); spend( TICK );
left -= TICK; left -= TICK;
BuffIndicator.refreshHero();
if (left <= 0 || if (left <= 0 ||
(Dungeon.level.water[target.pos] && !target.flying)) { (Dungeon.level.water[target.pos] && !target.flying)) {

View File

@ -77,7 +77,6 @@ public class Combo extends Buff implements ActionIndicator.Action {
count++; count++;
comboTime = 4f; comboTime = 4f;
misses = 0; misses = 0;
BuffIndicator.refreshHero();
if (count >= 2) { if (count >= 2) {
@ -108,7 +107,6 @@ public class Combo extends Buff implements ActionIndicator.Action {
public boolean act() { public boolean act() {
comboTime-=TICK; comboTime-=TICK;
spend(TICK); spend(TICK);
BuffIndicator.refreshHero();
if (comboTime <= 0) { if (comboTime <= 0) {
detach(); detach();
} }

View File

@ -73,8 +73,6 @@ public class FireImbue extends Buff {
left -= TICK; left -= TICK;
if (left <= 0){ if (left <= 0){
detach(); detach();
} else if (left < 5){
BuffIndicator.refreshHero();
} }
return true; return true;

View File

@ -82,28 +82,21 @@ public class Hunger extends Buff implements Hero.Doom {
} else { } else {
float newLevel = level + STEP; float newLevel = level + STEP;
boolean statusUpdated = false;
if (newLevel >= STARVING) { if (newLevel >= STARVING) {
GLog.n( Messages.get(this, "onstarving") ); GLog.n( Messages.get(this, "onstarving") );
hero.resting = false; hero.resting = false;
hero.damage( 1, this ); hero.damage( 1, this );
statusUpdated = true;
hero.interrupt(); hero.interrupt();
} else if (newLevel >= HUNGRY && level < HUNGRY) { } else if (newLevel >= HUNGRY && level < HUNGRY) {
GLog.w( Messages.get(this, "onhungry") ); GLog.w( Messages.get(this, "onhungry") );
statusUpdated = true;
} }
level = newLevel; level = newLevel;
if (statusUpdated) {
BuffIndicator.refreshHero();
}
} }
spend( target.buff( Shadows.class ) == null ? STEP : STEP * 1.5f ); spend( target.buff( Shadows.class ) == null ? STEP : STEP * 1.5f );
@ -140,7 +133,6 @@ public class Hunger extends Buff implements Hero.Doom {
partialDamage += excess * (target.HT/1000f); partialDamage += excess * (target.HT/1000f);
} }
BuffIndicator.refreshHero();
} }
public boolean isStarving() { public boolean isStarving() {

View File

@ -40,7 +40,6 @@ public class Momentum extends Buff {
turnsSinceMove++; turnsSinceMove++;
if (turnsSinceMove > 0){ if (turnsSinceMove > 0){
stacks = Math.max(0, stacks - turnsSinceMove); stacks = Math.max(0, stacks - turnsSinceMove);
BuffIndicator.refreshHero();
if (stacks == 0) detach(); if (stacks == 0) detach();
} }
spend(TICK); spend(TICK);
@ -50,7 +49,6 @@ public class Momentum extends Buff {
public void gainStack(){ public void gainStack(){
stacks = Math.min(stacks+1, 10); stacks = Math.min(stacks+1, 10);
turnsSinceMove = -1; turnsSinceMove = -1;
BuffIndicator.refreshHero();
} }
public int stacks(){ public int stacks(){

View File

@ -107,7 +107,6 @@ public class Preparation extends Buff implements ActionIndicator.Action {
if (AttackLevel.getLvl(turnsInvis).blinkDistance > 0 && target == Dungeon.hero){ if (AttackLevel.getLvl(turnsInvis).blinkDistance > 0 && target == Dungeon.hero){
ActionIndicator.setAction(this); ActionIndicator.setAction(this);
} }
BuffIndicator.refreshHero();
spend(TICK); spend(TICK);
} else { } else {
detach(); detach();

View File

@ -67,8 +67,6 @@ public class ToxicImbue extends Buff {
left -= TICK; left -= TICK;
if (left <= 0){ if (left <= 0){
detach(); detach();
} else if (left < 5){
BuffIndicator.refreshHero();
} }
return true; return true;

View File

@ -511,9 +511,7 @@ public class Hero extends Char {
} }
checkVisibleMobs(); checkVisibleMobs();
if (!buffs(FlavourBuff.class).isEmpty()) {
BuffIndicator.refreshHero(); BuffIndicator.refreshHero();
}
if (paralysed > 0) { if (paralysed > 0) {

View File

@ -50,10 +50,9 @@ public class Metabolism extends Glyph {
Hunger hunger = Buff.affect(defender, Hunger.class); Hunger hunger = Buff.affect(defender, Hunger.class);
if (hunger != null && !hunger.isStarving()) { if (!hunger.isStarving()) {
hunger.reduceHunger( healing * -10 ); hunger.reduceHunger( healing * -10 );
BuffIndicator.refreshHero();
defender.HP += healing; defender.HP += healing;
defender.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 ); defender.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );

View File

@ -81,7 +81,6 @@ public class CapeOfThorns extends Artifact {
if (cooldown > 0) { if (cooldown > 0) {
cooldown--; cooldown--;
if (cooldown == 0) { if (cooldown == 0) {
BuffIndicator.refreshHero();
GLog.w( Messages.get(this, "inert") ); GLog.w( Messages.get(this, "inert") );
} }
updateQuickslot(); updateQuickslot();
@ -97,7 +96,6 @@ public class CapeOfThorns extends Artifact {
charge = 0; charge = 0;
cooldown = 10+level(); cooldown = 10+level();
GLog.p( Messages.get(this, "radiating") ); GLog.p( Messages.get(this, "radiating") );
BuffIndicator.refreshHero();
} }
} }

View File

@ -203,7 +203,6 @@ public class TalismanOfForesight extends Artifact {
warn --; warn --;
} }
} }
BuffIndicator.refreshHero();
//fully charges in 2000 turns at lvl=0, scaling to 667 turns at lvl = 10. //fully charges in 2000 turns at lvl=0, scaling to 667 turns at lvl = 10.
LockedFloor lock = target.buff(LockedFloor.class); LockedFloor lock = target.buff(LockedFloor.class);

View File

@ -81,7 +81,6 @@ public class ElixirOfAquaticRejuvenation extends Elixir {
target.HP += healAmt; target.HP += healAmt;
left -= healAmt; left -= healAmt;
target.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 ); target.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
BuffIndicator.refreshHero();
} }
if (left <= 0){ if (left <= 0){

View File

@ -240,7 +240,6 @@ public class WandOfLivingEarth extends DamageWand {
return damage - armor; return damage - armor;
} else { } else {
armor -= block; armor -= block;
BuffIndicator.refreshHero();
return damage - block; return damage - block;
} }
} }

View File

@ -89,7 +89,6 @@ public class Kinetic extends Weapon.Enchantment {
public boolean act() { public boolean act() {
preservedDamage -= Math.max(preservedDamage*.025f, 0.1f); preservedDamage -= Math.max(preservedDamage*.025f, 0.1f);
if (preservedDamage <= 0) detach(); if (preservedDamage <= 0) detach();
else if (preservedDamage <= 10) BuffIndicator.refreshHero();
spend(TICK); spend(TICK);
return true; return true;

View File

@ -107,7 +107,6 @@ public class Earthroot extends Plant {
return damage - block; return damage - block;
} else { } else {
level -= block; level -= block;
BuffIndicator.refreshHero();
return damage - block; return damage - block;
} }
} }
@ -115,7 +114,6 @@ public class Earthroot extends Plant {
public void level( int value ) { public void level( int value ) {
if (level < value) { if (level < value) {
level = value; level = value;
BuffIndicator.refreshHero();
} }
pos = target.pos; pos = target.pos;
} }

View File

@ -107,8 +107,6 @@ public class Sungrass extends Plant {
if (level <= 0) { if (level <= 0) {
detach(); detach();
} else {
BuffIndicator.refreshHero();
} }
spend( STEP ); spend( STEP );
return true; return true;

View File

@ -101,8 +101,6 @@ public class Swiftthistle extends Plant {
public void processTime(float time){ public void processTime(float time){
left -= time; left -= time;
BuffIndicator.refreshHero();
if (left <= 0){ if (left <= 0){
detach(); detach();
} }