Bumper Stickers and Meritous: Options and world: multiworld fixes (#3281)
* Update Options.py * Update __init__.py * Correct case * Correct case * Update Meritous and actually use Options * Oops * Fixing world: multiworld
This commit is contained in:
parent
701fbab837
commit
f38655d6b6
|
@ -3,8 +3,10 @@
|
||||||
# This software is released under the MIT License.
|
# This software is released under the MIT License.
|
||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
import typing
|
import typing
|
||||||
from Options import Option, Range
|
from Options import Option, Range, PerGameCommonOptions
|
||||||
|
|
||||||
|
|
||||||
class TaskAdvances(Range):
|
class TaskAdvances(Range):
|
||||||
|
@ -69,12 +71,12 @@ class KillerTrapWeight(Range):
|
||||||
default = 0
|
default = 0
|
||||||
|
|
||||||
|
|
||||||
bumpstik_options: typing.Dict[str, type(Option)] = {
|
@dataclass
|
||||||
"task_advances": TaskAdvances,
|
class BumpstikOptions(PerGameCommonOptions):
|
||||||
"turners": Turners,
|
task_advances: TaskAdvances
|
||||||
"paint_cans": PaintCans,
|
turners: Turners
|
||||||
"trap_count": Traps,
|
paint_cans: PaintCans
|
||||||
"rainbow_trap_weight": RainbowTrapWeight,
|
trap_count: Traps
|
||||||
"spinner_trap_weight": SpinnerTrapWeight,
|
rainbow_trap_weight: RainbowTrapWeight
|
||||||
"killer_trap_weight": KillerTrapWeight
|
spinner_trap_weight: SpinnerTrapWeight
|
||||||
}
|
killer_trap_weight: KillerTrapWeight
|
||||||
|
|
|
@ -11,7 +11,7 @@ def _generate_entrances(player: int, entrance_list: [str], parent: Region):
|
||||||
return [Entrance(player, entrance, parent) for entrance in entrance_list]
|
return [Entrance(player, entrance, parent) for entrance in entrance_list]
|
||||||
|
|
||||||
|
|
||||||
def create_regions(world: MultiWorld, player: int):
|
def create_regions(multiworld: MultiWorld, player: int):
|
||||||
region_map = {
|
region_map = {
|
||||||
"Menu": level1_locs + ["Bonus Booster 1"] + [f"Treasure Bumper {i + 1}" for i in range(8)],
|
"Menu": level1_locs + ["Bonus Booster 1"] + [f"Treasure Bumper {i + 1}" for i in range(8)],
|
||||||
"Level 1": level2_locs + ["Bonus Booster 2"] + [f"Treasure Bumper {i + 9}" for i in range(8)],
|
"Level 1": level2_locs + ["Bonus Booster 2"] + [f"Treasure Bumper {i + 9}" for i in range(8)],
|
||||||
|
@ -34,7 +34,7 @@ def create_regions(world: MultiWorld, player: int):
|
||||||
|
|
||||||
for x, region_name in enumerate(region_map):
|
for x, region_name in enumerate(region_map):
|
||||||
region_list = region_map[region_name]
|
region_list = region_map[region_name]
|
||||||
region = Region(region_name, player, world)
|
region = Region(region_name, player, multiworld)
|
||||||
for location_name in region_list:
|
for location_name in region_list:
|
||||||
region.locations += [BumpStikLocation(
|
region.locations += [BumpStikLocation(
|
||||||
player, location_name, location_table[location_name], region)]
|
player, location_name, location_table[location_name], region)]
|
||||||
|
@ -42,9 +42,9 @@ def create_regions(world: MultiWorld, player: int):
|
||||||
region.exits += _generate_entrances(player,
|
region.exits += _generate_entrances(player,
|
||||||
[f"To Level {x + 1}"], region)
|
[f"To Level {x + 1}"], region)
|
||||||
|
|
||||||
world.regions += [region]
|
multiworld.regions += [region]
|
||||||
|
|
||||||
for entrance in entrance_map:
|
for entrance in entrance_map:
|
||||||
connection = world.get_entrance(f"To {entrance}", player)
|
connection = multiworld.get_entrance(f"To {entrance}", player)
|
||||||
connection.access_rule = entrance_map[entrance]
|
connection.access_rule = entrance_map[entrance]
|
||||||
connection.connect(world.get_region(entrance, player))
|
connection.connect(multiworld.get_region(entrance, player))
|
||||||
|
|
|
@ -43,10 +43,11 @@ class BumpStikWorld(World):
|
||||||
|
|
||||||
required_client_version = (0, 3, 8)
|
required_client_version = (0, 3, 8)
|
||||||
|
|
||||||
option_definitions = bumpstik_options
|
options: BumpstikOptions
|
||||||
|
options_dataclass = BumpstikOptions
|
||||||
|
|
||||||
def __init__(self, world: MultiWorld, player: int):
|
def __init__(self, multiworld: MultiWorld, player: int):
|
||||||
super(BumpStikWorld, self).__init__(world, player)
|
super(BumpStikWorld, self).__init__(multiworld, player)
|
||||||
self.task_advances = TaskAdvances.default
|
self.task_advances = TaskAdvances.default
|
||||||
self.turners = Turners.default
|
self.turners = Turners.default
|
||||||
self.paint_cans = PaintCans.default
|
self.paint_cans = PaintCans.default
|
||||||
|
@ -86,13 +87,13 @@ class BumpStikWorld(World):
|
||||||
return "Nothing"
|
return "Nothing"
|
||||||
|
|
||||||
def generate_early(self):
|
def generate_early(self):
|
||||||
self.task_advances = self.multiworld.task_advances[self.player].value
|
self.task_advances = self.options.task_advances.value
|
||||||
self.turners = self.multiworld.turners[self.player].value
|
self.turners = self.options.turners.value
|
||||||
self.paint_cans = self.multiworld.paint_cans[self.player].value
|
self.paint_cans = self.options.paint_cans.value
|
||||||
self.traps = self.multiworld.trap_count[self.player].value
|
self.traps = self.options.trap_count.value
|
||||||
self.rainbow_trap_weight = self.multiworld.rainbow_trap_weight[self.player].value
|
self.rainbow_trap_weight = self.options.rainbow_trap_weight.value
|
||||||
self.spinner_trap_weight = self.multiworld.spinner_trap_weight[self.player].value
|
self.spinner_trap_weight = self.options.spinner_trap_weight.value
|
||||||
self.killer_trap_weight = self.multiworld.killer_trap_weight[self.player].value
|
self.killer_trap_weight = self.options.killer_trap_weight.value
|
||||||
|
|
||||||
def create_regions(self):
|
def create_regions(self):
|
||||||
create_regions(self.multiworld, self.player)
|
create_regions(self.multiworld, self.player)
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
# This software is released under the MIT License.
|
# This software is released under the MIT License.
|
||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
import typing
|
import typing
|
||||||
from Options import Option, DeathLink, Toggle, DefaultOnToggle, Choice
|
from Options import Option, DeathLink, Toggle, DefaultOnToggle, Choice, PerGameCommonOptions
|
||||||
|
|
||||||
|
|
||||||
cost_scales = {
|
cost_scales = {
|
||||||
|
@ -51,10 +53,10 @@ class ItemCacheCost(Choice):
|
||||||
default = 0
|
default = 0
|
||||||
|
|
||||||
|
|
||||||
meritous_options: typing.Dict[str, type(Option)] = {
|
@dataclass
|
||||||
"goal": Goal,
|
class MeritousOptions(PerGameCommonOptions):
|
||||||
"include_psi_keys": IncludePSIKeys,
|
goal: Goal
|
||||||
"include_evolution_traps": IncludeEvolutionTraps,
|
include_psi_keys: IncludePSIKeys
|
||||||
"item_cache_cost": ItemCacheCost,
|
include_evolution_traps: IncludeEvolutionTraps
|
||||||
"death_link": DeathLink
|
item_cache_cost: ItemCacheCost
|
||||||
}
|
death_link: DeathLink
|
||||||
|
|
|
@ -13,7 +13,7 @@ def _generate_entrances(player: int, entrance_list: [str], parent: Region):
|
||||||
return [Entrance(player, entrance, parent) for entrance in entrance_list]
|
return [Entrance(player, entrance, parent) for entrance in entrance_list]
|
||||||
|
|
||||||
|
|
||||||
def create_regions(world: MultiWorld, player: int):
|
def create_regions(multiworld: MultiWorld, player: int):
|
||||||
regions = ["First", "Second", "Third", "Last"]
|
regions = ["First", "Second", "Third", "Last"]
|
||||||
bosses = ["Meridian", "Ataraxia", "Merodach"]
|
bosses = ["Meridian", "Ataraxia", "Merodach"]
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ def create_regions(world: MultiWorld, player: int):
|
||||||
if x == 0:
|
if x == 0:
|
||||||
insidename = "Menu"
|
insidename = "Menu"
|
||||||
|
|
||||||
region = Region(insidename, player, world)
|
region = Region(insidename, player, multiworld)
|
||||||
for store in ["Alpha Cache", "Beta Cache", "Gamma Cache", "Reward Chest"]:
|
for store in ["Alpha Cache", "Beta Cache", "Gamma Cache", "Reward Chest"]:
|
||||||
for y in range(1, 7):
|
for y in range(1, 7):
|
||||||
loc_name = f"{store} {(x * 6) + y}"
|
loc_name = f"{store} {(x * 6) + y}"
|
||||||
|
@ -42,26 +42,26 @@ def create_regions(world: MultiWorld, player: int):
|
||||||
"Back to the entrance with the Knife"],
|
"Back to the entrance with the Knife"],
|
||||||
region)
|
region)
|
||||||
|
|
||||||
world.regions += [region]
|
multiworld.regions += [region]
|
||||||
|
|
||||||
for x, boss in enumerate(bosses):
|
for x, boss in enumerate(bosses):
|
||||||
boss_region = Region(boss, player, world)
|
boss_region = Region(boss, player, multiworld)
|
||||||
boss_region.locations += [
|
boss_region.locations += [
|
||||||
MeritousLocation(player, boss, location_table[boss], boss_region),
|
MeritousLocation(player, boss, location_table[boss], boss_region),
|
||||||
MeritousLocation(player, f"{boss} Defeat", None, boss_region)
|
MeritousLocation(player, f"{boss} Defeat", None, boss_region)
|
||||||
]
|
]
|
||||||
boss_region.exits = _generate_entrances(player, [f"To {regions[x + 1]} Quarter"], boss_region)
|
boss_region.exits = _generate_entrances(player, [f"To {regions[x + 1]} Quarter"], boss_region)
|
||||||
world.regions.append(boss_region)
|
multiworld.regions.append(boss_region)
|
||||||
|
|
||||||
region_final_boss = Region("Final Boss", player, world)
|
region_final_boss = Region("Final Boss", player, multiworld)
|
||||||
region_final_boss.locations += [MeritousLocation(
|
region_final_boss.locations += [MeritousLocation(
|
||||||
player, "Wervyn Anixil", None, region_final_boss)]
|
player, "Wervyn Anixil", None, region_final_boss)]
|
||||||
world.regions.append(region_final_boss)
|
multiworld.regions.append(region_final_boss)
|
||||||
|
|
||||||
region_tfb = Region("True Final Boss", player, world)
|
region_tfb = Region("True Final Boss", player, multiworld)
|
||||||
region_tfb.locations += [MeritousLocation(
|
region_tfb.locations += [MeritousLocation(
|
||||||
player, "Wervyn Anixil?", None, region_tfb)]
|
player, "Wervyn Anixil?", None, region_tfb)]
|
||||||
world.regions.append(region_tfb)
|
multiworld.regions.append(region_tfb)
|
||||||
|
|
||||||
entrance_map = {
|
entrance_map = {
|
||||||
"To Meridian": {
|
"To Meridian": {
|
||||||
|
@ -103,6 +103,6 @@ def create_regions(world: MultiWorld, player: int):
|
||||||
|
|
||||||
for entrance in entrance_map:
|
for entrance in entrance_map:
|
||||||
connection_data = entrance_map[entrance]
|
connection_data = entrance_map[entrance]
|
||||||
connection = world.get_entrance(entrance, player)
|
connection = multiworld.get_entrance(entrance, player)
|
||||||
connection.access_rule = connection_data["rule"]
|
connection.access_rule = connection_data["rule"]
|
||||||
connection.connect(world.get_region(connection_data["to"], player))
|
connection.connect(multiworld.get_region(connection_data["to"], player))
|
||||||
|
|
|
@ -7,7 +7,7 @@ from BaseClasses import Item, MultiWorld, Tutorial
|
||||||
from Fill import fill_restrictive
|
from Fill import fill_restrictive
|
||||||
from .Items import item_table, item_groups, MeritousItem
|
from .Items import item_table, item_groups, MeritousItem
|
||||||
from .Locations import location_table, MeritousLocation
|
from .Locations import location_table, MeritousLocation
|
||||||
from .Options import meritous_options, cost_scales
|
from .Options import MeritousOptions, cost_scales
|
||||||
from .Regions import create_regions
|
from .Regions import create_regions
|
||||||
from .Rules import set_rules
|
from .Rules import set_rules
|
||||||
from ..AutoWorld import World, WebWorld
|
from ..AutoWorld import World, WebWorld
|
||||||
|
@ -49,10 +49,11 @@ class MeritousWorld(World):
|
||||||
# NOTE: Remember to change this before this game goes live
|
# NOTE: Remember to change this before this game goes live
|
||||||
required_client_version = (0, 2, 4)
|
required_client_version = (0, 2, 4)
|
||||||
|
|
||||||
option_definitions = meritous_options
|
options: MeritousOptions
|
||||||
|
options_dataclass = MeritousOptions
|
||||||
|
|
||||||
def __init__(self, world: MultiWorld, player: int):
|
def __init__(self, multiworld: MultiWorld, player: int):
|
||||||
super(MeritousWorld, self).__init__(world, player)
|
super(MeritousWorld, self).__init__(multiworld, player)
|
||||||
self.goal = 0
|
self.goal = 0
|
||||||
self.include_evolution_traps = False
|
self.include_evolution_traps = False
|
||||||
self.include_psi_keys = False
|
self.include_psi_keys = False
|
||||||
|
@ -97,11 +98,11 @@ class MeritousWorld(World):
|
||||||
return "Crystals x2000"
|
return "Crystals x2000"
|
||||||
|
|
||||||
def generate_early(self):
|
def generate_early(self):
|
||||||
self.goal = self.multiworld.goal[self.player].value
|
self.goal = self.options.goal.value
|
||||||
self.include_evolution_traps = self.multiworld.include_evolution_traps[self.player].value
|
self.include_evolution_traps = self.options.include_evolution_traps.value
|
||||||
self.include_psi_keys = self.multiworld.include_psi_keys[self.player].value
|
self.include_psi_keys = self.options.include_psi_keys.value
|
||||||
self.item_cache_cost = self.multiworld.item_cache_cost[self.player].value
|
self.item_cache_cost = self.options.item_cache_cost.value
|
||||||
self.death_link = self.multiworld.death_link[self.player].value
|
self.death_link = self.options.death_link.value
|
||||||
|
|
||||||
def create_regions(self):
|
def create_regions(self):
|
||||||
create_regions(self.multiworld, self.player)
|
create_regions(self.multiworld, self.player)
|
||||||
|
|
Loading…
Reference in New Issue