Files
Grinch-AP/worlds/stardew_valley/content/feature/skill_progression.py
Jouramie a67688749f 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
2024-12-01 03:52:07 +01:00

47 lines
1.3 KiB
Python

from abc import ABC, abstractmethod
from typing import ClassVar, Iterable, Tuple
from ...data.skill import Skill
class SkillProgressionFeature(ABC):
is_progressive: ClassVar[bool]
are_masteries_shuffled: ClassVar[bool]
@abstractmethod
def get_randomized_level_names_by_level(self, skill: Skill) -> Iterable[Tuple[int, str]]:
...
@abstractmethod
def is_mastery_randomized(self, skill: Skill) -> bool:
...
class SkillProgressionVanilla(SkillProgressionFeature):
is_progressive = False
are_masteries_shuffled = False
def get_randomized_level_names_by_level(self, skill: Skill) -> Iterable[Tuple[int, str]]:
return ()
def is_mastery_randomized(self, skill: Skill) -> bool:
return False
class SkillProgressionProgressive(SkillProgressionFeature):
is_progressive = True
are_masteries_shuffled = False
def get_randomized_level_names_by_level(self, skill: Skill) -> Iterable[Tuple[int, str]]:
return skill.level_names_by_level
def is_mastery_randomized(self, skill: Skill) -> bool:
return False
class SkillProgressionProgressiveWithMasteries(SkillProgressionProgressive):
are_masteries_shuffled = True
def is_mastery_randomized(self, skill: Skill) -> bool:
return skill.has_mastery