Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gaithern committed Dec 6, 2023
2 parents ed87bba + a861ede commit 0d43cec
Show file tree
Hide file tree
Showing 278 changed files with 46,009 additions and 9,109 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*.z64
*.n64
*.nes
*.smc
*.sms
*.gb
*.gbc
Expand Down
10 changes: 7 additions & 3 deletions BaseClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ def sweep_for_events(self, key_only: bool = False, locations: Optional[Iterable[
assert isinstance(event.item, Item), "tried to collect Event with no Item"
self.collect(event.item, True, event)

# item name related
def has(self, item: str, player: int, count: int = 1) -> bool:
return self.prog_items[player][item] >= count

Expand All @@ -728,6 +729,11 @@ def has_any(self, items: Iterable[str], player: int) -> bool:
def count(self, item: str, player: int) -> int:
return self.prog_items[player][item]

def item_count(self, item: str, player: int) -> int:
Utils.deprecate("Use count instead.")
return self.count(item, player)

# item name group related
def has_group(self, item_name_group: str, player: int, count: int = 1) -> bool:
found: int = 0
player_prog_items = self.prog_items[player]
Expand All @@ -744,9 +750,7 @@ def count_group(self, item_name_group: str, player: int) -> int:
found += player_prog_items[item_name]
return found

def item_count(self, item: str, player: int) -> int:
return self.prog_items[player][item]

# Item related
def collect(self, item: Item, event: bool = False, location: Optional[Location] = None) -> bool:
if location:
self.locations_checked.add(location)
Expand Down
5 changes: 4 additions & 1 deletion Fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def mark_for_locking(location: Location):
raise FillError(
f"Not enough filler items for excluded locations. There are {len(excludedlocations)} more locations than items")

restitempool = usefulitempool + filleritempool
restitempool = filleritempool + usefulitempool

remaining_fill(world, defaultlocations, restitempool)

Expand Down Expand Up @@ -792,6 +792,9 @@ def failed(warning: str, force: typing.Union[bool, str]) -> None:
block['force'] = 'silent'
if 'from_pool' not in block:
block['from_pool'] = True
elif not isinstance(block['from_pool'], bool):
from_pool_type = type(block['from_pool'])
raise Exception(f'Plando "from_pool" has to be boolean, not {from_pool_type} for player {player}.')
if 'world' not in block:
target_world = False
else:
Expand Down
13 changes: 12 additions & 1 deletion Generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from BaseClasses import seeddigits, get_seed, PlandoOptions
from Main import main as ERmain
from settings import get_settings
from Utils import parse_yamls, version_tuple, __version__, tuplize_version, user_path
from Utils import parse_yamls, version_tuple, __version__, tuplize_version
from worlds.alttp import Options as LttPOptions
from worlds.alttp.EntranceRandomizer import parse_arguments
from worlds.alttp.Text import TextTable
Expand Down Expand Up @@ -53,6 +53,9 @@ def mystery_argparse():
help='List of options that can be set manually. Can be combined, for example "bosses, items"')
parser.add_argument("--skip_prog_balancing", action="store_true",
help="Skip progression balancing step during generation.")
parser.add_argument("--skip_output", action="store_true",
help="Skips generation assertion and output stages and skips multidata and spoiler output. "
"Intended for debugging and testing purposes.")
args = parser.parse_args()
if not os.path.isabs(args.weights_file_path):
args.weights_file_path = os.path.join(args.player_files_path, args.weights_file_path)
Expand Down Expand Up @@ -127,6 +130,13 @@ def main(args=None, callback=ERmain):
player_id += 1

args.multi = max(player_id - 1, args.multi)

if args.multi == 0:
raise ValueError(
"No individual player files found and number of players is 0. "
"Provide individual player files or specify the number of players via host.yaml or --multi."
)

logging.info(f"Generating for {args.multi} player{'s' if args.multi > 1 else ''}, "
f"{seed_name} Seed {seed} with plando: {args.plando}")

Expand All @@ -143,6 +153,7 @@ def main(args=None, callback=ERmain):
erargs.outputname = seed_name
erargs.outputpath = args.outputpath
erargs.skip_prog_balancing = args.skip_prog_balancing
erargs.skip_output = args.skip_output

settings_cache: Dict[str, Tuple[argparse.Namespace, ...]] = \
{fname: (tuple(roll_settings(yaml, args.plando) for yaml in yamls) if args.samesettings else None)
Expand Down
Loading

0 comments on commit 0d43cec

Please sign in to comment.