One_Piece_Bounty_Bot / src /model /game /GameDifficulty.py
github-actions[bot]
Automated sync from GitHub
71e71e8
Raw
History Blame Contribute Delete
1.07 kB
from enum import IntEnum
import resources.Environment as Env
from src.utils.LazyPhraseDict import LazyPhraseDict
class GameDifficulty(IntEnum):
EASY = 1
MEDIUM = 2
HARD = 3
@staticmethod
def get_from_total_wager(total_wager: int) -> "GameDifficulty":
"""
Get the game level from the total wager
:param total_wager: The total wager
:return: The game level
"""
if total_wager <= Env.GAME_MAX_TOTAL_WAGER_EASY.get_int():
return GameDifficulty.EASY
if total_wager <= Env.GAME_MAX_TOTAL_WAGER_MEDIUM.get_int():
return GameDifficulty.MEDIUM
return GameDifficulty.HARD
def get_name(self) -> str:
"""
Get the name for this GameDifficulty
:return: The name
"""
return GAME_DIFFICULTY_NAME_DICT[self]
GAME_DIFFICULTY_NAME_DICT = LazyPhraseDict(
{
GameDifficulty.EASY: "GAME_DIFFICULTY_EASY",
GameDifficulty.MEDIUM: "GAME_DIFFICULTY_MEDIUM",
GameDifficulty.HARD: "GAME_DIFFICULTY_HARD",
}
)