v0.6.3b: fixed bugs with berserker, and nerfed him again
This commit is contained in:
parent
87922dc2c5
commit
382da6b45d
|
@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
|||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal.WarriorShield;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
|
@ -89,10 +90,12 @@ public class Berserk extends Buff {
|
|||
}
|
||||
} else {
|
||||
|
||||
float percentHP = target.HP/(float)target.HT;
|
||||
|
||||
if (percentHP > targetHPPercent()){
|
||||
target.HP = (int)Math.max(target.HT*targetHPPercent(), target.HP - pastRages);
|
||||
if (target.HP > targetHPMax()){
|
||||
target.HP = Math.max(targetHPMax(), target.HP - 1);
|
||||
if (target instanceof Hero){
|
||||
((Hero) target).resting = false;
|
||||
target.remove(MagicalSleep.class);
|
||||
}
|
||||
}
|
||||
|
||||
if (state == State.EXHAUSTED){
|
||||
|
@ -110,18 +113,20 @@ public class Berserk extends Buff {
|
|||
public int damageFactor(int dmg){
|
||||
float bonus;
|
||||
|
||||
if (state == State.EXHAUSTED) {
|
||||
bonus = 1f - ((float)Math.sqrt(exhaustion) / 8f);
|
||||
if (state == State.BERSERK){
|
||||
bonus = 2f;
|
||||
} else if (state == State.EXHAUSTED) {
|
||||
bonus = 1f - ((float)Math.sqrt(exhaustion) / 10f);
|
||||
} else {
|
||||
float percentMissing = 1f - target.HP/(float)target.HT;
|
||||
bonus = 1f + (float)Math.pow(percentMissing, 3);
|
||||
float percentMissing = 1f - target.HP/(float)targetHPMax();
|
||||
bonus = 1f + (0.5f * (float)Math.pow(percentMissing, 2));
|
||||
}
|
||||
|
||||
return Math.round(dmg * bonus);
|
||||
}
|
||||
|
||||
public float targetHPPercent(){
|
||||
return Math.round(20* Math.pow(0.8f, pastRages))/20f;
|
||||
public int targetHPMax(){
|
||||
return Math.round(target.HT * Math.round(20* Math.pow(0.8f, pastRages))/20f);
|
||||
}
|
||||
|
||||
public boolean berserking(){
|
||||
|
@ -212,7 +217,8 @@ public class Berserk extends Buff {
|
|||
if (pastRages == 0){
|
||||
text += "\n\n" + Messages.get(this, "no_rages");
|
||||
} 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;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class MagicalSleep extends Buff {
|
|||
if (!target.isImmune(Sleep.class) && super.attachTo( target )) {
|
||||
|
||||
if (target instanceof Hero)
|
||||
if (target.HP == target.HT) {
|
||||
if (target.HP == target.buff(Regeneration.class).regencap()) {
|
||||
GLog.i(Messages.get(this, "toohealthy"));
|
||||
detach();
|
||||
return true;
|
||||
|
@ -64,7 +64,7 @@ public class MagicalSleep extends Buff {
|
|||
if (target instanceof Hero) {
|
||||
target.HP = Math.min(target.HP+1, target.HT);
|
||||
((Hero) target).resting = true;
|
||||
if (target.HP == target.HT) {
|
||||
if (target.HP == target.buff(Regeneration.class).regencap()) {
|
||||
GLog.p(Messages.get(this, "wakeup"));
|
||||
detach();
|
||||
}
|
||||
|
|
|
@ -39,11 +39,11 @@ public class Regeneration extends Buff {
|
|||
public boolean act() {
|
||||
if (target.isAlive()) {
|
||||
|
||||
if (target.HP < target.HT && !((Hero)target).isStarving()) {
|
||||
if (target.HP < regencap() && !((Hero)target).isStarving()) {
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (target.HP > 0 && (lock == null || lock.regenOn())) {
|
||||
target.HP += 1;
|
||||
if (target.HP == target.HT) {
|
||||
if (target.HP == regencap()) {
|
||||
((Hero) target).resting = false;
|
||||
}
|
||||
}
|
||||
|
@ -67,4 +67,8 @@ public class Regeneration extends Buff {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int regencap(){
|
||||
return target.buff(Berserk.class) == null ? target.HT : target.buff(Berserk.class).targetHPMax();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user