v3.3.5: fixed unequipping armor leading to a full shield CD refund.
This commit is contained in:
@@ -256,6 +256,7 @@ public class BrokenSeal extends Item {
|
|||||||
|
|
||||||
private int cooldown = 0;
|
private int cooldown = 0;
|
||||||
private float turnsSinceEnemies = 0;
|
private float turnsSinceEnemies = 0;
|
||||||
|
private int initialShield = 0;
|
||||||
|
|
||||||
private static int COOLDOWN_START = 150;
|
private static int COOLDOWN_START = 150;
|
||||||
|
|
||||||
@@ -281,7 +282,7 @@ public class BrokenSeal extends Item {
|
|||||||
@Override
|
@Override
|
||||||
public float iconFadePercent() {
|
public float iconFadePercent() {
|
||||||
if (shielding() > 0){
|
if (shielding() > 0){
|
||||||
return GameMath.gate(0, 1f - shielding()/(float)maxShield(), 1);
|
return GameMath.gate(0, 1f - shielding()/(float)initialShield, 1);
|
||||||
} else if (coolingDown()){
|
} else if (coolingDown()){
|
||||||
return GameMath.gate(0, cooldown / (float)COOLDOWN_START, 1);
|
return GameMath.gate(0, cooldown / (float)COOLDOWN_START, 1);
|
||||||
} else if (cooldown < 0) {
|
} else if (cooldown < 0) {
|
||||||
@@ -324,7 +325,7 @@ public class BrokenSeal extends Item {
|
|||||||
turnsSinceEnemies += HoldFast.buffDecayFactor(target);
|
turnsSinceEnemies += HoldFast.buffDecayFactor(target);
|
||||||
if (turnsSinceEnemies >= 5){
|
if (turnsSinceEnemies >= 5){
|
||||||
if (cooldown > 0) {
|
if (cooldown > 0) {
|
||||||
float percentLeft = shielding() / (float)maxShield();
|
float percentLeft = shielding() / (float)initialShield;
|
||||||
//max of 50% cooldown refund
|
//max of 50% cooldown refund
|
||||||
cooldown = Math.max(0, (int)(cooldown - COOLDOWN_START * (percentLeft / 2f)));
|
cooldown = Math.max(0, (int)(cooldown - COOLDOWN_START * (percentLeft / 2f)));
|
||||||
}
|
}
|
||||||
@@ -347,6 +348,7 @@ public class BrokenSeal extends Item {
|
|||||||
incShield(maxShield());
|
incShield(maxShield());
|
||||||
cooldown = Math.max(0, cooldown+COOLDOWN_START);
|
cooldown = Math.max(0, cooldown+COOLDOWN_START);
|
||||||
turnsSinceEnemies = 0;
|
turnsSinceEnemies = 0;
|
||||||
|
initialShield = maxShield();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean coolingDown(){
|
public boolean coolingDown(){
|
||||||
@@ -377,12 +379,14 @@ public class BrokenSeal extends Item {
|
|||||||
|
|
||||||
public static final String COOLDOWN = "cooldown";
|
public static final String COOLDOWN = "cooldown";
|
||||||
public static final String TURNS_SINCE_ENEMIES = "turns_since_enemies";
|
public static final String TURNS_SINCE_ENEMIES = "turns_since_enemies";
|
||||||
|
public static final String INITIAL_SHIELD = "initial_shield";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void storeInBundle(Bundle bundle) {
|
public void storeInBundle(Bundle bundle) {
|
||||||
super.storeInBundle(bundle);
|
super.storeInBundle(bundle);
|
||||||
bundle.put(COOLDOWN, cooldown);
|
bundle.put(COOLDOWN, cooldown);
|
||||||
bundle.put(TURNS_SINCE_ENEMIES, turnsSinceEnemies);
|
bundle.put(TURNS_SINCE_ENEMIES, turnsSinceEnemies);
|
||||||
|
bundle.put(INITIAL_SHIELD, initialShield);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -391,10 +395,12 @@ public class BrokenSeal extends Item {
|
|||||||
if (bundle.contains(COOLDOWN)) {
|
if (bundle.contains(COOLDOWN)) {
|
||||||
cooldown = bundle.getInt(COOLDOWN);
|
cooldown = bundle.getInt(COOLDOWN);
|
||||||
turnsSinceEnemies = bundle.getFloat(TURNS_SINCE_ENEMIES);
|
turnsSinceEnemies = bundle.getFloat(TURNS_SINCE_ENEMIES);
|
||||||
|
initialShield = bundle.getInt(INITIAL_SHIELD);
|
||||||
|
|
||||||
//if we have shield from pre-3.1, have it last a bit
|
//if we have shield from pre-3.1, have it last a bit
|
||||||
} else if (shielding() > 0) {
|
} else if (shielding() > 0) {
|
||||||
turnsSinceEnemies = -100;
|
turnsSinceEnemies = -100;
|
||||||
|
initialShield = shielding();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user