Skip to content

Commit

Permalink
Beatable Only logic mode
Browse files Browse the repository at this point in the history
  • Loading branch information
yannl35133 committed Aug 25, 2024
1 parent bf8d952 commit 40a0459
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 21 deletions.
6 changes: 3 additions & 3 deletions gui/presets/default_presets.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"map-mode": "Own Dungeon - Restricted",
"small-key-mode": "Lanayru Caves Key Only",
"boss-key-mode": "Own Dungeon",
"logic-mode": "BiTless",
"logic-mode": "Normal",
"enabled-tricks-bitless": [],
"enabled-tricks-glitched": [],
"song-hints": "None",
Expand Down Expand Up @@ -142,7 +142,7 @@
"map-mode": "Anywhere",
"small-key-mode": "Anywhere",
"boss-key-mode": "Anywhere",
"logic-mode": "BiTless",
"logic-mode": "Normal",
"enabled-tricks-bitless": [],
"enabled-tricks-glitched": [],
"song-hints": "Advanced",
Expand Down Expand Up @@ -215,7 +215,7 @@
"map-mode": "Own Dungeon - Restricted",
"small-key-mode": "Lanayru Caves Key Only",
"boss-key-mode": "Own Dungeon",
"logic-mode": "BiTless",
"logic-mode": "Normal",
"enabled-tricks-bitless": [],
"enabled-tricks-glitched": [],
"song-hints": "Advanced",
Expand Down
6 changes: 4 additions & 2 deletions gui/randogui.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@

LOGIC_MODE_TO_TRICKS_SETTING = {
"Glitchless": None,
"BiTless": "enabled-tricks-bitless",
"Normal": "enabled-tricks-bitless",
"Beatable Only": "enabled-tricks-bitless",
"Beatable Then Banned": "enabled-tricks-bitless",
"Glitched": "enabled-tricks-glitched",
"No Logic": None,
}
Expand Down Expand Up @@ -574,7 +576,7 @@ def update_settings(self):
if "Glitchless" in logic_mode:
self.options.set_option("enabled-tricks-bitless", [])
self.options.set_option("enabled-tricks-glitched", [])
elif "BiTless" in logic_mode:
elif logic_mode in ("Normal", "Beatable Only", "Beatable Then Banned"):
self.options.set_option("enabled-tricks-bitless", self.enabled_tricks)
self.options.set_option("enabled-tricks-glitched", [])
elif "Glitched" in logic_mode:
Expand Down
4 changes: 3 additions & 1 deletion logic/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,12 @@ def all_owned_unique_items(self):
)


BANNED = EIN("Banned")

EMPTY_INV = Inventory()
DAY_BIT: EXTENDED_ITEM = EXTENDED_ITEM["Day"]
NIGHT_BIT: EXTENDED_ITEM = EXTENDED_ITEM["Night"]
BANNED_BIT: EXTENDED_ITEM = EXTENDED_ITEM["Banned"]
BANNED_BIT: EXTENDED_ITEM = EXTENDED_ITEM[BANNED]
EVERYTHING_BIT: EXTENDED_ITEM = EXTENDED_ITEM["Everything"]
EVERYTHING_UNBANNED_BIT: EXTENDED_ITEM = EXTENDED_ITEM["Everything unbanned"]
HINT_BYPASS_BIT: EXTENDED_ITEM = EXTENDED_ITEM["Hint bypass"]
27 changes: 17 additions & 10 deletions logic/randomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
Inventory,
EXTENDED_ITEM,
HINT_BYPASS_BIT,
BANNED_BIT,
BANNED,
)
from .constants import *
from .placements import *
Expand Down Expand Up @@ -87,7 +87,7 @@ def __init__(self, areas: Areas, options: Options, rng: random.Random):
self.logic_options_requirements
| self.endgame_requirements
| {i: DNFInventory(True) for i in self.placement.starting_items}
| self.no_logic_requirements
| self.logic_mode_requirements
)

logic_settings = LogicSettings(
Expand Down Expand Up @@ -320,14 +320,21 @@ def initialize_items(self):
raise ValueError(f"Option rupoor-mode has unknown value {rupoor_mode}.")
self.placement.add_unplaced_items(set(unplaced))

self.no_logic_requirements = {}
if self.options["logic-mode"] == "No Logic":
self.no_logic_requirements = {
item: DNFInventory(True)
for item in EXTENDED_ITEM.items_list
if EXTENDED_ITEM[item] != BANNED_BIT
if item not in self.placement.unplaced_items
DEMISE_BIT = EXTENDED_ITEM[self.areas.short_to_full(DEMISE)]
self.logic_mode_requirements = {}
logic_mode = self.options["logic-mode"]
if logic_mode == "No Logic":
self.logic_mode_requirements |= {
check: DNFInventory(True) for check in self.areas.checks
}
elif logic_mode == "Beatable Only":
self.logic_mode_requirements |= {
check: DNFInventory(DEMISE_BIT) for check in self.areas.checks
}
elif logic_mode == "Beatable Then Banned":
self.logic_mode_requirements |= {BANNED: DNFInventory(DEMISE_BIT)}
else:
assert logic_mode == "Normal"

must_be_placed_items = (
PROGRESS_ITEMS
Expand Down Expand Up @@ -669,7 +676,7 @@ def randomize_starting_entrance(self):
]

start_entrance = self.rng.choices(possible_start_entrances, weights, k=1)[0]
self.placement.map_transitions["\Start"] = start_entrance[0]
self.placement.map_transitions[r"\Start"] = start_entrance[0]
values = start_entrance[1]

self.randomized_start_entrance = {
Expand Down
2 changes: 1 addition & 1 deletion logic/requirements/Faron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Sealed Grounds:
Gate of Time: Nothing
locations:
Zelda's Blessing: Nothing
Defeat Demise: Horde Door Requirement & Sword
Defeat Demise: $ Horde Door Requirement & Sword

Behind the Temple:
exits:
Expand Down
11 changes: 7 additions & 4 deletions options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,15 @@
type: singlechoice
bits: 3
choices:
# - Glitchless
- BiTless
- Normal
- Beatable Only
- Beatable Then Banned
- No Logic
default: BiTless
default: Normal
help: "Determines the logic mode to use when placing items.
**BiTless**: requires no tricks to beat the game but allows non-BiT tricks to be enabled.
**Normal**: requires no tricks to beat the game but allows non-BiT tricks to be enabled.
**Beatable Only**: unneeded progress items may be placed anywhere, and thus be inaccessible.
**Beatable Then Banned**: unneeded progress items may be placed in banned locations, but can still be accessed.
**No Logic**: items are placed without logic and will likely result in an unbeatable game."
ui: option_logic_mode
## Tricks
Expand Down

0 comments on commit 40a0459

Please sign in to comment.