void GenerateBreaks(HitokoriBeatmap Beatmap) { List <BreakPeriod> breaks = new List <BreakPeriod>(); foreach (var i in Beatmap.HitObjects.OfType <HitokoriTileObject>()) { if (i.LastPoint.Duration >= HitokoriPlayfield.MinimumBreakTime) { breaks.Add(new BreakPeriod(i.LastPoint.HitTime, i.LastPoint.HitTime + i.LastPoint.Duration)); } } Beatmap.Breaks = breaks; }
void RemoveUnhitable(HitokoriBeatmap Beatmap) { List <HitokoriHitObject> objects = Beatmap.HitObjects; List <HitokoriHitObject> valid = new List <HitokoriHitObject>(); double lastEndTime = -10000; foreach (var i in objects) { if (i.StartTime < lastEndTime) { continue; } valid.Add(i); lastEndTime = i.GetEndTime(); } Beatmap.HitObjects = valid; }
void PostProcess(HitokoriBeatmap Beatmap) { Beatmap.HitObjects = Beatmap.HitObjects.OrderBy(x => x.StartTime).ToList(); // some hold objects are not always ordered. RemoveUnhitable(Beatmap); TilePoint firstPoint = new FirstTilePoint { BPMS = BPMSAt(0), IsClockwise = true, HitTime = -1000 }; HitokoriTileObject StartTile = new StartTile { HoldPoint = firstPoint }; ConnectHitObjects(Beatmap.HitObjects.OfType <HitokoriTileObject>().Prepend(StartTile)); PatternGenerator <HitokoriTileObject> generator = new PatternGenerator <HitokoriTileObject>(); generator.OnBatch += (original, processed) => { processed = processed.Prepend(original.First().Previous); var last = original.Last(); if (last.Next != null) { processed = processed.Append(last.Next); } ConnectHitObjects(processed); }; if (NoHolds) { generator.AddPattern(new FuckHoldsPatern()); } generator.AddPattern(new ReverseHoldPattern()); if (GenerateSpins) { generator.AddPattern(new SpinPattern()); } generator.AddPattern(new StairsPattern()); generator.Process(Beatmap.HitObjects.OfType <HitokoriTileObject>()); var tiles = StartTile.GetWholeChain().Skip(1); Beatmap.HitObjects = tiles.Cast <HitokoriHitObject>().ToList(); if (Untangle) { generator.ClearPatterns(); generator.AddPattern(new UntanglePattern()); generator.Process(Beatmap.HitObjects.OfType <HitokoriTileObject>()); tiles = StartTile.GetWholeChain().Skip(1); Beatmap.HitObjects = tiles.Cast <HitokoriHitObject>().ToList(); } if (Flip) { foreach (var tile in tiles.SelectMany(x => x.AllTiles)) { tile.IsClockwise = !tile.IsClockwise; } } if (Triplets) { foreach (var tile in tiles.SelectMany(x => x.AllTiles)) { tile.useTripletAngles = true; } } foreach (var tile in Beatmap.HitObjects) { tile.StylizeTiles(); } tiles.First().FirstPoint.RefreshChain(); }