WebHost, Core: Developer-defined game option presets. (#2143)

This commit is contained in:
Zach Parks
2023-11-16 04:37:06 -06:00
committed by GitHub
parent 3619abc7ca
commit 79ad54623b
9 changed files with 407 additions and 26 deletions

View File

@@ -186,6 +186,9 @@ class WebWorld:
bug_report_page: Optional[str]
"""display a link to a bug report page, most likely a link to a GitHub issue page."""
options_presets: Dict[str, Dict[str, Any]] = {}
"""A dictionary containing a collection of developer-defined game option presets."""
class World(metaclass=AutoWorldRegister):
"""A World object encompasses a game's Items, Locations, Rules and additional data or functionality required.

View File

@@ -0,0 +1,61 @@
from typing import Any, Dict
from .Options import Architect, GoldGainMultiplier, Vendors
rl_options_presets: Dict[str, Dict[str, Any]] = {
# Example preset using only literal values.
"Unknown Fate": {
"progression_balancing": "random",
"accessibility": "random",
"starting_gender": "random",
"starting_class": "random",
"new_game_plus": "random",
"fairy_chests_per_zone": "random",
"chests_per_zone": "random",
"universal_fairy_chests": "random",
"universal_chests": "random",
"vendors": "random",
"architect": "random",
"architect_fee": "random",
"disable_charon": "random",
"require_purchasing": "random",
"progressive_blueprints": "random",
"gold_gain_multiplier": "random",
"number_of_children": "random",
"free_diary_on_generation": "random",
"khidr": "random",
"alexander": "random",
"leon": "random",
"herodotus": "random",
"health_pool": "random",
"mana_pool": "random",
"attack_pool": "random",
"magic_damage_pool": "random",
"armor_pool": "random",
"equip_pool": "random",
"crit_chance_pool": "random",
"crit_damage_pool": "random",
"allow_default_names": False,
"death_link": "random",
},
# A preset I actually use, using some literal values and some from the option itself.
"Limited Potential": {
"progression_balancing": "disabled",
"fairy_chests_per_zone": 2,
"starting_class": "random",
"chests_per_zone": 30,
"vendors": Vendors.option_normal,
"architect": Architect.option_disabled,
"gold_gain_multiplier": GoldGainMultiplier.option_half,
"number_of_children": 2,
"free_diary_on_generation": False,
"health_pool": 10,
"mana_pool": 10,
"attack_pool": 10,
"magic_damage_pool": 10,
"armor_pool": 5,
"equip_pool": 10,
"crit_chance_pool": 5,
"crit_damage_pool": 5,
}
}

View File

@@ -5,6 +5,7 @@ from worlds.AutoWorld import WebWorld, World
from .Items import RLItem, RLItemData, event_item_table, get_items_by_category, item_table
from .Locations import RLLocation, location_table
from .Options import rl_options
from .Presets import rl_options_presets
from .Regions import create_regions
from .Rules import set_rules
@@ -22,6 +23,7 @@ class RLWeb(WebWorld):
)]
bug_report_page = "https://github.com/ThePhar/RogueLegacyRandomizer/issues/new?assignees=&labels=bug&template=" \
"report-an-issue---.md&title=%5BIssue%5D"
options_presets = rl_options_presets
class RLWorld(World):