Zillion: new map generation feature (#3604)

This commit is contained in:
Doug Hoskisson 2024-07-02 19:32:01 -07:00 committed by GitHub
parent 95110c4787
commit 50f7a79ea7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 30 additions and 12 deletions

View File

@ -145,10 +145,10 @@ class ZillionWorld(World):
self._item_counts = item_counts self._item_counts = item_counts
with redirect_stdout(self.lsi): # type: ignore with redirect_stdout(self.lsi): # type: ignore
self.zz_system.make_randomizer(zz_op) self.zz_system.set_options(zz_op)
self.zz_system.seed(self.random.randrange(1999999999))
self.zz_system.seed(self.multiworld.seed)
self.zz_system.make_map() self.zz_system.make_map()
self.zz_system.make_randomizer()
# just in case the options changed anything (I don't think they do) # just in case the options changed anything (I don't think they do)
assert self.zz_system.randomizer, "init failed" assert self.zz_system.randomizer, "init failed"

View File

@ -1,9 +1,9 @@
from collections import Counter from collections import Counter
from dataclasses import dataclass from dataclasses import dataclass
from typing import ClassVar, Dict, Tuple from typing import ClassVar, Dict, Literal, Tuple
from typing_extensions import TypeGuard # remove when Python >= 3.10 from typing_extensions import TypeGuard # remove when Python >= 3.10
from Options import Choice, DefaultOnToggle, NamedRange, OptionGroup, PerGameCommonOptions, Range, Toggle from Options import Choice, DefaultOnToggle, NamedRange, OptionGroup, PerGameCommonOptions, Range, Removed, Toggle
from zilliandomizer.options import ( from zilliandomizer.options import (
Options as ZzOptions, char_to_gun, char_to_jump, ID, Options as ZzOptions, char_to_gun, char_to_jump, ID,
@ -251,9 +251,25 @@ class ZillionStartingCards(NamedRange):
} }
class ZillionRoomGen(Toggle): class ZillionMapGen(Choice):
""" whether to generate rooms with random terrain """ """
display_name = "room generation" - none: vanilla map
- rooms: random terrain inside rooms, but path through base is vanilla
- full: random path through base
"""
display_name = "map generation"
option_none = 0
option_rooms = 1
option_full = 2
default = 0
def zz_value(self) -> Literal['none', 'rooms', 'full']:
if self.value == ZillionMapGen.option_none:
return "none"
if self.value == ZillionMapGen.option_rooms:
return "rooms"
assert self.value == ZillionMapGen.option_full
return "full"
@dataclass @dataclass
@ -276,7 +292,9 @@ class ZillionOptions(PerGameCommonOptions):
early_scope: ZillionEarlyScope early_scope: ZillionEarlyScope
skill: ZillionSkill skill: ZillionSkill
starting_cards: ZillionStartingCards starting_cards: ZillionStartingCards
room_gen: ZillionRoomGen map_gen: ZillionMapGen
room_gen: Removed
z_option_groups = [ z_option_groups = [
@ -375,7 +393,7 @@ def validate(options: ZillionOptions) -> "Tuple[ZzOptions, Counter[str]]":
starting_cards = options.starting_cards starting_cards = options.starting_cards
room_gen = options.room_gen map_gen = options.map_gen.zz_value()
zz_item_counts = convert_item_counts(item_counts) zz_item_counts = convert_item_counts(item_counts)
zz_op = ZzOptions( zz_op = ZzOptions(
@ -393,7 +411,7 @@ def validate(options: ZillionOptions) -> "Tuple[ZzOptions, Counter[str]]":
bool(options.early_scope.value), bool(options.early_scope.value),
True, # balance defense True, # balance defense
starting_cards.value, starting_cards.value,
bool(room_gen.value) map_gen
) )
zz_validate(zz_op) zz_validate(zz_op)
return zz_op, item_counts return zz_op, item_counts

View File

@ -1,2 +1,2 @@
zilliandomizer @ git+https://github.com/beauxq/zilliandomizer@1dd2ce01c9d818caba5844529699b3ad026d6a07#0.7.1 zilliandomizer @ git+https://github.com/beauxq/zilliandomizer@4a2fec0aa1c529df866e510cdfcf6dca4d53679b#0.8.0
typing-extensions>=4.7, <5 typing-extensions>=4.7, <5