Remove some unnecessary option.class.value

This commit is contained in:
CookieCat
2024-05-13 14:03:56 -04:00
parent 2e56a0444e
commit 1e6bec6c0d
4 changed files with 23 additions and 22 deletions

View File

@@ -4,6 +4,7 @@ from BaseClasses import Region, LocationProgressType, ItemClassification
from worlds.generic.Rules import add_rule
from typing import List, TYPE_CHECKING
from .Locations import death_wishes
from .Options import EndGoal
if TYPE_CHECKING:
from . import HatInTimeWorld
@@ -147,18 +148,18 @@ dw_classes = {
def create_dw_regions(world: "HatInTimeWorld"):
if world.options.DWExcludeAnnoyingContracts.value > 0:
if world.options.DWExcludeAnnoyingContracts:
for name in annoying_dws:
world.excluded_dws.append(name)
if world.options.DWEnableBonus.value == 0 or world.options.DWAutoCompleteBonuses.value > 0:
if not world.options.DWEnableBonus or world.options.DWAutoCompleteBonuses:
for name in death_wishes:
world.excluded_bonuses.append(name)
elif world.options.DWExcludeAnnoyingBonuses.value > 0:
elif world.options.DWExcludeAnnoyingBonuses:
for name in annoying_bonuses:
world.excluded_bonuses.append(name)
if world.options.DWExcludeCandles.value > 0:
if world.options.DWExcludeCandles:
for name in dw_candles:
if name not in world.excluded_dws:
world.excluded_dws.append(name)
@@ -168,7 +169,7 @@ def create_dw_regions(world: "HatInTimeWorld"):
entrance = connect_regions(spaceship, dw_map, "-> Death Wish Map", world.player)
add_rule(entrance, lambda state: state.has("Time Piece", world.player, world.options.DWTimePieceRequirement.value))
if world.options.DWShuffle.value > 0:
if world.options.DWShuffle:
# Connect Death Wishes randomly to one another in a linear sequence
dw_list: List[str] = []
for name in death_wishes.keys():

View File

@@ -16,7 +16,7 @@ def create_itempool(world: "HatInTimeWorld") -> List[Item]:
world.options.YarnAvailable.value,
ItemClassification.progression_skip_balancing)
for i in range(int(len(yarn_pool) * (0.01 * world.options.YarnBalancePercent.value))):
for i in range(int(len(yarn_pool) * (0.01 * world.options.YarnBalancePercent))):
yarn_pool[i].classification = ItemClassification.progression
itempool += yarn_pool
@@ -28,7 +28,7 @@ def create_itempool(world: "HatInTimeWorld") -> List[Item]:
if not item_dlc_enabled(world, name):
continue
if world.options.HatItems.value == 0 and name in hat_type_to_item.values():
if not world.options.HatItems and name in hat_type_to_item.values():
continue
item_type: ItemClassification = item_table.get(name).classification
@@ -39,7 +39,7 @@ def create_itempool(world: "HatInTimeWorld") -> List[Item]:
continue
else:
if name == "Scooter Badge":
if world.options.CTRLogic.value >= 1 or get_difficulty(world) >= Difficulty.MODERATE:
if world.options.CTRLogic or get_difficulty(world) >= Difficulty.MODERATE:
item_type = ItemClassification.progression
elif name == "No Bonk Badge":
if get_difficulty(world) >= Difficulty.MODERATE:
@@ -52,22 +52,22 @@ def create_itempool(world: "HatInTimeWorld") -> List[Item]:
if item_type is ItemClassification.filler or item_type is ItemClassification.trap:
continue
if name in act_contracts.keys() and world.options.ShuffleActContracts.value == 0:
if name in act_contracts.keys() and not world.options.ShuffleActContracts:
continue
if name in alps_hooks.keys() and world.options.ShuffleAlpineZiplines.value == 0:
if name in alps_hooks.keys() and not world.options.ShuffleAlpineZiplines:
continue
if name == "Progressive Painting Unlock" \
and world.options.ShuffleSubconPaintings.value == 0:
and not world.options.ShuffleSubconPaintings:
continue
if world.options.StartWithCompassBadge.value > 0 and name == "Compass Badge":
if world.options.StartWithCompassBadge and name == "Compass Badge":
continue
if name == "Time Piece":
tp_list: List[Item] = create_multiple_items(world, name, get_total_time_pieces(world), item_type)
for i in range(int(len(tp_list) * (0.01 * world.options.TimePieceBalancePercent.value))):
for i in range(int(len(tp_list) * (0.01 * world.options.TimePieceBalancePercent))):
tp_list[i].classification = ItemClassification.progression
itempool += tp_list

View File

@@ -30,27 +30,27 @@ def adjust_options(world: "HatInTimeWorld"):
world.options.DWShuffleCountMin.value, world.options.DWShuffleCountMax.value
total_tps: int = get_total_time_pieces(world)
if world.options.HighestChapterCost.value > total_tps-5:
if world.options.HighestChapterCost > total_tps-5:
world.options.HighestChapterCost.value = min(45, total_tps-5)
if world.options.LowestChapterCost.value > total_tps-5:
if world.options.LowestChapterCost > total_tps-5:
world.options.LowestChapterCost.value = min(45, total_tps-5)
if world.options.FinalChapterMaxCost.value > total_tps:
if world.options.FinalChapterMaxCost > total_tps:
world.options.FinalChapterMaxCost.value = min(50, total_tps)
if world.options.FinalChapterMinCost.value > total_tps:
if world.options.FinalChapterMinCost > total_tps:
world.options.FinalChapterMinCost.value = min(50, total_tps)
# Don't allow Rush Hour goal if DLC2 content is disabled
if world.options.EndGoal.value == 2 and world.options.EnableDLC2.value == 0:
if world.options.EndGoal == EndGoal.option_rush_hour and not world.options.EnableDLC2:
world.options.EndGoal.value = 1
# Don't allow Seal the Deal goal if Death Wish content is disabled
if world.options.EndGoal.value == 3 and not world.is_dw():
if world.options.EndGoal == EndGoal.option_seal_the_deal and not world.is_dw():
world.options.EndGoal.value = 1
if world.options.DWEnableBonus.value > 0:
if world.options.DWEnableBonus:
world.options.DWAutoCompleteBonuses.value = 0
if world.is_dw_only():
@@ -73,7 +73,7 @@ def get_total_time_pieces(world: "HatInTimeWorld") -> int:
if world.is_dlc2():
count += 10
return min(40+world.options.MaxExtraTimePieces.value, count)
return min(40+world.options.MaxExtraTimePieces, count)
class EndGoal(Choice):

View File

@@ -82,7 +82,7 @@ class HatInTimeWorld(World):
def generate_early(self):
adjust_options(self)
if self.options.StartWithCompassBadge.value > 0:
if self.options.StartWithCompassBadge:
self.multiworld.push_precollected(self.create_item("Compass Badge"))
if self.is_dw_only():