Skip to content

Commit

Permalink
Tweaked plants_vs_zombies_game.py (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sundia1908 authored Jan 18, 2025
1 parent 6cfd87a commit 108c47c
Showing 1 changed file with 77 additions and 39 deletions.
116 changes: 77 additions & 39 deletions worlds/keymasters_keep/games/plants_vs_zombies_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from dataclasses import dataclass

from Options import Toggle

from ..game import Game
from ..game_objective_template import GameObjectiveTemplate

Expand All @@ -12,7 +14,7 @@

@dataclass
class PlantsVSZombiesArchipelagoOptions:
pass
plants_vs_zombies_include_adventure_mode: PlantsVsZombiesIncludeAdventureMode


class PlantsVSZombiesGame(Game):
Expand Down Expand Up @@ -43,24 +45,17 @@ def optional_game_constraint_templates(self) -> List[GameObjectiveTemplate]:
]

def game_objective_templates(self) -> List[GameObjectiveTemplate]:
return [
templates: List[GameObjectiveTemplate] = list()

templates.extend([
GameObjectiveTemplate(
label="Complete the following Minigame: MINIGAME",
data={
"MINIGAME": (self.minigames, 1),
},
is_time_consuming=False,
is_difficult=False,
weight=5,
),
GameObjectiveTemplate(
label="Complete ADVENTURE in Adventure Mode",
data={
"ADVENTURE": (self.adventure, 1),
},
is_time_consuming=False,
is_difficult=False,
weight=4,
weight=3,
),
GameObjectiveTemplate(
label="Complete the following Vasebreaker level: VASEBREAKER",
Expand All @@ -85,21 +80,65 @@ def game_objective_templates(self) -> List[GameObjectiveTemplate]:
data={
"ACHIEVEMENT": (self.achievements, 1),
},
is_time_consuming=True,
is_time_consuming=False,
is_difficult=False,
weight=1,
),
GameObjectiveTemplate(
label="Reach Wave WAVE in ENDLESS",
label="Complete SURVIVAL",
data={
"WAVE": (self.endless_range, 1),
"ENDLESS": (self.endless, 1),
"SURVIVAL": (self.survival, 1),
},
is_time_consuming=False,
is_difficult=True,
is_difficult=False,
weight=3,
),
GameObjectiveTemplate(
label="In the Zen Garden, ZENGARDEN",
data={
"ZENGARDEN": (self.zen_garden, 1),
},
is_time_consuming=False,
is_difficult=False,
weight=1,
),
]
GameObjectiveTemplate(
label="Reach a Streak of RANGE in ENDLESSPUZZLE",
data={
"RANGE": (self.endless_puzzle_range, 1),
"ENDLESSPUZZLE": (self.endless_puzzle, 1),
},
is_time_consuming=True,
is_difficult=False,
weight=1,
),
GameObjectiveTemplate(
label="Complete FLAGS Flags in Survival: Endless",
data={
"FLAGS": (self.endless_range, 1),
},
is_time_consuming=True,
is_difficult=False,
weight=1,
),
])
if self.include_adventure_mode:
templates.append(
GameObjectiveTemplate(
label="Complete ADVENTURE in Adventure Mode",
data={
"ADVENTURE": (self.adventure, 1),
},
is_time_consuming=False,
is_difficult=False,
weight=3,
),
)
return templates

@property
def include_adventure_mode(self) -> bool:
return bool(self.archipelago_options.plants_vs_zombies_include_adventure_mode.value)

@staticmethod
def minigames() -> List[str]:
Expand Down Expand Up @@ -167,7 +206,6 @@ def survival() -> List[str]:
"Survival: Pool (Hard)",
"Survival: Fog (Hard)",
"Survival: Roof (Hard)",
"Survival: Roof (Hard)",
]

@staticmethod
Expand Down Expand Up @@ -228,39 +266,34 @@ def adventure() -> List[str]:
@staticmethod
def achievements() -> List[str]:
return [
"Ask Me About Mustache Mode",
"Better Off Dead",
"Beyond the Grave",
"China Shop",
"Cryptozombologist",
"Disco is Undead",
"Don't Pea in the Pool",
"Explodonator",
"Good Morning",
"Grounded",
"Home Lawn Security",
"Immortal",
"Morticulturalist",
"No Fungus Among Us",
"Nobel Peas Prize",
"Penny Pincher",
"Popcorn Party",
"Roll Some Heads",
"SPUDOW!",
"Sunny Days",
"Towering Wisdom",
]

@staticmethod
def zen_garden() -> List[str]:
return [
"make a plant go through it's next growth stage by using Fertilizer",
"make a plant happy by using Bug Spray or the Phonograph",
"give the Tree of Wisdom some tree food twice",
]

@staticmethod
def endless_range() -> range:
return range(1, 31)
return range(10, 21)

@staticmethod
def endless() -> List[str]:
def endless_puzzle_range() -> range:
return range(3, 9)

@staticmethod
def endless_puzzle() -> List[str]:
return [
"I, Zombie Endless",
"Vasebreaker Endless",
"Survival Endless",
]

@staticmethod
Expand Down Expand Up @@ -318,4 +351,9 @@ def plants() -> List[str]:
]

# Archipelago Options
# ...
class PlantsVsZombiesIncludeAdventureMode(Toggle):
"""
Indicates whether to include Plants vs. Zombies's Adventure Mode when generating objectives.
"""

display_name = "Plants vs. Zombies Include Adventure Mode"

0 comments on commit 108c47c

Please sign in to comment.