forked from ppy/osu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptimize_slider_v3.py
More file actions
33 lines (23 loc) · 1022 Bytes
/
Copy pathoptimize_slider_v3.py
File metadata and controls
33 lines (23 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import re
file_path = 'osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs'
with open(file_path, 'r') as f:
content = f.read()
# Fix totalTicks to be after nested hit object count check or just use count
old_ticks_logic = """ int hitTicks = 0;
foreach (var nested in hitObject.NestedHitObjects)
{
if (nested.IsHit)
hitTicks++;
}
if (hitTicks == totalTicks)"""
new_ticks_logic = """ int totalTicks = hitObject.NestedHitObjects.Count;
int hitTicks = 0;
foreach (var nested in hitObject.NestedHitObjects)
{
if (nested.IsHit)
hitTicks++;
}
if (hitTicks == totalTicks)"""
content = content.replace(old_ticks_logic, new_ticks_logic)
with open(file_path, 'w') as f:
f.write(content)