v0.6.3: rebalanced berserker

This commit is contained in:
Evan Debenham 2018-01-07 03:07:58 -05:00
parent 53d413b56a
commit 274b885940
3 changed files with 53 additions and 18 deletions

View File

@ -39,15 +39,18 @@ public class Berserk extends Buff {
} }
private State state = State.NORMAL; private State state = State.NORMAL;
private static final int EXHAUSTION_START = 60; private static final int EXHAUSTION_START = 30;
private int exhaustion; private int exhaustion;
private static final float LEVEL_RECOVER_START = 3f; private static final float LEVEL_RECOVER_START = 2f;
private float levelRecovery; private float levelRecovery;
private int pastRages = 0;
private static final String STATE = "state"; private static final String STATE = "state";
private static final String EXHAUSTION = "exhaustion"; private static final String EXHAUSTION = "exhaustion";
private static final String LEVEL_RECOVERY = "levelrecovery"; private static final String LEVEL_RECOVERY = "levelrecovery";
private static final String PAST_RAGES = "pastrages";
@Override @Override
public void storeInBundle(Bundle bundle) { public void storeInBundle(Bundle bundle) {
@ -55,6 +58,7 @@ public class Berserk extends Buff {
bundle.put(STATE, state); bundle.put(STATE, state);
if (state == State.EXHAUSTED) bundle.put(EXHAUSTION, exhaustion); if (state == State.EXHAUSTED) bundle.put(EXHAUSTION, exhaustion);
if (state == State.EXHAUSTED || state == State.RECOVERING) bundle.put(LEVEL_RECOVERY, levelRecovery); if (state == State.EXHAUSTED || state == State.RECOVERING) bundle.put(LEVEL_RECOVERY, levelRecovery);
bundle.put( PAST_RAGES, pastRages );
} }
@Override @Override
@ -63,6 +67,7 @@ public class Berserk extends Buff {
state = bundle.getEnum(STATE, State.class); state = bundle.getEnum(STATE, State.class);
if (state == State.EXHAUSTED) exhaustion = bundle.getInt(EXHAUSTION); if (state == State.EXHAUSTED) exhaustion = bundle.getInt(EXHAUSTION);
if (state == State.EXHAUSTED || state == State.RECOVERING) levelRecovery = bundle.getFloat(LEVEL_RECOVERY); if (state == State.EXHAUSTED || state == State.RECOVERING) levelRecovery = bundle.getFloat(LEVEL_RECOVERY);
pastRages = bundle.getInt(PAST_RAGES);
} }
@Override @Override
@ -80,12 +85,22 @@ public class Berserk extends Buff {
levelRecovery = LEVEL_RECOVER_START; levelRecovery = LEVEL_RECOVER_START;
BuffIndicator.refreshHero(); BuffIndicator.refreshHero();
target.SHLD = 0; target.SHLD = 0;
pastRages++;
} }
} else if (state == State.EXHAUSTED){ } else {
exhaustion--;
if (exhaustion == 0){ float percentHP = target.HP/(float)target.HT;
state = State.RECOVERING;
BuffIndicator.refreshHero(); if (percentHP > targetHPPercent()){
target.HP = (int)Math.max(target.HT*targetHPPercent(), target.HP - pastRages);
}
if (state == State.EXHAUSTED){
exhaustion--;
if (exhaustion == 0){
state = State.RECOVERING;
BuffIndicator.refreshHero();
}
} }
} }
spend(TICK); spend(TICK);
@ -95,17 +110,19 @@ public class Berserk extends Buff {
public int damageFactor(int dmg){ public int damageFactor(int dmg){
float bonus; float bonus;
if (state == State.BERSERK){ if (state == State.EXHAUSTED) {
bonus = 2f; bonus = 1f - ((float)Math.sqrt(exhaustion) / 8f);
} else if (state == State.EXHAUSTED) {
bonus = 1f - ((float)Math.sqrt(exhaustion) / 10f);
} else { } else {
float percentMissing = 1f - target.HP/(float)target.HT; float percentMissing = 1f - target.HP/(float)target.HT;
bonus = 1f + (0.5f * (float)Math.pow(percentMissing, 2)); bonus = 1f + (float)Math.pow(percentMissing, 3);
} }
return Math.round(dmg * bonus); return Math.round(dmg * bonus);
} }
public float targetHPPercent(){
return Math.round(20* Math.pow(0.8f, pastRages))/20f;
}
public boolean berserking(){ public boolean berserking(){
if (target.HP == 0 && state == State.NORMAL){ if (target.HP == 0 && state == State.NORMAL){
@ -178,15 +195,25 @@ public class Berserk extends Buff {
@Override @Override
public String desc() { public String desc() {
float dispDamage = damageFactor(100); float dispDamage = damageFactor(100);
String text;
switch (state){ switch (state){
case NORMAL: default: case NORMAL: default:
return Messages.get(this, "angered_desc", dispDamage); text = Messages.get(this, "angered_desc", dispDamage);
break;
case BERSERK: case BERSERK:
return Messages.get(this, "berserk_desc"); return Messages.get(this, "berserk_desc");
case EXHAUSTED: case EXHAUSTED:
return Messages.get(this, "exhausted_desc", exhaustion , dispDamage); text = Messages.get(this, "exhausted_desc", exhaustion , dispDamage);
break;
case RECOVERING: case RECOVERING:
return Messages.get(this, "recovering_desc", levelRecovery, dispDamage); text = Messages.get(this, "recovering_desc", levelRecovery, dispDamage);
break;
} }
if (pastRages == 0){
text += "\n\n" + Messages.get(this, "no_rages");
} else {
text += "\n\n" + Messages.get(this, "past_rages", pastRages, (int)(targetHPPercent()*100));
}
return text;
} }
} }

View File

@ -27,6 +27,12 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.ChaliceOfBlood;
public class Regeneration extends Buff { public class Regeneration extends Buff {
{
//unlike other buffs, this one acts after the hero and takes priority against other effects
//healing is much more useful if you get some of it off before taking damage
actPriority = HERO_PRIO - 1;
}
private static final float REGENERATION_DELAY = 10; private static final float REGENERATION_DELAY = 10;
@Override @Override

View File

@ -45,10 +45,12 @@ actors.buffs.berserk.angered=Angered
actors.buffs.berserk.berserk=Berserking actors.buffs.berserk.berserk=Berserking
actors.buffs.berserk.exhausted=Exhausted actors.buffs.berserk.exhausted=Exhausted
actors.buffs.berserk.recovering=Recovering actors.buffs.berserk.recovering=Recovering
actors.buffs.berserk.angered_desc=The severity of the berserker's injuries strengthen his blows. The lower the berserker's health is, the more bonus damage he will deal. This bonus is significantly stronger when the berserker is close to death.\n\nWhen the berserker is brought to 0 hp and is wearing his seal, he will go berserk and _refuse to die_ for a short time.\n\nCurrent damage: %.0f%% actors.buffs.berserk.angered_desc=The severity of the berserker's injuries strengthen his blows. The lower the berserker's health is, the more bonus damage he will deal. This bonus is significantly stronger when the berserker is close to death.\n\nWhen the berserker is brought to 0 hp and is wearing his seal, he will go berserk and _refuse to die_ for a short time.\n\nCurrent damage: _%.0f%%_
actors.buffs.berserk.berserk_desc=At the brink of death, fear and uncertainty bleed away, leaving only anger. In this state of near-death the berserker is incredibly powerful, _dealing double damage, gaining bonus shielding, and refusing to die._\n\nThis bonus shielding is stronger the better the berserker's armor, and will slowly deplete over time. When this shielding is reduced to 0, the berserker will give in and die.\n\nAny form of healing will return the berserker to stability, but he will be exhausted. While exhausted, the berserker will suffer a large reduction in damage for a short time, and then will need to gain experience before being able to berserk again. actors.buffs.berserk.berserk_desc=At the brink of death, fear and uncertainty bleed away, leaving only anger. In this state of near-death the berserker is incredibly powerful, _dealing double damage, gaining bonus shielding, and refusing to die._\n\nThis bonus shielding is stronger the better the berserker's armor, and will slowly deplete over time. When this shielding is reduced to 0, the berserker will give in and die.\n\nAny form of healing will return the berserker to stability, but he will be exhausted. While exhausted, the berserker will suffer a large reduction in damage for a short time, and then will need to gain experience before being able to berserk again.
actors.buffs.berserk.exhausted_desc=Inner strength has its limits. The berserker is exhausted, weakening him and making him unable to rage.\n\nIn this state The berserker deals significantly reduced damage, and will immediately die at 0 health.\n\nTurns of exhaustion remaining: %d\nCurrent damage: %.0f%% actors.buffs.berserk.exhausted_desc=Inner strength has its limits. The berserker is exhausted, weakening him and making him unable to rage.\n\nIn this state The berserker deals significantly reduced damage, and will _immediately die at 0 health._\n\nTurns of exhaustion remaining: _%d_\nCurrent damage: _%.0f%%_
actors.buffs.berserk.recovering_desc=Inner strength has its limits. The berserker must rest before using his rage again.\n\nWhile recovering the berserker still deals bonus damage, but will immediately die at 0 health.\n\nLevels until recovered: %.2f\nCurrent damage: %.0f%% actors.buffs.berserk.recovering_desc=Inner strength has its limits. The berserker must rest before using his rage again.\n\nWhile recovering the berserker still deals bonus damage, but will _immediately die at 0 health._\n\nLevels until recovered: _%.2f_\nCurrent damage: _%.0f%%_
actors.buffs.berserk.no_rages=Berserking will also permanently wear on the him, reducing his max health each time.
actors.buffs.berserk.past_rages=Times berserker has raged: _%d_\nMax health reduced to: _%d%%_
actors.buffs.berserk.rankings_desc=Berserked to Death actors.buffs.berserk.rankings_desc=Berserked to Death
actors.buffs.bleeding.name=Bleeding actors.buffs.bleeding.name=Bleeding