V6: some cleanup

This commit is contained in:
Fabian Dill 2022-02-04 21:34:39 +01:00
parent 8e04182b3f
commit 6e53cb2deb
3 changed files with 10 additions and 7 deletions

View File

@ -4,6 +4,7 @@ from .Locations import V6Location, location_table
v6areas = ["Laboratory", "The Tower", "Space Station 2", "Warp Zone"] v6areas = ["Laboratory", "The Tower", "Space Station 2", "Warp Zone"]
def create_regions(world: MultiWorld, player: int): def create_regions(world: MultiWorld, player: int):
regOvr = Region("Menu", RegionType.Generic, "Dimension VVVVVV", player, world) regOvr = Region("Menu", RegionType.Generic, "Dimension VVVVVV", player, world)
locOvr_names = ["Overworld (Pipe-shaped Segment)", "Overworld (Left of Ship)", "Overworld (Square Room)", "Overworld (Sad Elephant)", locOvr_names = ["Overworld (Pipe-shaped Segment)", "Overworld (Left of Ship)", "Overworld (Square Room)", "Overworld (Sad Elephant)",
@ -31,6 +32,7 @@ def create_regions(world: MultiWorld, player: int):
regWrp.locations += [V6Location(player, loc_name, location_table[loc_name], regWrp) for loc_name in locWrp_names] regWrp.locations += [V6Location(player, loc_name, location_table[loc_name], regWrp) for loc_name in locWrp_names]
world.regions.append(regWrp) world.regions.append(regWrp)
def connect_regions(world: MultiWorld, player: int, source: str, target: str, rule): def connect_regions(world: MultiWorld, player: int, source: str, target: str, rule):
sourceRegion = world.get_region(source, player) sourceRegion = world.get_region(source, player)
targetRegion = world.get_region(target, player) targetRegion = world.get_region(target, player)

View File

@ -2,7 +2,6 @@ import typing
from ..generic.Rules import add_rule from ..generic.Rules import add_rule
from .Regions import connect_regions, v6areas from .Regions import connect_regions, v6areas
area_connections = {}
def _has_trinket_range(state,player,start,end) -> bool: def _has_trinket_range(state,player,start,end) -> bool:
for i in range(start,end): for i in range(start,end):
@ -10,9 +9,10 @@ def _has_trinket_range(state,player,start,end) -> bool:
return False return False
return True return True
def set_rules(world,player,area_connections):
def set_rules(world, player, area_connections: typing.Dict[int, int]):
areashuffle = list(range(len(v6areas))) areashuffle = list(range(len(v6areas)))
if (world.AreaRandomizer[player].value): if world.AreaRandomizer[player].value:
world.random.shuffle(areashuffle) world.random.shuffle(areashuffle)
area_connections.update({(index+1): (value+1) for index, value in enumerate(areashuffle)}) area_connections.update({(index+1): (value+1) for index, value in enumerate(areashuffle)})
area_connections.update({0:0}) area_connections.update({0:0})

View File

@ -1,8 +1,9 @@
import string import typing
from .Items import item_table, V6Item from .Items import item_table, V6Item
from .Locations import location_table, V6Location from .Locations import location_table, V6Location
from .Options import v6_options from .Options import v6_options
from .Rules import set_rules, area_connections from .Rules import set_rules
from .Regions import create_regions from .Regions import create_regions
from BaseClasses import Region, RegionType, Entrance, Item, MultiWorld from BaseClasses import Region, RegionType, Entrance, Item, MultiWorld
from ..AutoWorld import World from ..AutoWorld import World
@ -23,7 +24,7 @@ class V6World(World):
data_version = 1 data_version = 1
forced_auto_forfeit = False forced_auto_forfeit = False
area_connections = {} area_connections: typing.Dict[int, int]
options = v6_options options = v6_options
@ -32,7 +33,7 @@ class V6World(World):
def set_rules(self): def set_rules(self):
self.area_connections = {} self.area_connections = {}
set_rules(self.world,self.player,self.area_connections) set_rules(self.world, self.player, self.area_connections)
def create_item(self, name: str) -> Item: def create_item(self, name: str) -> Item:
return V6Item(name, True, item_table[name], self.player) return V6Item(name, True, item_table[name], self.player)