Stardew Valley: Refactor skill progression to use new feature system (#3662)

* create a first draft of the feature

* use feature in items and locations

* add content to more places

* use feature in logic

* replace option check by feature

* remove unused code

* remove weird white space

* some import nitpicking

* flip negative if
This commit is contained in:
Jouramie
2024-11-30 21:52:07 -05:00
committed by GitHub
parent f735416bda
commit a67688749f
21 changed files with 244 additions and 181 deletions

View File

@@ -1,7 +1,21 @@
from dataclasses import dataclass, field
from functools import cached_property
from typing import Iterable, Tuple
@dataclass(frozen=True)
class Skill:
name: str
has_mastery: bool = field(kw_only=True)
@cached_property
def mastery_name(self) -> str:
return f"{self.name} Mastery"
@cached_property
def level_name(self) -> str:
return f"{self.name} Level"
@cached_property
def level_names_by_level(self) -> Iterable[Tuple[int, str]]:
return tuple((level, f"Level {level} {self.name}") for level in range(1, 11))