TUNIC: The Big Refactor (#5195)
* Make it actually return false if it gets to the backup lists and fails them * Fix stuff after merge * Add outlet regions, create new regions as needed for them * Put together part of decoupled and direction pairs * make direction pairs work * Make decoupled work * Make fixed shop work again * Fix a few minor bugs * Fix a few minor bugs * Fix plando * god i love programming * Reorder portal list * Update portal sorter for variable shops * Add missing parameter * Some cleanup of prints and functions * Fix typo * it's aliiiiiive * Make seed groups not sync decoupled * Add test with full-shop plando * Fix bug with vanilla portals * Handle plando connections and direction pair errors * Update plando checking for decoupled * Fix typo * Fix exception text to be shorter * Add some more comments * Add todo note * Remove unused safety thing * Remove extra plando connections definition in options * Make seed groups in decoupled with overlapping but not fully overlapped plando connections interact nicely without messing with what the entrances look like in the spoiler log * Fix weird edge case that is technically user error * Add note to fixed shop * Fix parsing shop names in UT * Remove debug print * Actually make UT work * multiworld. to world. * Fix typo from merge * Make it so the shops show up in the entrance hints * Fix bug in ladder storage rules * Remove blank line * # Conflicts: # worlds/tunic/__init__.py # worlds/tunic/er_data.py # worlds/tunic/er_rules.py # worlds/tunic/er_scripts.py # worlds/tunic/rules.py # worlds/tunic/test/test_access.py * Fix issues after merge * Update plando connections stuff in docs * Make early bushes only contain grass * Fix library mistake * Backport changes to grass rando (#20) * Backport changes to grass rando * add_rule instead of set_rule for the special cases, add special cases for back of swamp laurels area cause I should've made a new region for the swamp upper entrance * Remove item name group for grass * Update grass rando option descriptions - Also ignore grass fill for single player games * Ignore grass fill option for solo rando * Update er_rules.py * Fix pre fill issue * Remove duplicate option * Add excluded grass locations back * Hide grass fill option from simple ui options page * Check for start with sword before setting grass rules * Update worlds/tunic/options.py Co-authored-by: Scipio Wright <scipiowright@gmail.com> * has_stick -> has_melee * has_stick -> has_melee * Add a failsafe for direction pairing * Fix playthrough crash bug * Remove init from logicmixin * Updates per code review (thanks hesto) * has_stick to has_melee in newer update * has_stick to has_melee in newer update * Exclude grass from get_filler_item_name - non-grass rando games were accidentally seeing grass items get shuffled in as filler, which is funny but probably shouldn't happen * Update worlds/tunic/__init__.py Co-authored-by: Scipio Wright <scipiowright@gmail.com> * Apply suggestions from code review Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> Co-authored-by: Scipio Wright <scipiowright@gmail.com> * change the rest of grass_fill to local_fill * Filter out grass from filler_items * remove -> discard * Update worlds/tunic/__init__.py Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> * Starting out * Rules for breakable regions * # Conflicts: # worlds/tunic/__init__.py # worlds/tunic/combat_logic.py # worlds/tunic/er_data.py # worlds/tunic/er_rules.py # worlds/tunic/er_scripts.py * Cleanup more stuff after merge * Revert "Cleanup more stuff after merge" This reverts commit a6ee9a93da8f2fcc4413de6df6927b246017889d. * Revert "# Conflicts:" This reverts commit c74ccd74a45b6ad6b9abe6e339d115a0c98baf30. * Cleanup more stuff after merge * change has_stick to has_melee * Update grass list with combat logic regions * More fixes from combat logic merge * Fix some dumb stuff (#21) * Reorganize pre fill for grass * make the rest of it work, it's pr ready, boom * Make it work in not pot shuffle * Merge grass rando * multiworld -> world get_location, use has_any * Swap out region for West Garden Before Terry grass * Adjust west garden rules to add west combat region * Adjust grass regions for south checkpoint grass * Adjust grass regions for after terry grass * Adjust grass regions for west combat grass * Adjust grass regions for dagger house grass * Adjust grass regions for south checkpoint grass, adjust regions and rules for some related locations * Finish the remainder of the west garden grass, reformat ruined atoll a little * More hex quest updates - Implement page ability shuffle for hex quest - Fix keys behind bosses if hex goal is less than 3 - Added check to fix conflicting hex quest options - Add option to slot data * Change option comparison * Change option checking and fix some stuff - also keep prayer first on low hex counts * Update option defaulting * Update option checking * Fix option assignment again * Merge in hex hunt * Merge in changes * Clean up imports * Add ability type to UT stuff * merge it all * Make local fill work across pot and grass (to be adjusted later) * Make separate pools for the grass and non-grass fills * Fix id overlap * Update option description * Fix default * Reorder localfill option desc * Load the purgatory ones in * Adjustments after merge * Fully remove logicrules * Fix UT support with fixed shop option * Add breakable shuffle to the ut stuff * Make it load in a specific number of locations * Add Silent's spoiler log ability thing * Fix for groups * Fix for groups * Fix typo * Fix hex quest UT support * Use .get * UT fixes, classification fixes * Rename some locations * Adjust guard house names * Adjust guard house names * Rework create_item * Fix for plando connections * Rename, add new breakables * Rename more stuff * Time to rename them again * Fix issue with fixed shop + decoupled * Put in an exception to catch that error in the future * Update create_item to match main * Update spoiler log lines for hex abilities * Burn the signs down * Bring over the combat logic fix * Merge in combat logic fix * Silly static method thing * Move a few areas to before well instead of east forest * Add an all_random hidden option for dev stuff * Port over changes from main * Fix west courtyard pot regions * Remove debug prints * Fix fortress courtyard and beneath the fortress loc groups again * Add exception handling to deal with duplicate apworlds * Fix typo * More missing loc group conversions * Initial fuse shuffle stuff * Fix gun missing from combat_items, add new for combat logic cache, very slight refactor of check_combat_reqs to let it do the changeover in a less complicated fashion, fix area being a boss area rather than non-boss area for a check * Add fuse shuffle logic * reorder atoll statue rule * Update traversal reqs * Remove fuse shuffle from temple door * Combine rules and option checking * Add bell shuffle; fix fuse location groups * Fix portal rules not requiring prayer * Merge the grass laurels exit grass PR * Merge in fortress bridge PR * Do a little clean up * Fix a regression * Update after merge * Some more stuff * More Silent changes * Update more info section in game info page * Fix rules for atoll and swamp fuses * Precollect cathedral fuse in ER * actually just make the fuse useful instead of progression * Add it to the swamp and cath rules too * Fix cath fuse name * Minor fixes and edits * Some UT stuff * Fix a couple more groups * Move a bunch of UT stuff to its own file * Fix up a couple UT things * Couple minor ER fixes * Formatting change * UT poptracker stuff enabled since it's optional in one of the releases * Add author string to world class * Adjust local fill option name * Update ut_stuff to match the PR * Add exception handling for UT with old apworld * Fix missing tracker_world * Remove extra entrance from cath main -> elevator Entry <-> Elev exists, Entry <-> Main exists So no connection is needed between Main and Elev * Fix so that decoupled doesn't incorrectly use get_portal_info and get_paired_portal * Fix so that decoupled doesn't incorrectly use get_portal_info and get_paired_portal * Update for breakables poptracker * Backup and warnings instead * Update typing * Delete old regions and rules, move stuff to logic_helpers and constants * Delete now much less useful tests * Fix breakables map tracking * Add more comments to init * Add todo to grass.py * Fix up tests * Pull out fuse and bell shuffle * Pull out fuse and bell shuffle * Update worlds/tunic/options.py Co-authored-by: qwint <qwint.42@gmail.com> * Update worlds/tunic/logic_helpers.py Co-authored-by: qwint <qwint.42@gmail.com> * {} -> () in state functions * {} -> () in state functions * Change {} -> () in state functions, use constant for gun * Remove floating constants in er_data * Finish hard deprecating FixedShop * Finish hard deprecating FixedShop * Fix zig skip showing up in decoupled fixed shop --------- Co-authored-by: silent-destroyer <osilentdestroyer@gmail.com> Co-authored-by: Silent <110704408+silent-destroyer@users.noreply.github.com> Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> Co-authored-by: qwint <qwint.42@gmail.com>
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import logging
|
||||
from dataclasses import dataclass
|
||||
from typing import Dict, Any, TYPE_CHECKING
|
||||
|
||||
from decimal import Decimal, ROUND_HALF_UP
|
||||
import logging
|
||||
from typing import Any, TYPE_CHECKING
|
||||
|
||||
from Options import (DefaultOnToggle, Toggle, StartInventoryPool, Choice, Range, TextChoice, PlandoConnections,
|
||||
PerGameCommonOptions, OptionGroup, Removed, Visibility, NamedRange)
|
||||
|
||||
from .er_data import portal_mapping
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from . import TunicWorld
|
||||
|
||||
@@ -145,17 +146,6 @@ class EntranceRando(TextChoice):
|
||||
default = 0
|
||||
|
||||
|
||||
class FixedShop(Toggle):
|
||||
"""
|
||||
This option has been superseded by the Entrance Layout option.
|
||||
If enabled, it will override the Entrance Layout option.
|
||||
This is kept to keep older yamls working, and will be removed at a later date.
|
||||
"""
|
||||
visibility = Visibility.none
|
||||
internal_name = "fixed_shop"
|
||||
display_name = "Fewer Shops in Entrance Rando"
|
||||
|
||||
|
||||
class EntranceLayout(Choice):
|
||||
"""
|
||||
Decide how the Entrance Randomizer chooses how to pair the entrances.
|
||||
@@ -219,8 +209,8 @@ class GrassRandomizer(Toggle):
|
||||
class LocalFill(NamedRange):
|
||||
"""
|
||||
Choose the percentage of your filler/trap items that will be kept local or distributed to other TUNIC players with this option enabled.
|
||||
This option defaults to 95% if you have Grass Randomizer enabled, 40% if you have Breakable Shuffle enabled, 96% if you have both, and 0% otherwise.
|
||||
If you have Grass Randomizer enabled, this option must be set to 95% or higher to avoid flooding the item pool. The host can remove this restriction by turning off the limit_grass_rando setting in host.yaml.
|
||||
This option defaults to 95% if you have Grass Randomizer enabled, and to 0% otherwise.
|
||||
This option ignores items placed in your local_items or non_local_items.
|
||||
This option does nothing in single player games.
|
||||
"""
|
||||
@@ -332,6 +322,14 @@ class LadderStorageWithoutItems(Toggle):
|
||||
display_name = "Ladder Storage without Items"
|
||||
|
||||
|
||||
class BreakableShuffle(Toggle):
|
||||
"""
|
||||
Turns approximately 250 breakable objects in the game into checks.
|
||||
"""
|
||||
internal_name = "breakable_shuffle"
|
||||
display_name = "Breakable Shuffle"
|
||||
|
||||
|
||||
class HiddenAllRandom(Toggle):
|
||||
"""
|
||||
Sets all options that can be random to random.
|
||||
@@ -342,36 +340,9 @@ class HiddenAllRandom(Toggle):
|
||||
visibility = Visibility.none
|
||||
|
||||
|
||||
class LogicRules(Choice):
|
||||
"""
|
||||
This option has been superseded by the individual trick options.
|
||||
If set to nmg, it will set Ice Grappling to medium and Laurels Zips on.
|
||||
If set to ur, it will do nmg as well as set Ladder Storage to medium.
|
||||
It is here to avoid breaking old yamls, and will be removed at a later date.
|
||||
"""
|
||||
visibility = Visibility.none
|
||||
internal_name = "logic_rules"
|
||||
display_name = "Logic Rules"
|
||||
option_restricted = 0
|
||||
option_no_major_glitches = 1
|
||||
alias_nmg = 1
|
||||
option_unrestricted = 2
|
||||
alias_ur = 2
|
||||
default = 0
|
||||
|
||||
|
||||
class BreakableShuffle(Toggle):
|
||||
"""
|
||||
Turns approximately 250 breakable objects in the game into checks.
|
||||
"""
|
||||
internal_name = "breakable_shuffle"
|
||||
display_name = "Breakable Shuffle"
|
||||
|
||||
|
||||
@dataclass
|
||||
class TunicOptions(PerGameCommonOptions):
|
||||
start_inventory_from_pool: StartInventoryPool
|
||||
|
||||
sword_progression: SwordProgression
|
||||
start_with_sword: StartWithSword
|
||||
keys_behind_bosses: KeysBehindBosses
|
||||
@@ -386,6 +357,8 @@ class TunicOptions(PerGameCommonOptions):
|
||||
hexagon_quest_ability_type: HexagonQuestAbilityUnlockType
|
||||
|
||||
shuffle_ladders: ShuffleLadders
|
||||
# shuffle_fuses: ShuffleFuses
|
||||
# shuffle_bells: ShuffleBells
|
||||
grass_randomizer: GrassRandomizer
|
||||
breakable_shuffle: BreakableShuffle
|
||||
local_fill: LocalFill
|
||||
@@ -393,7 +366,6 @@ class TunicOptions(PerGameCommonOptions):
|
||||
entrance_rando: EntranceRando
|
||||
entrance_layout: EntranceLayout
|
||||
decoupled: Decoupled
|
||||
plando_connections: TunicPlandoConnections
|
||||
|
||||
combat_logic: CombatLogic
|
||||
lanternless: Lanternless
|
||||
@@ -402,11 +374,13 @@ class TunicOptions(PerGameCommonOptions):
|
||||
ice_grappling: IceGrappling
|
||||
ladder_storage: LadderStorage
|
||||
ladder_storage_without_items: LadderStorageWithoutItems
|
||||
|
||||
|
||||
plando_connections: TunicPlandoConnections
|
||||
|
||||
all_random: HiddenAllRandom
|
||||
|
||||
fixed_shop: FixedShop # will be removed at a later date
|
||||
logic_rules: Removed # fully removed in the direction pairs update
|
||||
fixed_shop: Removed
|
||||
logic_rules: Removed
|
||||
|
||||
|
||||
tunic_option_groups = [
|
||||
@@ -433,7 +407,7 @@ tunic_option_groups = [
|
||||
]),
|
||||
]
|
||||
|
||||
tunic_option_presets: Dict[str, Dict[str, Any]] = {
|
||||
tunic_option_presets: dict[str, dict[str, Any]] = {
|
||||
"Sync": {
|
||||
"ability_shuffling": True,
|
||||
},
|
||||
@@ -460,14 +434,16 @@ tunic_option_presets: Dict[str, Dict[str, Any]] = {
|
||||
|
||||
def check_options(world: "TunicWorld"):
|
||||
options = world.options
|
||||
if options.hexagon_quest and options.ability_shuffling and options.hexagon_quest_ability_type == HexagonQuestAbilityUnlockType.option_hexagons:
|
||||
if (options.hexagon_quest and options.ability_shuffling
|
||||
and options.hexagon_quest_ability_type == HexagonQuestAbilityUnlockType.option_hexagons):
|
||||
total_hexes = get_hexagons_in_pool(world)
|
||||
min_hexes = 3
|
||||
|
||||
if options.keys_behind_bosses:
|
||||
min_hexes = 15
|
||||
if total_hexes < min_hexes:
|
||||
logging.warning(f"TUNIC: Not enough Gold Hexagons in {world.player_name}'s item pool for Hexagon Ability Shuffle with the selected options. Ability Shuffle mode will be switched to Pages.")
|
||||
logging.warning(f"TUNIC: Not enough Gold Hexagons in {world.player_name}'s item pool for Hexagon Ability "
|
||||
"Shuffle with the selected options. Ability Shuffle mode will be switched to Pages.")
|
||||
options.hexagon_quest_ability_type.value = HexagonQuestAbilityUnlockType.option_pages
|
||||
|
||||
|
||||
@@ -475,4 +451,4 @@ def get_hexagons_in_pool(world: "TunicWorld"):
|
||||
# Calculate number of hexagons in item pool
|
||||
options = world.options
|
||||
return min(int((Decimal(100 + options.extra_hexagon_percentage) / 100 * options.hexagon_goal)
|
||||
.to_integral_value(rounding=ROUND_HALF_UP)), 100)
|
||||
.to_integral_value(rounding=ROUND_HALF_UP)), 100)
|
||||
|
||||
Reference in New Issue
Block a user