v0.6.3b: fixed bugs with berserker, and nerfed him again

This commit is contained in:
Evan Debenham 2018-03-01 00:30:04 -05:00
parent 87922dc2c5
commit 382da6b45d
3 changed files with 26 additions and 16 deletions

View File

@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite; import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal.WarriorShield; import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal.WarriorShield;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@ -89,10 +90,12 @@ public class Berserk extends Buff {
} }
} else { } else {
float percentHP = target.HP/(float)target.HT; if (target.HP > targetHPMax()){
target.HP = Math.max(targetHPMax(), target.HP - 1);
if (percentHP > targetHPPercent()){ if (target instanceof Hero){
target.HP = (int)Math.max(target.HT*targetHPPercent(), target.HP - pastRages); ((Hero) target).resting = false;
target.remove(MagicalSleep.class);
}
} }
if (state == State.EXHAUSTED){ if (state == State.EXHAUSTED){
@ -109,19 +112,21 @@ public class Berserk extends Buff {
public int damageFactor(int dmg){ public int damageFactor(int dmg){
float bonus; float bonus;
if (state == State.EXHAUSTED) { if (state == State.BERSERK){
bonus = 1f - ((float)Math.sqrt(exhaustion) / 8f); bonus = 2f;
} 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)targetHPMax();
bonus = 1f + (float)Math.pow(percentMissing, 3); bonus = 1f + (0.5f * (float)Math.pow(percentMissing, 2));
} }
return Math.round(dmg * bonus); return Math.round(dmg * bonus);
} }
public float targetHPPercent(){ public int targetHPMax(){
return Math.round(20* Math.pow(0.8f, pastRages))/20f; return Math.round(target.HT * Math.round(20* Math.pow(0.8f, pastRages))/20f);
} }
public boolean berserking(){ public boolean berserking(){
@ -212,7 +217,8 @@ public class Berserk extends Buff {
if (pastRages == 0){ if (pastRages == 0){
text += "\n\n" + Messages.get(this, "no_rages"); text += "\n\n" + Messages.get(this, "no_rages");
} else { } else {
text += "\n\n" + Messages.get(this, "past_rages", pastRages, (int)(targetHPPercent()*100)); int dispPercent = (int)(targetHPMax()/(float)target.HT * 100);
text += "\n\n" + Messages.get(this, "past_rages", pastRages, dispPercent);
} }
return text; return text;
} }

View File

@ -37,7 +37,7 @@ public class MagicalSleep extends Buff {
if (!target.isImmune(Sleep.class) && super.attachTo( target )) { if (!target.isImmune(Sleep.class) && super.attachTo( target )) {
if (target instanceof Hero) if (target instanceof Hero)
if (target.HP == target.HT) { if (target.HP == target.buff(Regeneration.class).regencap()) {
GLog.i(Messages.get(this, "toohealthy")); GLog.i(Messages.get(this, "toohealthy"));
detach(); detach();
return true; return true;
@ -64,7 +64,7 @@ public class MagicalSleep extends Buff {
if (target instanceof Hero) { if (target instanceof Hero) {
target.HP = Math.min(target.HP+1, target.HT); target.HP = Math.min(target.HP+1, target.HT);
((Hero) target).resting = true; ((Hero) target).resting = true;
if (target.HP == target.HT) { if (target.HP == target.buff(Regeneration.class).regencap()) {
GLog.p(Messages.get(this, "wakeup")); GLog.p(Messages.get(this, "wakeup"));
detach(); detach();
} }

View File

@ -39,11 +39,11 @@ public class Regeneration extends Buff {
public boolean act() { public boolean act() {
if (target.isAlive()) { if (target.isAlive()) {
if (target.HP < target.HT && !((Hero)target).isStarving()) { if (target.HP < regencap() && !((Hero)target).isStarving()) {
LockedFloor lock = target.buff(LockedFloor.class); LockedFloor lock = target.buff(LockedFloor.class);
if (target.HP > 0 && (lock == null || lock.regenOn())) { if (target.HP > 0 && (lock == null || lock.regenOn())) {
target.HP += 1; target.HP += 1;
if (target.HP == target.HT) { if (target.HP == regencap()) {
((Hero) target).resting = false; ((Hero) target).resting = false;
} }
} }
@ -67,4 +67,8 @@ public class Regeneration extends Buff {
return true; return true;
} }
public int regencap(){
return target.buff(Berserk.class) == null ? target.HT : target.buff(Berserk.class).targetHPMax();
}
} }