Rogue Legacy: Update to Options API (#3755)
* fix deprecation * multiworld.random -> world.random * Various small fixes --------- Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> Co-authored-by: Exempt-Medic <ExemptMedic@Gmail.com>
This commit is contained in:
parent
05b257adf9
commit
6d6d35d598
|
@ -1,6 +1,6 @@
|
||||||
from typing import Dict
|
from Options import Choice, Range, Toggle, DeathLink, DefaultOnToggle, OptionSet, PerGameCommonOptions
|
||||||
|
|
||||||
from Options import Choice, Range, Option, Toggle, DeathLink, DefaultOnToggle, OptionSet
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
|
||||||
class StartingGender(Choice):
|
class StartingGender(Choice):
|
||||||
|
@ -336,42 +336,44 @@ class AvailableClasses(OptionSet):
|
||||||
The upgraded form of your starting class will be available regardless.
|
The upgraded form of your starting class will be available regardless.
|
||||||
"""
|
"""
|
||||||
display_name = "Available Classes"
|
display_name = "Available Classes"
|
||||||
default = {"Knight", "Mage", "Barbarian", "Knave", "Shinobi", "Miner", "Spellthief", "Lich", "Dragon", "Traitor"}
|
default = frozenset(
|
||||||
|
{"Knight", "Mage", "Barbarian", "Knave", "Shinobi", "Miner", "Spellthief", "Lich", "Dragon", "Traitor"}
|
||||||
|
)
|
||||||
valid_keys = {"Knight", "Mage", "Barbarian", "Knave", "Shinobi", "Miner", "Spellthief", "Lich", "Dragon", "Traitor"}
|
valid_keys = {"Knight", "Mage", "Barbarian", "Knave", "Shinobi", "Miner", "Spellthief", "Lich", "Dragon", "Traitor"}
|
||||||
|
|
||||||
|
|
||||||
rl_options: Dict[str, type(Option)] = {
|
@dataclass
|
||||||
"starting_gender": StartingGender,
|
class RLOptions(PerGameCommonOptions):
|
||||||
"starting_class": StartingClass,
|
starting_gender: StartingGender
|
||||||
"available_classes": AvailableClasses,
|
starting_class: StartingClass
|
||||||
"new_game_plus": NewGamePlus,
|
available_classes: AvailableClasses
|
||||||
"fairy_chests_per_zone": FairyChestsPerZone,
|
new_game_plus: NewGamePlus
|
||||||
"chests_per_zone": ChestsPerZone,
|
fairy_chests_per_zone: FairyChestsPerZone
|
||||||
"universal_fairy_chests": UniversalFairyChests,
|
chests_per_zone: ChestsPerZone
|
||||||
"universal_chests": UniversalChests,
|
universal_fairy_chests: UniversalFairyChests
|
||||||
"vendors": Vendors,
|
universal_chests: UniversalChests
|
||||||
"architect": Architect,
|
vendors: Vendors
|
||||||
"architect_fee": ArchitectFee,
|
architect: Architect
|
||||||
"disable_charon": DisableCharon,
|
architect_fee: ArchitectFee
|
||||||
"require_purchasing": RequirePurchasing,
|
disable_charon: DisableCharon
|
||||||
"progressive_blueprints": ProgressiveBlueprints,
|
require_purchasing: RequirePurchasing
|
||||||
"gold_gain_multiplier": GoldGainMultiplier,
|
progressive_blueprints: ProgressiveBlueprints
|
||||||
"number_of_children": NumberOfChildren,
|
gold_gain_multiplier: GoldGainMultiplier
|
||||||
"free_diary_on_generation": FreeDiaryOnGeneration,
|
number_of_children: NumberOfChildren
|
||||||
"khidr": ChallengeBossKhidr,
|
free_diary_on_generation: FreeDiaryOnGeneration
|
||||||
"alexander": ChallengeBossAlexander,
|
khidr: ChallengeBossKhidr
|
||||||
"leon": ChallengeBossLeon,
|
alexander: ChallengeBossAlexander
|
||||||
"herodotus": ChallengeBossHerodotus,
|
leon: ChallengeBossLeon
|
||||||
"health_pool": HealthUpPool,
|
herodotus: ChallengeBossHerodotus
|
||||||
"mana_pool": ManaUpPool,
|
health_pool: HealthUpPool
|
||||||
"attack_pool": AttackUpPool,
|
mana_pool: ManaUpPool
|
||||||
"magic_damage_pool": MagicDamageUpPool,
|
attack_pool: AttackUpPool
|
||||||
"armor_pool": ArmorUpPool,
|
magic_damage_pool: MagicDamageUpPool
|
||||||
"equip_pool": EquipUpPool,
|
armor_pool: ArmorUpPool
|
||||||
"crit_chance_pool": CritChanceUpPool,
|
equip_pool: EquipUpPool
|
||||||
"crit_damage_pool": CritDamageUpPool,
|
crit_chance_pool: CritChanceUpPool
|
||||||
"allow_default_names": AllowDefaultNames,
|
crit_damage_pool: CritDamageUpPool
|
||||||
"additional_lady_names": AdditionalNames,
|
allow_default_names: AllowDefaultNames
|
||||||
"additional_sir_names": AdditionalNames,
|
additional_lady_names: AdditionalNames
|
||||||
"death_link": DeathLink,
|
additional_sir_names: AdditionalNames
|
||||||
}
|
death_link: DeathLink
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
from typing import Dict, List, NamedTuple, Optional
|
from typing import Dict, List, NamedTuple, Optional, TYPE_CHECKING
|
||||||
|
|
||||||
from BaseClasses import MultiWorld, Region, Entrance
|
from BaseClasses import MultiWorld, Region, Entrance
|
||||||
from .Locations import RLLocation, location_table, get_locations_by_category
|
from .Locations import RLLocation, location_table, get_locations_by_category
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from . import RLWorld
|
||||||
|
|
||||||
|
|
||||||
class RLRegionData(NamedTuple):
|
class RLRegionData(NamedTuple):
|
||||||
locations: Optional[List[str]]
|
locations: Optional[List[str]]
|
||||||
region_exits: Optional[List[str]]
|
region_exits: Optional[List[str]]
|
||||||
|
|
||||||
|
|
||||||
def create_regions(multiworld: MultiWorld, player: int):
|
def create_regions(world: "RLWorld"):
|
||||||
regions: Dict[str, RLRegionData] = {
|
regions: Dict[str, RLRegionData] = {
|
||||||
"Menu": RLRegionData(None, ["Castle Hamson"]),
|
"Menu": RLRegionData(None, ["Castle Hamson"]),
|
||||||
"The Manor": RLRegionData([], []),
|
"The Manor": RLRegionData([], []),
|
||||||
|
@ -56,9 +59,9 @@ def create_regions(multiworld: MultiWorld, player: int):
|
||||||
regions["The Fountain Room"].locations.append("Fountain Room")
|
regions["The Fountain Room"].locations.append("Fountain Room")
|
||||||
|
|
||||||
# Chests
|
# Chests
|
||||||
chests = int(multiworld.chests_per_zone[player])
|
chests = int(world.options.chests_per_zone)
|
||||||
for i in range(0, chests):
|
for i in range(0, chests):
|
||||||
if multiworld.universal_chests[player]:
|
if world.options.universal_chests:
|
||||||
regions["Castle Hamson"].locations.append(f"Chest {i + 1}")
|
regions["Castle Hamson"].locations.append(f"Chest {i + 1}")
|
||||||
regions["Forest Abkhazia"].locations.append(f"Chest {i + 1 + chests}")
|
regions["Forest Abkhazia"].locations.append(f"Chest {i + 1 + chests}")
|
||||||
regions["The Maya"].locations.append(f"Chest {i + 1 + (chests * 2)}")
|
regions["The Maya"].locations.append(f"Chest {i + 1 + (chests * 2)}")
|
||||||
|
@ -70,9 +73,9 @@ def create_regions(multiworld: MultiWorld, player: int):
|
||||||
regions["Land of Darkness"].locations.append(f"Land of Darkness - Chest {i + 1}")
|
regions["Land of Darkness"].locations.append(f"Land of Darkness - Chest {i + 1}")
|
||||||
|
|
||||||
# Fairy Chests
|
# Fairy Chests
|
||||||
chests = int(multiworld.fairy_chests_per_zone[player])
|
chests = int(world.options.fairy_chests_per_zone)
|
||||||
for i in range(0, chests):
|
for i in range(0, chests):
|
||||||
if multiworld.universal_fairy_chests[player]:
|
if world.options.universal_fairy_chests:
|
||||||
regions["Castle Hamson"].locations.append(f"Fairy Chest {i + 1}")
|
regions["Castle Hamson"].locations.append(f"Fairy Chest {i + 1}")
|
||||||
regions["Forest Abkhazia"].locations.append(f"Fairy Chest {i + 1 + chests}")
|
regions["Forest Abkhazia"].locations.append(f"Fairy Chest {i + 1 + chests}")
|
||||||
regions["The Maya"].locations.append(f"Fairy Chest {i + 1 + (chests * 2)}")
|
regions["The Maya"].locations.append(f"Fairy Chest {i + 1 + (chests * 2)}")
|
||||||
|
@ -85,14 +88,14 @@ def create_regions(multiworld: MultiWorld, player: int):
|
||||||
|
|
||||||
# Set up the regions correctly.
|
# Set up the regions correctly.
|
||||||
for name, data in regions.items():
|
for name, data in regions.items():
|
||||||
multiworld.regions.append(create_region(multiworld, player, name, data))
|
world.multiworld.regions.append(create_region(world.multiworld, world.player, name, data))
|
||||||
|
|
||||||
multiworld.get_entrance("Castle Hamson", player).connect(multiworld.get_region("Castle Hamson", player))
|
world.get_entrance("Castle Hamson").connect(world.get_region("Castle Hamson"))
|
||||||
multiworld.get_entrance("The Manor", player).connect(multiworld.get_region("The Manor", player))
|
world.get_entrance("The Manor").connect(world.get_region("The Manor"))
|
||||||
multiworld.get_entrance("Forest Abkhazia", player).connect(multiworld.get_region("Forest Abkhazia", player))
|
world.get_entrance("Forest Abkhazia").connect(world.get_region("Forest Abkhazia"))
|
||||||
multiworld.get_entrance("The Maya", player).connect(multiworld.get_region("The Maya", player))
|
world.get_entrance("The Maya").connect(world.get_region("The Maya"))
|
||||||
multiworld.get_entrance("Land of Darkness", player).connect(multiworld.get_region("Land of Darkness", player))
|
world.get_entrance("Land of Darkness").connect(world.get_region("Land of Darkness"))
|
||||||
multiworld.get_entrance("The Fountain Room", player).connect(multiworld.get_region("The Fountain Room", player))
|
world.get_entrance("The Fountain Room").connect(world.get_region("The Fountain Room"))
|
||||||
|
|
||||||
|
|
||||||
def create_region(multiworld: MultiWorld, player: int, name: str, data: RLRegionData):
|
def create_region(multiworld: MultiWorld, player: int, name: str, data: RLRegionData):
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
from BaseClasses import CollectionState, MultiWorld
|
from BaseClasses import CollectionState
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from . import RLWorld
|
||||||
|
|
||||||
|
|
||||||
def get_upgrade_total(multiworld: MultiWorld, player: int) -> int:
|
def get_upgrade_total(world: "RLWorld") -> int:
|
||||||
return int(multiworld.health_pool[player]) + int(multiworld.mana_pool[player]) + \
|
return int(world.options.health_pool) + int(world.options.mana_pool) + \
|
||||||
int(multiworld.attack_pool[player]) + int(multiworld.magic_damage_pool[player])
|
int(world.options.attack_pool) + int(world.options.magic_damage_pool)
|
||||||
|
|
||||||
|
|
||||||
def get_upgrade_count(state: CollectionState, player: int) -> int:
|
def get_upgrade_count(state: CollectionState, player: int) -> int:
|
||||||
|
@ -19,8 +23,8 @@ def has_upgrade_amount(state: CollectionState, player: int, amount: int) -> bool
|
||||||
return get_upgrade_count(state, player) >= amount
|
return get_upgrade_count(state, player) >= amount
|
||||||
|
|
||||||
|
|
||||||
def has_upgrades_percentage(state: CollectionState, player: int, percentage: float) -> bool:
|
def has_upgrades_percentage(state: CollectionState, world: "RLWorld", percentage: float) -> bool:
|
||||||
return has_upgrade_amount(state, player, round(get_upgrade_total(state.multiworld, player) * (percentage / 100)))
|
return has_upgrade_amount(state, world.player, round(get_upgrade_total(world) * (percentage / 100)))
|
||||||
|
|
||||||
|
|
||||||
def has_movement_rune(state: CollectionState, player: int) -> bool:
|
def has_movement_rune(state: CollectionState, player: int) -> bool:
|
||||||
|
@ -47,15 +51,15 @@ def has_defeated_dungeon(state: CollectionState, player: int) -> bool:
|
||||||
return state.has("Defeat Herodotus", player) or state.has("Defeat Astrodotus", player)
|
return state.has("Defeat Herodotus", player) or state.has("Defeat Astrodotus", player)
|
||||||
|
|
||||||
|
|
||||||
def set_rules(multiworld: MultiWorld, player: int):
|
def set_rules(world: "RLWorld", player: int):
|
||||||
# If 'vendors' are 'normal', then expect it to show up in the first half(ish) of the spheres.
|
# If 'vendors' are 'normal', then expect it to show up in the first half(ish) of the spheres.
|
||||||
if multiworld.vendors[player] == "normal":
|
if world.options.vendors == "normal":
|
||||||
multiworld.get_location("Forest Abkhazia Boss Reward", player).access_rule = \
|
world.get_location("Forest Abkhazia Boss Reward").access_rule = \
|
||||||
lambda state: has_vendors(state, player)
|
lambda state: has_vendors(state, player)
|
||||||
|
|
||||||
# Gate each manor location so everything isn't dumped into sphere 1.
|
# Gate each manor location so everything isn't dumped into sphere 1.
|
||||||
manor_rules = {
|
manor_rules = {
|
||||||
"Defeat Khidr" if multiworld.khidr[player] == "vanilla" else "Defeat Neo Khidr": [
|
"Defeat Khidr" if world.options.khidr == "vanilla" else "Defeat Neo Khidr": [
|
||||||
"Manor - Left Wing Window",
|
"Manor - Left Wing Window",
|
||||||
"Manor - Left Wing Rooftop",
|
"Manor - Left Wing Rooftop",
|
||||||
"Manor - Right Wing Window",
|
"Manor - Right Wing Window",
|
||||||
|
@ -66,7 +70,7 @@ def set_rules(multiworld: MultiWorld, player: int):
|
||||||
"Manor - Left Tree 2",
|
"Manor - Left Tree 2",
|
||||||
"Manor - Right Tree",
|
"Manor - Right Tree",
|
||||||
],
|
],
|
||||||
"Defeat Alexander" if multiworld.alexander[player] == "vanilla" else "Defeat Alexander IV": [
|
"Defeat Alexander" if world.options.alexander == "vanilla" else "Defeat Alexander IV": [
|
||||||
"Manor - Left Big Upper 1",
|
"Manor - Left Big Upper 1",
|
||||||
"Manor - Left Big Upper 2",
|
"Manor - Left Big Upper 2",
|
||||||
"Manor - Left Big Windows",
|
"Manor - Left Big Windows",
|
||||||
|
@ -78,7 +82,7 @@ def set_rules(multiworld: MultiWorld, player: int):
|
||||||
"Manor - Right Big Rooftop",
|
"Manor - Right Big Rooftop",
|
||||||
"Manor - Right Extension",
|
"Manor - Right Extension",
|
||||||
],
|
],
|
||||||
"Defeat Ponce de Leon" if multiworld.leon[player] == "vanilla" else "Defeat Ponce de Freon": [
|
"Defeat Ponce de Leon" if world.options.leon == "vanilla" else "Defeat Ponce de Freon": [
|
||||||
"Manor - Right High Base",
|
"Manor - Right High Base",
|
||||||
"Manor - Right High Upper",
|
"Manor - Right High Upper",
|
||||||
"Manor - Right High Tower",
|
"Manor - Right High Tower",
|
||||||
|
@ -90,24 +94,24 @@ def set_rules(multiworld: MultiWorld, player: int):
|
||||||
# Set rules for manor locations.
|
# Set rules for manor locations.
|
||||||
for event, locations in manor_rules.items():
|
for event, locations in manor_rules.items():
|
||||||
for location in locations:
|
for location in locations:
|
||||||
multiworld.get_location(location, player).access_rule = lambda state: state.has(event, player)
|
world.get_location(location).access_rule = lambda state: state.has(event, player)
|
||||||
|
|
||||||
# Set rules for fairy chests to decrease headache of expectation to find non-movement fairy chests.
|
# Set rules for fairy chests to decrease headache of expectation to find non-movement fairy chests.
|
||||||
for fairy_location in [location for location in multiworld.get_locations(player) if "Fairy" in location.name]:
|
for fairy_location in [location for location in world.multiworld.get_locations(player) if "Fairy" in location.name]:
|
||||||
fairy_location.access_rule = lambda state: has_fairy_progression(state, player)
|
fairy_location.access_rule = lambda state: has_fairy_progression(state, player)
|
||||||
|
|
||||||
# Region rules.
|
# Region rules.
|
||||||
multiworld.get_entrance("Forest Abkhazia", player).access_rule = \
|
world.get_entrance("Forest Abkhazia").access_rule = \
|
||||||
lambda state: has_upgrades_percentage(state, player, 12.5) and has_defeated_castle(state, player)
|
lambda state: has_upgrades_percentage(state, world, 12.5) and has_defeated_castle(state, player)
|
||||||
|
|
||||||
multiworld.get_entrance("The Maya", player).access_rule = \
|
world.get_entrance("The Maya").access_rule = \
|
||||||
lambda state: has_upgrades_percentage(state, player, 25) and has_defeated_forest(state, player)
|
lambda state: has_upgrades_percentage(state, world, 25) and has_defeated_forest(state, player)
|
||||||
|
|
||||||
multiworld.get_entrance("Land of Darkness", player).access_rule = \
|
world.get_entrance("Land of Darkness").access_rule = \
|
||||||
lambda state: has_upgrades_percentage(state, player, 37.5) and has_defeated_tower(state, player)
|
lambda state: has_upgrades_percentage(state, world, 37.5) and has_defeated_tower(state, player)
|
||||||
|
|
||||||
multiworld.get_entrance("The Fountain Room", player).access_rule = \
|
world.get_entrance("The Fountain Room").access_rule = \
|
||||||
lambda state: has_upgrades_percentage(state, player, 50) and has_defeated_dungeon(state, player)
|
lambda state: has_upgrades_percentage(state, world, 50) and has_defeated_dungeon(state, player)
|
||||||
|
|
||||||
# Win condition.
|
# Win condition.
|
||||||
multiworld.completion_condition[player] = lambda state: state.has("Defeat The Fountain", player)
|
world.multiworld.completion_condition[player] = lambda state: state.has("Defeat The Fountain", player)
|
||||||
|
|
|
@ -4,7 +4,7 @@ from BaseClasses import Tutorial
|
||||||
from worlds.AutoWorld import WebWorld, World
|
from worlds.AutoWorld import WebWorld, World
|
||||||
from .Items import RLItem, RLItemData, event_item_table, get_items_by_category, item_table
|
from .Items import RLItem, RLItemData, event_item_table, get_items_by_category, item_table
|
||||||
from .Locations import RLLocation, location_table
|
from .Locations import RLLocation, location_table
|
||||||
from .Options import rl_options
|
from .Options import RLOptions
|
||||||
from .Presets import rl_options_presets
|
from .Presets import rl_options_presets
|
||||||
from .Regions import create_regions
|
from .Regions import create_regions
|
||||||
from .Rules import set_rules
|
from .Rules import set_rules
|
||||||
|
@ -33,20 +33,17 @@ class RLWorld(World):
|
||||||
But that's OK, because no one is perfect, and you don't have to be to succeed.
|
But that's OK, because no one is perfect, and you don't have to be to succeed.
|
||||||
"""
|
"""
|
||||||
game = "Rogue Legacy"
|
game = "Rogue Legacy"
|
||||||
option_definitions = rl_options
|
options_dataclass = RLOptions
|
||||||
|
options: RLOptions
|
||||||
topology_present = True
|
topology_present = True
|
||||||
required_client_version = (0, 3, 5)
|
required_client_version = (0, 3, 5)
|
||||||
web = RLWeb()
|
web = RLWeb()
|
||||||
|
|
||||||
item_name_to_id = {name: data.code for name, data in item_table.items()}
|
item_name_to_id = {name: data.code for name, data in item_table.items() if data.code is not None}
|
||||||
location_name_to_id = {name: data.code for name, data in location_table.items()}
|
location_name_to_id = {name: data.code for name, data in location_table.items() if data.code is not None}
|
||||||
|
|
||||||
# TODO: Replace calls to this function with "options-dict", once that PR is completed and merged.
|
|
||||||
def get_setting(self, name: str):
|
|
||||||
return getattr(self.multiworld, name)[self.player]
|
|
||||||
|
|
||||||
def fill_slot_data(self) -> dict:
|
def fill_slot_data(self) -> dict:
|
||||||
return {option_name: self.get_setting(option_name).value for option_name in rl_options}
|
return self.options.as_dict(*[name for name in self.options_dataclass.type_hints.keys()])
|
||||||
|
|
||||||
def generate_early(self):
|
def generate_early(self):
|
||||||
location_ids_used_per_game = {
|
location_ids_used_per_game = {
|
||||||
|
@ -74,18 +71,18 @@ class RLWorld(World):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Check validation of names.
|
# Check validation of names.
|
||||||
additional_lady_names = len(self.get_setting("additional_lady_names").value)
|
additional_lady_names = len(self.options.additional_lady_names.value)
|
||||||
additional_sir_names = len(self.get_setting("additional_sir_names").value)
|
additional_sir_names = len(self.options.additional_sir_names.value)
|
||||||
if not self.get_setting("allow_default_names"):
|
if not self.options.allow_default_names:
|
||||||
if additional_lady_names < int(self.get_setting("number_of_children")):
|
if additional_lady_names < int(self.options.number_of_children):
|
||||||
raise Exception(
|
raise Exception(
|
||||||
f"allow_default_names is off, but not enough names are defined in additional_lady_names. "
|
f"allow_default_names is off, but not enough names are defined in additional_lady_names. "
|
||||||
f"Expected {int(self.get_setting('number_of_children'))}, Got {additional_lady_names}")
|
f"Expected {int(self.options.number_of_children)}, Got {additional_lady_names}")
|
||||||
|
|
||||||
if additional_sir_names < int(self.get_setting("number_of_children")):
|
if additional_sir_names < int(self.options.number_of_children):
|
||||||
raise Exception(
|
raise Exception(
|
||||||
f"allow_default_names is off, but not enough names are defined in additional_sir_names. "
|
f"allow_default_names is off, but not enough names are defined in additional_sir_names. "
|
||||||
f"Expected {int(self.get_setting('number_of_children'))}, Got {additional_sir_names}")
|
f"Expected {int(self.options.number_of_children)}, Got {additional_sir_names}")
|
||||||
|
|
||||||
def create_items(self):
|
def create_items(self):
|
||||||
item_pool: List[RLItem] = []
|
item_pool: List[RLItem] = []
|
||||||
|
@ -95,110 +92,110 @@ class RLWorld(World):
|
||||||
|
|
||||||
# Architect
|
# Architect
|
||||||
if name == "Architect":
|
if name == "Architect":
|
||||||
if self.get_setting("architect") == "disabled":
|
if self.options.architect == "disabled":
|
||||||
continue
|
continue
|
||||||
if self.get_setting("architect") == "start_unlocked":
|
if self.options.architect == "start_unlocked":
|
||||||
self.multiworld.push_precollected(self.create_item(name))
|
self.multiworld.push_precollected(self.create_item(name))
|
||||||
continue
|
continue
|
||||||
if self.get_setting("architect") == "early":
|
if self.options.architect == "early":
|
||||||
self.multiworld.local_early_items[self.player]["Architect"] = 1
|
self.multiworld.local_early_items[self.player]["Architect"] = 1
|
||||||
|
|
||||||
# Blacksmith and Enchantress
|
# Blacksmith and Enchantress
|
||||||
if name == "Blacksmith" or name == "Enchantress":
|
if name == "Blacksmith" or name == "Enchantress":
|
||||||
if self.get_setting("vendors") == "start_unlocked":
|
if self.options.vendors == "start_unlocked":
|
||||||
self.multiworld.push_precollected(self.create_item(name))
|
self.multiworld.push_precollected(self.create_item(name))
|
||||||
continue
|
continue
|
||||||
if self.get_setting("vendors") == "early":
|
if self.options.vendors == "early":
|
||||||
self.multiworld.local_early_items[self.player]["Blacksmith"] = 1
|
self.multiworld.local_early_items[self.player]["Blacksmith"] = 1
|
||||||
self.multiworld.local_early_items[self.player]["Enchantress"] = 1
|
self.multiworld.local_early_items[self.player]["Enchantress"] = 1
|
||||||
|
|
||||||
# Haggling
|
# Haggling
|
||||||
if name == "Haggling" and self.get_setting("disable_charon"):
|
if name == "Haggling" and self.options.disable_charon:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Blueprints
|
# Blueprints
|
||||||
if data.category == "Blueprints":
|
if data.category == "Blueprints":
|
||||||
# No progressive blueprints if progressive_blueprints are disabled.
|
# No progressive blueprints if progressive_blueprints are disabled.
|
||||||
if name == "Progressive Blueprints" and not self.get_setting("progressive_blueprints"):
|
if name == "Progressive Blueprints" and not self.options.progressive_blueprints:
|
||||||
continue
|
continue
|
||||||
# No distinct blueprints if progressive_blueprints are enabled.
|
# No distinct blueprints if progressive_blueprints are enabled.
|
||||||
elif name != "Progressive Blueprints" and self.get_setting("progressive_blueprints"):
|
elif name != "Progressive Blueprints" and self.options.progressive_blueprints:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Classes
|
# Classes
|
||||||
if data.category == "Classes":
|
if data.category == "Classes":
|
||||||
if name == "Progressive Knights":
|
if name == "Progressive Knights":
|
||||||
if "Knight" not in self.get_setting("available_classes"):
|
if "Knight" not in self.options.available_classes:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self.get_setting("starting_class") == "knight":
|
if self.options.starting_class == "knight":
|
||||||
quantity = 1
|
quantity = 1
|
||||||
if name == "Progressive Mages":
|
if name == "Progressive Mages":
|
||||||
if "Mage" not in self.get_setting("available_classes"):
|
if "Mage" not in self.options.available_classes:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self.get_setting("starting_class") == "mage":
|
if self.options.starting_class == "mage":
|
||||||
quantity = 1
|
quantity = 1
|
||||||
if name == "Progressive Barbarians":
|
if name == "Progressive Barbarians":
|
||||||
if "Barbarian" not in self.get_setting("available_classes"):
|
if "Barbarian" not in self.options.available_classes:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self.get_setting("starting_class") == "barbarian":
|
if self.options.starting_class == "barbarian":
|
||||||
quantity = 1
|
quantity = 1
|
||||||
if name == "Progressive Knaves":
|
if name == "Progressive Knaves":
|
||||||
if "Knave" not in self.get_setting("available_classes"):
|
if "Knave" not in self.options.available_classes:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self.get_setting("starting_class") == "knave":
|
if self.options.starting_class == "knave":
|
||||||
quantity = 1
|
quantity = 1
|
||||||
if name == "Progressive Miners":
|
if name == "Progressive Miners":
|
||||||
if "Miner" not in self.get_setting("available_classes"):
|
if "Miner" not in self.options.available_classes:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self.get_setting("starting_class") == "miner":
|
if self.options.starting_class == "miner":
|
||||||
quantity = 1
|
quantity = 1
|
||||||
if name == "Progressive Shinobis":
|
if name == "Progressive Shinobis":
|
||||||
if "Shinobi" not in self.get_setting("available_classes"):
|
if "Shinobi" not in self.options.available_classes:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self.get_setting("starting_class") == "shinobi":
|
if self.options.starting_class == "shinobi":
|
||||||
quantity = 1
|
quantity = 1
|
||||||
if name == "Progressive Liches":
|
if name == "Progressive Liches":
|
||||||
if "Lich" not in self.get_setting("available_classes"):
|
if "Lich" not in self.options.available_classes:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self.get_setting("starting_class") == "lich":
|
if self.options.starting_class == "lich":
|
||||||
quantity = 1
|
quantity = 1
|
||||||
if name == "Progressive Spellthieves":
|
if name == "Progressive Spellthieves":
|
||||||
if "Spellthief" not in self.get_setting("available_classes"):
|
if "Spellthief" not in self.options.available_classes:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self.get_setting("starting_class") == "spellthief":
|
if self.options.starting_class == "spellthief":
|
||||||
quantity = 1
|
quantity = 1
|
||||||
if name == "Dragons":
|
if name == "Dragons":
|
||||||
if "Dragon" not in self.get_setting("available_classes"):
|
if "Dragon" not in self.options.available_classes:
|
||||||
continue
|
continue
|
||||||
if name == "Traitors":
|
if name == "Traitors":
|
||||||
if "Traitor" not in self.get_setting("available_classes"):
|
if "Traitor" not in self.options.available_classes:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Skills
|
# Skills
|
||||||
if name == "Health Up":
|
if name == "Health Up":
|
||||||
quantity = self.get_setting("health_pool")
|
quantity = self.options.health_pool.value
|
||||||
elif name == "Mana Up":
|
elif name == "Mana Up":
|
||||||
quantity = self.get_setting("mana_pool")
|
quantity = self.options.mana_pool.value
|
||||||
elif name == "Attack Up":
|
elif name == "Attack Up":
|
||||||
quantity = self.get_setting("attack_pool")
|
quantity = self.options.attack_pool.value
|
||||||
elif name == "Magic Damage Up":
|
elif name == "Magic Damage Up":
|
||||||
quantity = self.get_setting("magic_damage_pool")
|
quantity = self.options.magic_damage_pool.value
|
||||||
elif name == "Armor Up":
|
elif name == "Armor Up":
|
||||||
quantity = self.get_setting("armor_pool")
|
quantity = self.options.armor_pool.value
|
||||||
elif name == "Equip Up":
|
elif name == "Equip Up":
|
||||||
quantity = self.get_setting("equip_pool")
|
quantity = self.options.equip_pool.value
|
||||||
elif name == "Crit Chance Up":
|
elif name == "Crit Chance Up":
|
||||||
quantity = self.get_setting("crit_chance_pool")
|
quantity = self.options.crit_chance_pool.value
|
||||||
elif name == "Crit Damage Up":
|
elif name == "Crit Damage Up":
|
||||||
quantity = self.get_setting("crit_damage_pool")
|
quantity = self.options.crit_damage_pool.value
|
||||||
|
|
||||||
# Ignore filler, it will be added in a later stage.
|
# Ignore filler, it will be added in a later stage.
|
||||||
if data.category == "Filler":
|
if data.category == "Filler":
|
||||||
|
@ -215,7 +212,7 @@ class RLWorld(World):
|
||||||
def get_filler_item_name(self) -> str:
|
def get_filler_item_name(self) -> str:
|
||||||
fillers = get_items_by_category("Filler")
|
fillers = get_items_by_category("Filler")
|
||||||
weights = [data.weight for data in fillers.values()]
|
weights = [data.weight for data in fillers.values()]
|
||||||
return self.multiworld.random.choices([filler for filler in fillers.keys()], weights, k=1)[0]
|
return self.random.choices([filler for filler in fillers.keys()], weights, k=1)[0]
|
||||||
|
|
||||||
def create_item(self, name: str) -> RLItem:
|
def create_item(self, name: str) -> RLItem:
|
||||||
data = item_table[name]
|
data = item_table[name]
|
||||||
|
@ -226,10 +223,10 @@ class RLWorld(World):
|
||||||
return RLItem(name, data.classification, data.code, self.player)
|
return RLItem(name, data.classification, data.code, self.player)
|
||||||
|
|
||||||
def set_rules(self):
|
def set_rules(self):
|
||||||
set_rules(self.multiworld, self.player)
|
set_rules(self, self.player)
|
||||||
|
|
||||||
def create_regions(self):
|
def create_regions(self):
|
||||||
create_regions(self.multiworld, self.player)
|
create_regions(self)
|
||||||
self._place_events()
|
self._place_events()
|
||||||
|
|
||||||
def _place_events(self):
|
def _place_events(self):
|
||||||
|
@ -238,7 +235,7 @@ class RLWorld(World):
|
||||||
self.create_event("Defeat The Fountain"))
|
self.create_event("Defeat The Fountain"))
|
||||||
|
|
||||||
# Khidr / Neo Khidr
|
# Khidr / Neo Khidr
|
||||||
if self.get_setting("khidr") == "vanilla":
|
if self.options.khidr == "vanilla":
|
||||||
self.multiworld.get_location("Castle Hamson Boss Room", self.player).place_locked_item(
|
self.multiworld.get_location("Castle Hamson Boss Room", self.player).place_locked_item(
|
||||||
self.create_event("Defeat Khidr"))
|
self.create_event("Defeat Khidr"))
|
||||||
else:
|
else:
|
||||||
|
@ -246,7 +243,7 @@ class RLWorld(World):
|
||||||
self.create_event("Defeat Neo Khidr"))
|
self.create_event("Defeat Neo Khidr"))
|
||||||
|
|
||||||
# Alexander / Alexander IV
|
# Alexander / Alexander IV
|
||||||
if self.get_setting("alexander") == "vanilla":
|
if self.options.alexander == "vanilla":
|
||||||
self.multiworld.get_location("Forest Abkhazia Boss Room", self.player).place_locked_item(
|
self.multiworld.get_location("Forest Abkhazia Boss Room", self.player).place_locked_item(
|
||||||
self.create_event("Defeat Alexander"))
|
self.create_event("Defeat Alexander"))
|
||||||
else:
|
else:
|
||||||
|
@ -254,7 +251,7 @@ class RLWorld(World):
|
||||||
self.create_event("Defeat Alexander IV"))
|
self.create_event("Defeat Alexander IV"))
|
||||||
|
|
||||||
# Ponce de Leon / Ponce de Freon
|
# Ponce de Leon / Ponce de Freon
|
||||||
if self.get_setting("leon") == "vanilla":
|
if self.options.leon == "vanilla":
|
||||||
self.multiworld.get_location("The Maya Boss Room", self.player).place_locked_item(
|
self.multiworld.get_location("The Maya Boss Room", self.player).place_locked_item(
|
||||||
self.create_event("Defeat Ponce de Leon"))
|
self.create_event("Defeat Ponce de Leon"))
|
||||||
else:
|
else:
|
||||||
|
@ -262,7 +259,7 @@ class RLWorld(World):
|
||||||
self.create_event("Defeat Ponce de Freon"))
|
self.create_event("Defeat Ponce de Freon"))
|
||||||
|
|
||||||
# Herodotus / Astrodotus
|
# Herodotus / Astrodotus
|
||||||
if self.get_setting("herodotus") == "vanilla":
|
if self.options.herodotus == "vanilla":
|
||||||
self.multiworld.get_location("Land of Darkness Boss Room", self.player).place_locked_item(
|
self.multiworld.get_location("Land of Darkness Boss Room", self.player).place_locked_item(
|
||||||
self.create_event("Defeat Herodotus"))
|
self.create_event("Defeat Herodotus"))
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from test.TestBase import WorldTestBase
|
from test.bases import WorldTestBase
|
||||||
|
|
||||||
|
|
||||||
class RLTestBase(WorldTestBase):
|
class RLTestBase(WorldTestBase):
|
||||||
|
|
Loading…
Reference in New Issue