Skip to content

Commit

Permalink
fix the singles twist ban mod getting stuck between 2 notes, and touc…
Browse files Browse the repository at this point in the history
…hups
  • Loading branch information
hwabis committed Oct 18, 2024
1 parent 2324be0 commit da645f8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ public class PumpTrainerBeatmapConverterSettings
/// 0 to 1 determining how frequently to generate a singles "twist" that's not a horizontal twist. Higher means more likely.
/// Example starting left foot: C --> UR --> DR
/// Example starting left foot: C --> DR --> UR
/// NON-example starting left foot: UL --> C --> UR (this is a horizontal twist)
/// tl;dr When this is 0, you get something resembling the very ending of Flavor Step D19.
/// </summary>
public double SinglesTwistFrequency = 1;

/// <summary>
/// 0 to 1 determining how frequently to generate two notes that are in adjacent columns on the physical dance pad.
/// One of the notes must be a center panel (aka they do not span across a center panel).
/// One of the notes must be a center panel (aka they do not span across a center panel, aka they must be in the half-doubles region).
/// Higher means more likely.
/// Example starting left foot: P1C --> P2UL
/// Example starting right foot: P2DL --> P1C
Expand Down Expand Up @@ -50,9 +52,9 @@ public class PumpTrainerBeatmapConverterSettings
/// Higher means more likely. For example, P1UR and P1DR are on the same unique column on the physical dance pad.
/// Example: P1C --> P1DR --> P2UL
/// Example: P2UL --> P1DR --> P1C
/// NOT a horizontal triple: P1C --> P2UL --> P2DL (because the physical columns are not unique)
/// NOT a horizontal triple: P1C --> P2UL --> P1DR (because the notes do not go in one direction)
/// NOT a horizontal triple: P1UL --> P1C --> P1UR (because the notes only span a singles pad)
/// NON-example: P1C --> P2UL --> P2DL (because the physical columns are not unique)
/// NON-example: P1C --> P2UL --> P1DR (because the notes do not go in one direction)
/// NON-example: P1UL --> P1C --> P1UR (because the notes only span a singles pad)
/// </summary>
public double HorizontalTripleFrequency = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,8 @@ private void banColumnsCausingBannedPatterns(List<Column> candidateColumns, Foot
}

// Ban horizontal triples
if (random.NextDouble() > Settings.HorizontalTripleFrequency)
// We can't ban horizontal triples if the singles twists mod is on (so that we don't get "stuck" in a pattern)
if (random.NextDouble() > Settings.HorizontalTripleFrequency && Settings.SinglesTwistFrequency == 1)
{
int previousPhysicalColumn = columnToPhysicalColumn[previousColumn];
int previousPreviousPhysicalColumn = columnToPhysicalColumn[previousPreviousColumn];
Expand Down Expand Up @@ -523,7 +524,7 @@ private Column getRandomCandidateColumn(List<Column> candidateColumns, int nonRe
return candidateColumns[random.Next(candidateColumns.Count)];
}

// Reduce the likelihood of trills using nonRepeatWeight
// Reduce the likelihood of trills using the non-repeat weight

Column previousPreviousColumn = hitObjectsSoFar[^2].Column;
List<Column> candidateColumnsWeighted = [];
Expand All @@ -539,17 +540,6 @@ private Column getRandomCandidateColumn(List<Column> candidateColumns, int nonRe
candidateColumnsWeighted.Add(candidateColumn);
}
}

if (Settings.SinglesTwistFrequency > 0)
{
if (candidateColumn == Column.P1C || candidateColumn == Column.P2C)
{
for (int i = 0; i < Settings.SinglesTwistFrequency; i++)
{
candidateColumnsWeighted.Add(candidateColumn);
}
}
}
}

return candidateColumnsWeighted[random.Next(candidateColumnsWeighted.Count)];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class PumpTrainerModBanFarColumns : Mod, IApplicableToBeatmapConverter
public override string Name => "[Half-Dbl+] Ban Far Columns";
public override string Acronym => "D";
public override LocalisableString Description =>
"Reduces the frequency of two consecutive notes in the half-doubles region that are not in physically adjacent columns.";
"Bans two consecutive notes in the half-doubles region that are not in physically adjacent columns.";
public override double ScoreMultiplier => 1;
public override ModType Type => ModType.DifficultyReduction;
public override Type[] IncompatibleMods => new Type[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ public class PumpTrainerModBanSinglesTwists : Mod, IApplicableToBeatmapConverter
public override string Name => "[P1Single+] Ban Simple Twists";
public override string Acronym => "S";
public override LocalisableString Description =>
"Reduces the frequency of the right foot hitting the left pads, and vice versa, in the context of a single pad.";
"Bans the right foot hitting the left pads and vice versa, in the context of a single pad. (Horizontal triples is turned on.)";
public override double ScoreMultiplier => 1;
public override ModType Type => ModType.DifficultyReduction;
public override Type[] IncompatibleMods => new Type[]
{
typeof(PumpTrainerModHorizontalTwists),
typeof(PumpTrainerModDiagonalTwists),
typeof(PumpTrainerModHorizontalTriples),
typeof(PumpTrainerModDiagonalSkips),
typeof(PumpTrainerModHorizontalTriples),

typeof(PumpTrainerModExcludeP1DL),
typeof(PumpTrainerModExcludeP1UL),
Expand Down

0 comments on commit da645f8

Please sign in to comment.