Skip to content

Commit

Permalink
add modded game selection + pokemon platinum map randomizer
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrochu committed Jan 5, 2025
1 parent 397f928 commit 0a57a0d
Show file tree
Hide file tree
Showing 5 changed files with 401 additions and 11 deletions.
5 changes: 5 additions & 0 deletions worlds/keymasters_keep/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
class AutoGameRegister(type):
games: Dict[str, Type[Game]] = dict()
metagames: Dict[str, Type[Game]] = dict()
modded_games: Dict[str, Type[Game]] = dict()

def __new__(mcs, name: str, bases: Tuple[type, ...], dict_: Dict[str, Any]) -> AutoGameRegister:
new_class: Type[Game] = super().__new__(mcs, name, bases, dict_)
Expand All @@ -22,6 +23,8 @@ def __new__(mcs, name: str, bases: Tuple[type, ...], dict_: Dict[str, Any]) -> A

if "is_metagame" in dict_ and dict_["is_metagame"]:
mcs.metagames[game_name] = new_class
elif "is_modded_game" in dict_ and dict_["is_modded_game"]:
mcs.modded_games[game_name] = new_class
else:
mcs.games[game_name] = new_class

Expand All @@ -36,6 +39,8 @@ class Game(metaclass=AutoGameRegister):
platforms_other: Optional[List[KeymastersKeepGamePlatforms]] = None

is_metagame: bool = False # Whether the game should be considered a metagame for grouping purposes
is_modded_game: bool = False # Whether the game is a modded version of a base game. For grouping purposes

is_adult_only_or_unrated: bool = True # ESRB AO / PEGI 18 / USK 18 / Unrated? Used for filtering

