Skip to content

Commit

Permalink
fix hit rate bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Althoumb committed Apr 5, 2018
1 parent 7bc5ab1 commit 6e05c9b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/game/RhythmState.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class RhythmState extends DefaultGameState {
private float timescale = .08f; // rate at which approach circles shrink. doesn't
// change the time circles are on screen, however
private int points = 0; // total number of points
private int hits = 0; // total number of completed circles
private float perfection = 0; // perfection points
private int combo = 0; // current combo
private int hitobjectscompleted = 0; // number of passed hitobjects, includes both hit
Expand Down Expand Up @@ -263,7 +264,7 @@ public void update(GameContainer gc, StateBasedGame sbg, int delta)
hitobject.duration, hitobject.clicked));
hitobjects.remove(index);
hitobjectscompleted++;
hitpercent = (float) (Math.floor(10000 * points / hitobjectscompleted)
hitpercent = (float) (Math.floor(10000 * hits / hitobjectscompleted)
/ 100);
perfectionpercent = (float) (Math
.floor(10000 * perfection / hitobjectscompleted)
Expand Down Expand Up @@ -295,6 +296,7 @@ public void click() {
// Formula: Base score of a hit + Base score of a hit
// * (Combo multiplier * Difficulty multiplier * Mod multiplier) / 25
points += 50 + 50 * (combo * 0.5 * 1) / 25; // increments points
hits++;
perfection += 1.0 - Math.abs(hitobject.duration) / LENIENCE_TIME;
combo++; // increases combo
}
Expand Down

0 comments on commit 6e05c9b

Please sign in to comment.