Skip to content

Commit

Permalink
Fix failing status in multiplayer not accounting for Easy mod lives
Browse files Browse the repository at this point in the history
  • Loading branch information
Rian8337 committed Dec 25, 2023
1 parent 66cb7cc commit 426e426
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/ru/nsu/ccfit/zuev/osu/scoring/StatisticV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public class StatisticV2 implements Serializable {
*/
private float modScoreMultiplier = 1;

private int life = 1;


public StatisticV2() {
playerName = null;
Expand Down Expand Up @@ -113,6 +115,10 @@ public StatisticV2(final Statistic stat) {
hp = stat.hp;
diffModifier = stat.diffModifier;
mod = stat.mod.clone();
if (stat.mod.contains(GameMod.MOD_EASY)) {
life = 3;
}

setPlayerName(Config.getLocalUsername());
computeModScoreMultiplier();
}
Expand Down Expand Up @@ -152,7 +158,9 @@ public void changeHp(final float amount) {
hp += amount;
if (hp < 0) {
hp = 0;
if (canFail) {
life = Math.max(0, life - 1);

if (canFail && life == 0) {
isAlive = false;
}
}
Expand Down Expand Up @@ -559,6 +567,7 @@ public void setModFromString(String s) {
break;
case 'e':
mod.add(GameMod.MOD_EASY);
life = 3;
break;
case 'n':
mod.add(GameMod.MOD_NOFAIL);
Expand Down

0 comments on commit 426e426

Please sign in to comment.