Skip to content

Commit

Permalink
simplifications to GameMode
Browse files Browse the repository at this point in the history
  • Loading branch information
cmyui committed Jul 5, 2022
1 parent dc660e8 commit e5a8707
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions app/constants/gamemodes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import functools
from enum import IntEnum
from enum import unique
from typing import Union
Expand Down Expand Up @@ -49,7 +48,6 @@ class GameMode(IntEnum):
AUTOPILOT_MANIA = 11 # unused

@classmethod
@functools.lru_cache(maxsize=32)
def from_params(cls, mode_vn: int, mods: Union[int, GameMode]) -> GameMode:
mode = mode_vn

Expand All @@ -60,14 +58,9 @@ def from_params(cls, mode_vn: int, mods: Union[int, GameMode]) -> GameMode:

return cls(mode)

@functools.cached_property
@property
def as_vanilla(self) -> int:
if self.value & self.AUTOPILOT_OSU:
return self.value - 8
elif self.value & self.RELAX_OSU:
return self.value - 4
else:
return self.value
return self.value % 4

This comment has been minimized.

Copy link
@cmyui

cmyui Jul 5, 2022

Author Member

funny one


def __repr__(self) -> str:
return GAMEMODE_REPR_LIST[self.value]

0 comments on commit e5a8707

Please sign in to comment.