should_autoregister: bool = True # Development flag. Used to prevent AutoGameRegister from registering the game
Expand Down
13 changes: 11 additions & 2 deletions worlds/keymasters_keep/game_objective_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,19 @@ def _filter_games(

game_name: str
for game_name in allowable_games:
if game_name not in AutoGameRegister.games and game_name not in AutoGameRegister.metagames:
in_games: bool = game_name in AutoGameRegister.games
in_metagames: bool = game_name in AutoGameRegister.metagames
in_modded_games: bool = game_name in AutoGameRegister.modded_games

if not in_games and not in_metagames and not in_modded_games:
continue

game: Type[Game] = AutoGameRegister.games.get(game_name, AutoGameRegister.metagames.get(game_name))
game: Type[Game] = AutoGameRegister.games.get(
game_name, AutoGameRegister.metagames.get(
game_name, AutoGameRegister.modded_games.get(game_name)
)
)

game_instance: Game = game(archipelago_options=self.archipelago_options)

if not include_adult_only_or_unrated_games and game.is_adult_only_or_unrated:
Expand Down
347 changes: 347 additions & 0 deletions worlds/keymasters_keep/games/pokemon_platinum_map_randomizer_game.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,347 @@
from __future__ import annotations

from typing import List

from dataclasses import dataclass

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

from ..enums import KeymastersKeepGamePlatforms


@dataclass
class PokemonPlatinumMapRandomizerArchipelagoOptions:
pass


class PokemonPlatinumMapRandomizerGame(Game):
name = "Pokémon Platinum Map Randomizer"
platform = KeymastersKeepGamePlatforms.NDS

platforms_other = None

is_modded_game = True
is_adult_only_or_unrated = False

options_cls = PokemonPlatinumMapRandomizerArchipelagoOptions

def optional_game_constraint_templates(self) -> List[GameObjectiveTemplate]:
return [
GameObjectiveTemplate(
label="Choose STARTER as your starter",
data={
"STARTER": (self.starters, 1)
},
),
GameObjectiveTemplate(
label="Run only with TYPE type Pokémon in your party (where possible)",
data={
"TYPE": (self.types, 1)
},
),
]

def game_objective_templates(self) -> List[GameObjectiveTemplate]:
return [
GameObjectiveTemplate(
label="Find and beat in order: GYMS",
data={
"GYMS": (self.gyms, 4)
},
is_time_consuming=True,
is_difficult=False,
weight=1,
),
GameObjectiveTemplate(
label="Find and beat in order: ELITE4",
data={
"ELITE4": (self.elite_4, 3)
},
is_time_consuming=True,
is_difficult=False,
weight=1,
),
GameObjectiveTemplate(
label="Find and map: CITIES",
data={
"CITIES": (self.cities, 4)
},
is_time_consuming=True,
is_difficult=False,
weight=1,
),
GameObjectiveTemplate(
label="Find and map: INTERIORS",
data={
"INTERIORS": (self.interiors, 4)
},
is_time_consuming=True,
is_difficult=False,
weight=2,
),
GameObjectiveTemplate(
label="Find and complete: STORY_BEATS",
data={
"STORY_BEATS": (self.story_beats, 3)
},
is_time_consuming=True,
is_difficult=False,
weight=2,
),
GameObjectiveTemplate(
label="Capture a Pokémon at ROUTE",
data={
"ROUTE": (self.routes, 1)
},
is_time_consuming=True,
is_difficult=False,
weight=3,
),
GameObjectiveTemplate(
label="Capture one Pokémon from each of ROUTES and build a team to defeat ELITE4",
data={
"ROUTES": (self.routes, 3),
"ELITE4": (self.elite_4, 1)
},
is_time_consuming=True,
is_difficult=True,
weight=1,
),
GameObjectiveTemplate(
label="Capture one Pokémon from each of ROUTES and build a team to defeat GYM",
data={
"ROUTES": (self.routes, 3),
"GYM": (self.gyms, 1)
},
is_time_consuming=True,
is_difficult=True,
weight=1,
),
GameObjectiveTemplate(
label="Find and unlock HM",
data={
"HM": (self.hms, 1),
},
is_time_consuming=True,
is_difficult=False,
weight=1,
),
]

@staticmethod
def cities() -> List[str]:
return [
"Oreburgh City",
"Floaroma Town",
"Eterna City",
"Hearthome City",
"Solaceon Town",
"Veilstone City",
"Pastoria City",
"Celestic Town",
"Canalave City",
"Snowpoint City",
"SunyShore City",
"Fight Area",
"Survival Area",
"Resort Area",
]

@staticmethod
def interiors() -> List[str]:
return [
"Sandgem PC",
"Jubilife PC",
"Oreburgh PC",
"Floaroma PC",
"Eterna PC",
"Hearthome PC",
"Solaceon PC",
"Veilstone PC",
"Pastoria PC",
"Celestic PC",
"Canalave PC",
"Snowpoint PC",
"SunyShore PC",
"Fight Area PC",
"Survival Area PC",
"Resort Area PC",
"League PC",
"Victory Road PC",
"Sandgem Mart",
"Jubilife Mart",
"Oreburgh Mart",
"Floaroma Mart",
"Eterna Mart",
"Hearthome Mart",
"Solaceon Mart",
"Veilstone Department Store",
"Pastoria Mart",
"Celestic Shop",
"Canalave Mart",
"Snowpoint Mart",
"SunyShore Mart",
"Fight Area Mart",
"Survival Area Mart",
"Resort Area Mart",
"Jubilife TV",
]

@staticmethod
def gyms() -> List[str]:
return [
"Oreburgh",
"Eterna",
"Hearthome",
"Solaceon",
"Veilstone",
"Pastoria",
"Snowpoint",
"Sunyshore",
]

@staticmethod
def elite_4() -> List[str]:
return [
"Aaron",
"Bertha",
"Flint",
"Lucian",
"Cynthia",
]

@staticmethod
def starters() -> List[str]:
return [
"Turtwig",
"Chimchar",
"Piplup",
]

@staticmethod
def routes() -> List[str]:
return [
"Route 201",
"Route 202",
"Route 203",
"Route 204",
"Route 205",
"Route 206",
"Route 207",
"Route 208",
"Route 209",
"Route 210",
"Route 211",
"Route 212",
"Route 213",
"Route 214",
"Route 215",
"Route 216",
"Route 217",
"Route 218",
"Route 219",
"Route 220",
"Route 221",
"Route 222",
"Route 223",
"Route 224",
"Route 225",
"Route 226",
"Route 227",
"Route 228",
"Route 229",
"Route 230",
"Lake Verity (Lakefront)",
"Oreburgh Gate",
"Oreburgh Mine",
"Ravaged Path",
"Valley Windworks",
"Eterna Forest",
"Old Chateau",
"Wayward Cave",
"Mount Coronet",
"Lost Tower",
"Solaceon Ruins",
"Maniac Tunnel",
"Lake Valor (Lakefront)",
"Great Marsh",
"Trophy Garden",
"Fuego Ironworks",
"Iron Island",
"Lake Acuity (Lakefront)",
"Victory Road",
"Stark Mountain",
"Snowpoint Temple",
"Sendoff Spring",
]

@staticmethod
def story_beats() -> List[str]:
return [
"Rival Fight 2 (After Jubilife)",
"Rival Fight 3 (Route 209)",
"Rival Fight 4 (Pastoria City)",
"Rival Fight 5 (Canalave)",
"Rival Fight 6 (Pokemon League)",
"Return Roark (Oreburgh Mine)",
"Defeat the grunts on Floaroma Meadow",
"Liberate Valley Windworks",
"Escort Cheryl (Eterna Forest)",
"Defeat Jupiter (Team Galactic Eterna Building)",
"Escort Mira (Wayward Cave)",
"Defeat Cyrus (Celestic Ruins)",
"Escort Riley (Iron Island)",
"Defeat Saturn (Valor Cavern)",
"Defeat Mars (Lake Verity)",
"Defeat Cyrus (Team Galactic HQ)",
"Defeat Saturn (Team Galactic HQ)",
"Defeat Mars and Jupiter (Spear Pillar)",
"Catch or Defeat Dialga (Spear Pillar)",
"Catch or Defeat Palkia (Spear Pillar)",
"Catch or Defeat Giratina (Spear Pillar)",
"Catch or Defeat Arceus (Spear Pillar)",
"Catch or Defeat Regirock",
"Catch or Defeat Regice",
"Catch or Defeat Registeel",
"Catch or Defeat Regigigas",
"Catch or Defeat Darkrai",
"Escort Marley (Victory Road)",
]

@staticmethod
def hms() -> List[str]:
return [
"HM01, Cut",
"HM02, Fly",
"HM03, Surf",
"HM04, Strength",
"HM05, Flash",
"HM06, Rock Smash",
"HM07, Waterfall",
]

@staticmethod
def types() -> List[str]:
return [
"Normal",
"Fire",
"Water",
"Electric",
"Grass",
"Ice",
"Fighting",
"Poison",
"Ground",
"Flying",
"Psychic",
"Bug",
"Rock",
"Ghost",
"Dragon",
"Dark",
"Steel",
]

# Archipelago Options
# ...
Loading

0 comments on commit 0a57a0d

Please sign in to comment.