v1.1.0: the berserker now has a short time buffer before rage drops
This commit is contained in:
+12
-3
@@ -45,17 +45,20 @@ public class Berserk extends Buff {
|
|||||||
private static final float LEVEL_RECOVER_START = 2f;
|
private static final float LEVEL_RECOVER_START = 2f;
|
||||||
private float levelRecovery;
|
private float levelRecovery;
|
||||||
|
|
||||||
|
public int powerLossBuffer = 0;
|
||||||
private float power = 0;
|
private float power = 0;
|
||||||
|
|
||||||
private static final String STATE = "state";
|
private static final String STATE = "state";
|
||||||
private static final String LEVEL_RECOVERY = "levelrecovery";
|
private static final String LEVEL_RECOVERY = "levelrecovery";
|
||||||
private static final String POWER = "power";
|
private static final String POWER = "power";
|
||||||
|
private static final String POWER_BUFFER = "power_buffer";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void storeInBundle(Bundle bundle) {
|
public void storeInBundle(Bundle bundle) {
|
||||||
super.storeInBundle(bundle);
|
super.storeInBundle(bundle);
|
||||||
bundle.put(STATE, state);
|
bundle.put(STATE, state);
|
||||||
bundle.put(POWER, power);
|
bundle.put(POWER, power);
|
||||||
|
bundle.put(POWER_BUFFER, powerLossBuffer);
|
||||||
if (state == State.RECOVERING) bundle.put(LEVEL_RECOVERY, levelRecovery);
|
if (state == State.RECOVERING) bundle.put(LEVEL_RECOVERY, levelRecovery);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +68,7 @@ public class Berserk extends Buff {
|
|||||||
|
|
||||||
state = bundle.getEnum(STATE, State.class);
|
state = bundle.getEnum(STATE, State.class);
|
||||||
power = bundle.getFloat(POWER);
|
power = bundle.getFloat(POWER);
|
||||||
|
powerLossBuffer = bundle.getInt(POWER_BUFFER);
|
||||||
if (state == State.RECOVERING) levelRecovery = bundle.getFloat(LEVEL_RECOVERY);
|
if (state == State.RECOVERING) levelRecovery = bundle.getFloat(LEVEL_RECOVERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,10 +98,14 @@ public class Berserk extends Buff {
|
|||||||
power = 0f;
|
power = 0f;
|
||||||
}
|
}
|
||||||
} else if (state == State.NORMAL) {
|
} else if (state == State.NORMAL) {
|
||||||
power -= GameMath.gate(0.1f, power, 1f) * 0.067f * Math.pow((target.HP/(float)target.HT), 2);
|
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){
|
if (power <= 0) {
|
||||||
detach();
|
detach();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spend(TICK);
|
spend(TICK);
|
||||||
@@ -138,6 +146,7 @@ public class Berserk extends Buff {
|
|||||||
float maxPower = 1f + 0.15f*((Hero)target).pointsInTalent(Talent.ENDLESS_RAGE);
|
float maxPower = 1f + 0.15f*((Hero)target).pointsInTalent(Talent.ENDLESS_RAGE);
|
||||||
power = Math.min(maxPower, power + (damage/(float)target.HT)/3f );
|
power = Math.min(maxPower, power + (damage/(float)target.HT)/3f );
|
||||||
BuffIndicator.refreshHero(); //show new power immediately
|
BuffIndicator.refreshHero(); //show new power immediately
|
||||||
|
powerLossBuffer = 3; //2 turns until rage starts dropping
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recover(float percent){
|
public void recover(float percent){
|
||||||
|
|||||||
Reference in New Issue
Block a user