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 static float DURATION = 800f;
{
type = buffType.POSITIVE;
}
@ -60,6 +62,11 @@ public class AdrenalineSurge extends Buff {
return BuffIndicator.FURY;
}
@Override
public float iconFadePercent() {
return Math.max(0, (DURATION - visualcooldown()) / DURATION);
}
@Override
public String toString() {
return Messages.get(this, "name");

View File

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

View File

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

View File

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

View File

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

View File

@ -82,28 +82,21 @@ public class Hunger extends Buff implements Hero.Doom {
} else {
float newLevel = level + STEP;
boolean statusUpdated = false;
if (newLevel >= STARVING) {
GLog.n( Messages.get(this, "onstarving") );
hero.resting = false;
hero.damage( 1, this );
statusUpdated = true;
hero.interrupt();
} else if (newLevel >= HUNGRY && level < HUNGRY) {
GLog.w( Messages.get(this, "onhungry") );
statusUpdated = true;
}
level = newLevel;
if (statusUpdated) {
BuffIndicator.refreshHero();
}
}
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);
}
BuffIndicator.refreshHero();
}
public boolean isStarving() {

View File

@ -40,7 +40,6 @@ public class Momentum extends Buff {
turnsSinceMove++;
if (turnsSinceMove > 0){
stacks = Math.max(0, stacks - turnsSinceMove);
BuffIndicator.refreshHero();
if (stacks == 0) detach();
}
spend(TICK);
@ -50,7 +49,6 @@ public class Momentum extends Buff {
public void gainStack(){
stacks = Math.min(stacks+1, 10);
turnsSinceMove = -1;
BuffIndicator.refreshHero();
}
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){
ActionIndicator.setAction(this);
}
BuffIndicator.refreshHero();
spend(TICK);
} else {
detach();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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