Small fix for willpower leveling
This commit is contained in:
@@ -52,9 +52,15 @@ public class SanityCapability implements ISanity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setBonusMaxSanity(float bonusMaxSanity) {
|
public void setBonusMaxSanity(float bonusMaxSanity) {
|
||||||
|
float oldMax = getMaxSanity();
|
||||||
this.bonusMaxSanity = Math.max(0f, bonusMaxSanity);
|
this.bonusMaxSanity = Math.max(0f, bonusMaxSanity);
|
||||||
setSanity(this.sanity);
|
float newMax = getMaxSanity();
|
||||||
setInsanity(this.insanity);
|
if (oldMax > 0) {
|
||||||
|
float pct = sanity / oldMax;
|
||||||
|
sanity = pct * newMax;
|
||||||
|
}
|
||||||
|
setSanity(sanity);
|
||||||
|
setInsanity(insanity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getBonusMaxSanity() {
|
public float getBonusMaxSanity() {
|
||||||
|
|||||||
@@ -49,8 +49,14 @@ public class TempoCapability implements ITempo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setBonusMaxTempo(float bonusMaxTempo) {
|
public void setBonusMaxTempo(float bonusMaxTempo) {
|
||||||
|
int oldMax = getMaxTempo();
|
||||||
this.bonusMaxTempo = Math.max(0f, bonusMaxTempo);
|
this.bonusMaxTempo = Math.max(0f, bonusMaxTempo);
|
||||||
setTempo(this.tempo);
|
int newMax = getMaxTempo();
|
||||||
|
if (oldMax > 0) {
|
||||||
|
float pct = (float) tempo / (float) oldMax;
|
||||||
|
tempo = Math.round(pct * newMax);
|
||||||
|
}
|
||||||
|
setTempo(tempo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getBonusMaxTempo() {
|
public float getBonusMaxTempo() {
|
||||||
|
|||||||
Reference in New Issue
Block a user