Skip to content

Commit

Permalink
Goal setup
Browse files Browse the repository at this point in the history
  • Loading branch information
PoryGone committed Aug 20, 2024
1 parent 33dd261 commit 3e4b91e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
4 changes: 4 additions & 0 deletions worlds/sa2b/Items.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def __init__(self, name, classification: ItemClassification, code: int = None, p
ItemName.cutscene_trap: ItemData(0xFF0039, False, True),
ItemName.reverse_trap: ItemData(0xFF003A, False, True),
ItemName.literature_trap: ItemData(0xFF003B, False, True),
}

minigame_trap_table = {
ItemName.pong_trap: ItemData(0xFF0050, False, True),
ItemName.platformer_trap: ItemData(0xFF0051, False, True),
ItemName.fishing_trap: ItemData(0xFF0052, False, True),
Expand Down Expand Up @@ -252,6 +254,7 @@ def __init__(self, name, classification: ItemClassification, code: int = None, p
**upgrades_table,
**junk_table,
**trap_table,
**minigame_trap_table,
**emeralds_table,
**eggs_table,
**fruits_table,
Expand All @@ -271,6 +274,7 @@ def __init__(self, name, classification: ItemClassification, code: int = None, p
"Seeds": list(seeds_table.keys()),
"Hats": list(hats_table.keys()),
"Traps": list(trap_table.keys()),
"Minigames": list(minigame_trap_table.keys()),
}

try:
Expand Down
2 changes: 1 addition & 1 deletion worlds/sa2b/Locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2362,7 +2362,7 @@ def setup_locations(world: World, player: int, mission_map: typing.Dict[int, int
elif world.options.kart_race_checks == 1:
location_table.update({**kart_race_mini_location_table})

if world.options.goal.value in [0, 2, 4, 5, 6]:
if world.options.goal.value in [0, 2, 4, 5, 6, 8]:
location_table.update({**final_boss_location_table})
elif world.options.goal.value in [7]:
location_table.update({**chaos_chao_location_table})
Expand Down
3 changes: 3 additions & 0 deletions worlds/sa2b/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class Goal(Choice):
Boss Rush Chaos Emerald Hunt: Find the Seven Chaos Emeralds, then beat all of the bosses in the Boss Rush, ending with Finalhazard
Chaos Chao: Raise a Chaos Chao to win
Minigame Madness: Win one of each Minigame Trap, then defeat Finalhazard
"""
display_name = "Goal"
option_biolizard = 0
Expand All @@ -34,6 +36,7 @@ class Goal(Choice):
option_cannons_core_boss_rush = 5
option_boss_rush_chaos_emerald_hunt = 6
option_chaos_chao = 7
option_minigame_madness = 8
default = 0

@classmethod
Expand Down
7 changes: 5 additions & 2 deletions worlds/sa2b/Regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from BaseClasses import MultiWorld, Region, Entrance, ItemClassification
from worlds.AutoWorld import World
from .Items import SA2BItem
from .Items import SA2BItem, minigame_trap_table
from .Locations import SA2BLocation, boss_gate_location_table, boss_gate_set,\
chao_stat_swim_table, chao_stat_fly_table, chao_stat_run_table,\
chao_stat_power_table, chao_stat_stamina_table,\
Expand Down Expand Up @@ -2237,7 +2237,7 @@ def create_regions(multiworld: MultiWorld, world: World, player: int, active_loc
grand_prix_region = create_region(multiworld, player, active_locations, LocationName.grand_prix_region,
grand_prix_region_locations)
conditional_regions += [grand_prix_region]
elif world.options.goal in [0, 2, 4, 5, 6]:
elif world.options.goal in [0, 2, 4, 5, 6, 8]:
biolizard_region_locations = [
LocationName.finalhazard,
]
Expand Down Expand Up @@ -2392,6 +2392,9 @@ def connect_regions(multiworld: MultiWorld, world: World, player: int, gates: ty
elif world.options.goal == 7:
connect(multiworld, player, names, LocationName.gate_0_region, LocationName.chaos_chao,
lambda state: (state.has_all(chao_animal_event_location_table.keys(), player)))
elif world.options.goal == 8:
connect(multiworld, player, names, LocationName.gate_0_region, LocationName.biolizard_region,
lambda state: (state.has_all(minigame_trap_table.keys(), player)))

for i in range(len(gates[0].gate_levels)):
connect(multiworld, player, names, LocationName.gate_0_region, shuffleable_regions[gates[0].gate_levels[i]])
Expand Down
19 changes: 12 additions & 7 deletions worlds/sa2b/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .AestheticData import chao_name_conversion, sample_chao_names, totally_real_item_names, \
all_exits, all_destinations, multi_rooms, single_rooms, room_to_exits_map, exit_to_room_map, valid_kindergarten_exits
from .GateBosses import get_gate_bosses, get_boss_rush_bosses, get_boss_name
from .Items import SA2BItem, ItemData, item_table, upgrades_table, emeralds_table, junk_table, trap_table, item_groups, \
from .Items import SA2BItem, ItemData, item_table, upgrades_table, emeralds_table, junk_table, minigame_trap_table, item_groups, \
eggs_table, fruits_table, seeds_table, hats_table, animals_table, chaos_drives_table
from .Locations import SA2BLocation, all_locations, setup_locations, chao_animal_event_location_table, black_market_location_table
from .Missions import get_mission_table, get_mission_count_table, get_first_and_last_cannons_core_missions
Expand Down Expand Up @@ -197,7 +197,7 @@ def create_regions(self):
# Not Generate Basic
self.black_market_costs = dict()

if self.options.goal.value in [0, 2, 4, 5, 6]:
if self.options.goal.value in [0, 2, 4, 5, 6, 8]:
self.multiworld.get_location(LocationName.finalhazard, self.player).place_locked_item(self.create_item(ItemName.maria))
elif self.options.goal.value == 1:
self.multiworld.get_location(LocationName.green_hill, self.player).place_locked_item(self.create_item(ItemName.maria))
Expand All @@ -222,13 +222,18 @@ def create_regions(self):
if self.options.goal.value != 3:
# Fill item pool with all required items
for item in {**upgrades_table}:
itempool += [self.create_item(item, False, self.options.goal.value)]
itempool += [self.create_item(item, None, self.options.goal.value)]

if self.options.goal.value in [1, 2, 6]:
# Some flavor of Chaos Emerald Hunt
for item in {**emeralds_table}:
itempool.append(self.create_item(item))

if self.options.goal.value in [8]:
# Minigame Madness
for item in {**minigame_trap_table}:
itempool.append(self.create_item(item, ItemClassification.progression | ItemClassification.trap))

# Black Market
itempool += [self.create_item(ItemName.market_token) for _ in range(self.options.black_market_slots.value)]

Expand Down Expand Up @@ -296,7 +301,7 @@ def create_regions(self):

non_required_emblems = (total_emblem_count - max_required_emblems)
junk_count = math.floor(non_required_emblems * (self.options.junk_fill_percentage.value / 100.0))
itempool += [self.create_item(ItemName.emblem, True) for _ in range(non_required_emblems - junk_count)]
itempool += [self.create_item(ItemName.emblem, ItemClassification.filler) for _ in range(non_required_emblems - junk_count)]

# Carve Traps out of junk_count
trap_weights = []
Expand Down Expand Up @@ -376,11 +381,11 @@ def create_regions(self):



def create_item(self, name: str, force_non_progression=False, goal=0) -> Item:
def create_item(self, name: str, force_classification=None, goal=0) -> Item:
data = item_table[name]

if force_non_progression:
classification = ItemClassification.filler
if force_classification is not None:
classification = force_classification
elif name == ItemName.emblem or \
name in emeralds_table.keys() or \
(name == ItemName.knuckles_shovel_claws and goal in [4, 5]):
Expand Down

0 comments on commit 3e4b91e

Please sign in to comment.