mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
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:
46
worlds/stardew_valley/content/feature/skill_progression.py
Normal file
46
worlds/stardew_valley/content/feature/skill_progression.py
Normal file
@@ -0,0 +1,46 @@
|
||||
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
|
||||
Reference in New Issue
Block a user