Skip to content

Commit

Permalink
Fix hardcoded stack timeout in stacking algorithm. (#183)
Browse files Browse the repository at this point in the history
Signed-off-by: Jeffrey Han <[email protected]>
  • Loading branch information
itdelatrisu committed Jan 7, 2017
1 parent e62822a commit 9b5f26d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/itdelatrisu/opsu/beatmap/BeatmapHPDropRateCalculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void calculate() {
float lowestHpComboEnd = Utils.mapDifficultyRange(hpDrainRate, 198, 170, 80);
float lowestHpEnd = Utils.mapDifficultyRange(hpDrainRate, 198, 180, 80);
float hpRecoveryAvailable = Utils.mapDifficultyRange(hpDrainRate, 8, 4, 0);
int difficultyPreEmpt = (int) Utils.mapDifficultyRange(overallDifficulty, 1800, 1200, 450);
int approachTime = (int) Utils.mapDifficultyRange(overallDifficulty, 1800, 1200, 450);

float testDrop = 0.05f;
Health health = new Health();
Expand All @@ -88,7 +88,7 @@ public void calculate() {
health.reset();
health.setModifiers(hpDrainRate, hpMultiplierNormal, hpMultiplierComboEnd);
double lowestHp = health.getRawHealth();
int lastTime = beatmap.objects[0].getTime() - difficultyPreEmpt;
int lastTime = beatmap.objects[0].getTime() - approachTime;
int comboTooLowCount = 0;
boolean fail = false;
int timingPointIndex = 0;
Expand Down
10 changes: 2 additions & 8 deletions src/itdelatrisu/opsu/states/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ public enum Restart {
/** Tolerance in case if hit object is not snapped to the grid. */
private static final float STACK_LENIENCE = 3f;

/** Stack time window of the previous object, in ms. */
private static final int STACK_TIMEOUT = 1000;

/** Stack position offset modifier. */
private static final float STACK_OFFSET_MODIFIER = 0.05f;

Expand Down Expand Up @@ -1776,10 +1773,7 @@ private void setMapModifiers() {
Options.getSkin().getSliderBorderColor() : beatmap.getSliderBorderColor());

// approachRate (hit object approach time)
if (approachRate < 5)
approachTime = (int) (1800 - (approachRate * 120));
else
approachTime = (int) (1200 - ((approachRate - 5) * 150));
approachTime = (int) Utils.mapDifficultyRange(approachRate, 1800, 1200, 450);

// overallDifficulty (hit result time offsets)
hitResultOffset = new int[GameData.HIT_MAX];
Expand Down Expand Up @@ -2070,7 +2064,7 @@ private void calculateStacks() {
continue;

// check if in range stack calculation
float timeI = hitObjectI.getTime() - (STACK_TIMEOUT * beatmap.stackLeniency);
float timeI = hitObjectI.getTime() - (approachTime * beatmap.stackLeniency);
float timeN = hitObjectN.isSlider() ? gameObjects[n].getEndTime() : hitObjectN.getTime();
if (timeI > timeN)
break;
Expand Down

0 comments on commit 9b5f26d

Please sign in to comment.