v1.1.0: the berserker now has a short time buffer before rage drops

This commit is contained in:
Evan Debenham 2021-09-21 18:46:26 -04:00
parent 0cc45f0701
commit ed019030d0

View File

@ -44,18 +44,21 @@ public class Berserk extends Buff {
private static final float LEVEL_RECOVER_START = 2f;
private float levelRecovery;
public int powerLossBuffer = 0;
private float power = 0;
private static final String STATE = "state";
private static final String LEVEL_RECOVERY = "levelrecovery";
private static final String POWER = "power";
private static final String POWER_BUFFER = "power_buffer";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put(STATE, state);
bundle.put(POWER, power);
bundle.put(POWER_BUFFER, powerLossBuffer);
if (state == State.RECOVERING) bundle.put(LEVEL_RECOVERY, levelRecovery);
}
@ -65,6 +68,7 @@ public class Berserk extends Buff {
state = bundle.getEnum(STATE, State.class);
power = bundle.getFloat(POWER);
powerLossBuffer = bundle.getInt(POWER_BUFFER);
if (state == State.RECOVERING) levelRecovery = bundle.getFloat(LEVEL_RECOVERY);
}
@ -94,10 +98,14 @@ public class Berserk extends Buff {
power = 0f;
}
} else if (state == State.NORMAL) {
power -= GameMath.gate(0.1f, power, 1f) * 0.067f * Math.pow((target.HP/(float)target.HT), 2);
if (power <= 0){
detach();
if (powerLossBuffer > 0){
powerLossBuffer--;
} else {
power -= GameMath.gate(0.1f, power, 1f) * 0.067f * Math.pow((target.HP / (float) target.HT), 2);
if (power <= 0) {
detach();
}
}
}
spend(TICK);
@ -138,6 +146,7 @@ public class Berserk extends Buff {
float maxPower = 1f + 0.15f*((Hero)target).pointsInTalent(Talent.ENDLESS_RAGE);
power = Math.min(maxPower, power + (damage/(float)target.HT)/3f );
BuffIndicator.refreshHero(); //show new power immediately
powerLossBuffer = 3; //2 turns until rage starts dropping
}
public void recover(float percent){