mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-15 22:19:18 +00:00
Fix: Limit joystick contact to lower bound
This commit is contained in:
parent
ec3ca73972
commit
bc6dd16bbf
@ -90,13 +90,19 @@ class JoystickContact:
|
||||
direction += random_normal_distribution(-5, 5, n=5)
|
||||
radius = cls.RADIUS_RUN if run else cls.RADIUS_WALK
|
||||
radius = random_normal_distribution(*radius, n=5)
|
||||
|
||||
direction = math.radians(direction)
|
||||
point = (
|
||||
cls.CENTER[0] + radius * math.sin(direction),
|
||||
cls.CENTER[1] - radius * math.cos(direction),
|
||||
)
|
||||
point = (int(round(point[0])), int(round(point[1])))
|
||||
|
||||
# Contact at the lower is limited within `cls.CENTER[1] - half_run_radius`
|
||||
# or will exceed the joystick area
|
||||
# Random radius * multiplier makes the point randomly approaching the lower bound
|
||||
for multiplier in [1.0, 0.95, 0.90, 0.85, 0.80, 0.75]:
|
||||
point = (
|
||||
cls.CENTER[0] + radius * multiplier * math.sin(direction),
|
||||
cls.CENTER[1] - radius * multiplier * math.cos(direction),
|
||||
)
|
||||
point = (int(round(point[0])), int(round(point[1])))
|
||||
if point[1] <= cls.CENTER[1] - 101:
|
||||
return point
|
||||
return point
|
||||
|
||||
def up(self):
|
||||
|
Loading…
Reference in New Issue
Block a user