mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 12:11:33 -06:00
SC2: Option for random mission order (#569)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import typing
|
||||
|
||||
from typing import List, Set, Tuple
|
||||
from typing import List, Set, Tuple, NamedTuple
|
||||
from BaseClasses import Item, MultiWorld, Location, Tutorial
|
||||
from ..AutoWorld import World, WebWorld
|
||||
from .Items import StarcraftWoLItem, item_table, filler_items, item_name_groups, get_full_item_list, \
|
||||
@@ -24,6 +24,7 @@ class Starcraft2WoLWebWorld(WebWorld):
|
||||
|
||||
tutorials = [setup]
|
||||
|
||||
|
||||
class SC2WoLWorld(World):
|
||||
"""
|
||||
StarCraft II: Wings of Liberty is a science fiction real-time strategy video game developed and published by Blizzard Entertainment.
|
||||
@@ -40,6 +41,7 @@ class SC2WoLWorld(World):
|
||||
item_name_groups = item_name_groups
|
||||
locked_locations: typing.List[str]
|
||||
location_cache: typing.List[Location]
|
||||
mission_req_table = {}
|
||||
|
||||
def __init__(self, world: MultiWorld, player: int):
|
||||
super(SC2WoLWorld, self).__init__(world, player)
|
||||
@@ -55,8 +57,8 @@ class SC2WoLWorld(World):
|
||||
return StarcraftWoLItem(name, data.progression, data.code, self.player)
|
||||
|
||||
def create_regions(self):
|
||||
create_regions(self.world, self.player, get_locations(self.world, self.player),
|
||||
self.location_cache)
|
||||
self.mission_req_table = create_regions(self.world, self.player, get_locations(self.world, self.player),
|
||||
self.location_cache)
|
||||
|
||||
def generate_basic(self):
|
||||
excluded_items = get_excluded_items(self, self.world, self.player)
|
||||
@@ -83,6 +85,11 @@ class SC2WoLWorld(World):
|
||||
option = getattr(self.world, option_name)[self.player]
|
||||
if type(option.value) in {str, int}:
|
||||
slot_data[option_name] = int(option.value)
|
||||
slot_req_table = {}
|
||||
for mission in self.mission_req_table:
|
||||
slot_req_table[mission] = self.mission_req_table[mission]._asdict()
|
||||
|
||||
slot_data["mission_req"] = slot_req_table
|
||||
return slot_data
|
||||
|
||||
|
||||
@@ -122,7 +129,15 @@ def assign_starter_items(world: MultiWorld, player: int, excluded_items: Set[str
|
||||
if not local_basic_unit:
|
||||
raise Exception("At least one basic unit must be local")
|
||||
|
||||
assign_starter_item(world, player, excluded_items, locked_locations, 'Liberation Day: First Statue',
|
||||
# The first world should also be the starting world
|
||||
first_location = list(world.worlds[player].mission_req_table)[0]
|
||||
|
||||
if first_location == "In Utter Darkness":
|
||||
first_location = first_location + ": Defeat"
|
||||
else:
|
||||
first_location = first_location + ": Victory"
|
||||
|
||||
assign_starter_item(world, player, excluded_items, locked_locations, first_location,
|
||||
local_basic_unit)
|
||||
|
||||
|
||||
@@ -168,4 +183,4 @@ def create_item_with_correct_settings(world: MultiWorld, player: int, name: str)
|
||||
if not item.advancement:
|
||||
return item
|
||||
|
||||
return item
|
||||
return item
|
||||
|
Reference in New Issue
Block a user