Skip to content

Commit

Permalink
logic stuff for 1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLX5 committed Aug 9, 2024
1 parent aa4de5b commit 4e55510
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 21 deletions.
10 changes: 10 additions & 0 deletions worlds/mmx3/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,16 @@ async def handle_data_storage(self, ctx):
[{"operation": "replace", "value": arsenal}],
}])
self.save_arsenal = False

keys = {
f"mmx3_checkpoints_{ctx.team}_{ctx.slot}",
f"mmx3_global_timer_{ctx.team}_{ctx.slot}",
f"mmx3_deaths_{ctx.team}_{ctx.slot}",
f"mmx3_damage_dealt_{ctx.team}_{ctx.slot}",
f"mmx3_damage_taken_{ctx.team}_{ctx.slot}",
}
if not all(key in ctx.stored_data.keys() for key in keys):
return

# Checkpoints reached
checkpoints = list(await snes_read(ctx, MMX3_CHECKPOINTS_REACHED, 0xF))
Expand Down
2 changes: 2 additions & 0 deletions worlds/mmx3/Names/RegionName.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@

dr_doppler_lab_3 = "Dr. Doppler's Lab 3"
dr_doppler_lab_3_rematches = "Dr. Doppler's Lab 3 - Rematches"
dr_doppler_lab_3_after_rematches = "Dr. Doppler's Lab 3 - After Rematches"
dr_doppler_lab_3_boss = "Dr. Doppler's Lab 3 - Boss"

dr_doppler_lab_4 = "Dr. Doppler's Lab 4"
dr_doppler_lab_4_boss = "Dr. Doppler's Lab 4 - Sigma"
9 changes: 8 additions & 1 deletion worlds/mmx3/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@ class PlandoWeaknesses(OptionDict):
})
default = {}

class LogicHelmetCheckpoints(Toggle):
"""
Makes the "Use Any Checkpoint" feature from the Helmet Upgrade be in logic
"""
display_name = "Helmet Checkpoints In Logic"

mmx3_option_groups = [
OptionGroup("Gameplay Options", [
StartingLifeCount,
Expand All @@ -378,6 +384,7 @@ class PlandoWeaknesses(OptionDict):
DisableChargeFreeze,
LongJumps,
ZSaberInPool,
LogicHelmetCheckpoints,
]),
OptionGroup("Boss Weakness Options", [
BossWeaknessRando,
Expand Down Expand Up @@ -448,4 +455,4 @@ class MMX3Options(PerGameCommonOptions):
byte_medal_count: ByteMedalCount
logic_boss_weakness: LogicBossWeakness
logic_vile_required: LogicRequireVileDefeatForDoppler

logic_helmet_checkpoints: LogicHelmetCheckpoints
35 changes: 31 additions & 4 deletions worlds/mmx3/Regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ def create_regions(multiworld: MultiWorld, player: int, world: World, active_loc
dr_doppler_lab_2 = create_region(multiworld, player, active_locations, RegionName.dr_doppler_lab_2)
dr_doppler_lab_3 = create_region(multiworld, player, active_locations, RegionName.dr_doppler_lab_3)
dr_doppler_lab_3_rematches = create_region(multiworld, player, active_locations, RegionName.dr_doppler_lab_3_rematches)
dr_doppler_lab_3_after_rematches = create_region(multiworld, player, active_locations, RegionName.dr_doppler_lab_3_after_rematches)
dr_doppler_lab_3_boss = create_region(multiworld, player, active_locations, RegionName.dr_doppler_lab_3_boss)
dr_doppler_lab_4 = create_region(multiworld, player, active_locations, RegionName.dr_doppler_lab_4)
dr_doppler_lab_4_boss = create_region(multiworld, player, active_locations, RegionName.dr_doppler_lab_4_boss)

bit_byte = create_region(multiworld, player, active_locations, RegionName.bit_byte)

Expand Down Expand Up @@ -143,8 +145,10 @@ def create_regions(multiworld: MultiWorld, player: int, world: World, active_loc
dr_doppler_lab_2,
dr_doppler_lab_3,
dr_doppler_lab_3_rematches,
dr_doppler_lab_3_after_rematches,
dr_doppler_lab_3_boss,
dr_doppler_lab_4,
dr_doppler_lab_4_boss,
bit_byte,
]

Expand Down Expand Up @@ -247,7 +251,7 @@ def create_regions(multiworld: MultiWorld, player: int, world: World, active_loc
add_event_to_region(multiworld, player, RegionName.dr_doppler_lab_3_boss, EventName.dr_doppler_lab_3_clear)

# Dr. Doppler Lab 4
add_location_to_region(multiworld, player, active_locations, RegionName.dr_doppler_lab_4, LocationName.victory)
add_location_to_region(multiworld, player, active_locations, RegionName.dr_doppler_lab_4_boss, LocationName.victory)

# Vile
add_location_to_region(multiworld, player, active_locations, RegionName.vile_boss, LocationName.vile_stage_boss)
Expand Down Expand Up @@ -327,7 +331,7 @@ def create_regions(multiworld: MultiWorld, player: int, world: World, active_loc
add_location_to_region(multiworld, player, active_locations, RegionName.dr_doppler_lab_1, LocationName.doppler_lab_1_hp_2)

# Dr. Doppler Lab 3
add_location_to_region(multiworld, player, active_locations, RegionName.dr_doppler_lab_3_boss, LocationName.doppler_lab_3_hp)
add_location_to_region(multiworld, player, active_locations, RegionName.dr_doppler_lab_3_after_rematches, LocationName.doppler_lab_3_hp)

# Vile
add_location_to_region(multiworld, player, active_locations, RegionName.vile_before, LocationName.vile_stage_hp_1)
Expand Down Expand Up @@ -438,15 +442,38 @@ def connect_regions(world: World):
connect(world, RegionName.dr_doppler_lab, RegionName.dr_doppler_lab_2)
connect(world, RegionName.dr_doppler_lab, RegionName.dr_doppler_lab_3)
connect(world, RegionName.dr_doppler_lab, RegionName.dr_doppler_lab_4)
connect(world, RegionName.dr_doppler_lab_3_boss, RegionName.dr_doppler_lab_4)
else:
connect(world, RegionName.dr_doppler_lab, RegionName.dr_doppler_lab_1)
connect(world, RegionName.dr_doppler_lab_1, RegionName.dr_doppler_lab_2)
connect(world, RegionName.dr_doppler_lab_2, RegionName.dr_doppler_lab_3)
connect(world, RegionName.dr_doppler_lab_3_boss, RegionName.dr_doppler_lab_4)

connect(world, RegionName.dr_doppler_lab_3, RegionName.dr_doppler_lab_3_rematches)
connect(world, RegionName.dr_doppler_lab_3_rematches, RegionName.dr_doppler_lab_3_boss)
connect(world, RegionName.dr_doppler_lab_3_rematches, RegionName.dr_doppler_lab_3_after_rematches)
connect(world, RegionName.dr_doppler_lab_3_after_rematches, RegionName.dr_doppler_lab_3_boss)

connect(world, RegionName.dr_doppler_lab_4, RegionName.dr_doppler_lab_4_boss)

# Connect checkpoints
if world.options.logic_helmet_checkpoints.value:
# Connect Toxic Seahorse
connect(world, RegionName.toxic_seahorse, RegionName.toxic_seahorse_underwater)
connect(world, RegionName.toxic_seahorse, RegionName.toxic_seahorse_dam)

# Connect Tunnel Rhino
connect(world, RegionName.tunnel_rhino, RegionName.tunnel_rhino_wall_jump)
connect(world, RegionName.tunnel_rhino, RegionName.tunnel_rhino_climbing)

# Connect Neon Tiger
connect(world, RegionName.neon_tiger, RegionName.neon_tiger_bit_byte)
connect(world, RegionName.neon_tiger, RegionName.neon_tiger_hill)

# Connect Blast Hornet
connect(world, RegionName.blast_hornet, RegionName.blast_hornet_outside)

# Connect Dr. Doppler Lab levels
connect(world, RegionName.dr_doppler_lab_3, RegionName.dr_doppler_lab_3_after_rematches)


def create_region(multiworld: MultiWorld, player: int, active_locations, name: str, locations=None):
ret = Region(name, player, multiworld)
Expand Down
71 changes: 57 additions & 14 deletions worlds/mmx3/Rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,20 @@
"Vile": [
f"{RegionName.vile_before} -> {RegionName.vile_boss}",
],
"Press Disposer": [
"Dr. Doppler's Lab 1 Boss": [
LocationName.doppler_lab_1_boss,
EventName.dr_doppler_lab_1_clear
],
"Godkarmachine": [
LocationName.doppler_lab_1_boss,
EventName.dr_doppler_lab_1_clear
],
"Dr. Doppler's Lab 2 Boss": [
LocationName.doppler_lab_2_boss,
EventName.dr_doppler_lab_2_clear
],
"Dr. Doppler's Lab 2 Boss": [],
"Doppler": [
LocationName.doppler_lab_3_boss,
f"{RegionName.dr_doppler_lab_3_after_rematches} -> {RegionName.dr_doppler_lab_3_boss}",
EventName.dr_doppler_lab_3_clear
],
"Sigma": [
f"{RegionName.dr_doppler_lab_3_boss} -> {RegionName.dr_doppler_lab_4}"
f"{RegionName.dr_doppler_lab_4} -> {RegionName.dr_doppler_lab_4_boss}"
],
"Kaiser Sigma": [
f"{RegionName.dr_doppler_lab_3_boss} -> {RegionName.dr_doppler_lab_4}"
f"{RegionName.dr_doppler_lab_4} -> {RegionName.dr_doppler_lab_4_boss}"
]
}

Expand Down Expand Up @@ -166,7 +159,7 @@ def set_rules(world: MMX3World):

# Set Boss rematch rules
if world.options.doppler_lab_3_boss_rematch_count.value > 0:
set_rule(multiworld.get_entrance(f"{RegionName.dr_doppler_lab_3_rematches} -> {RegionName.dr_doppler_lab_3_boss}", player),
set_rule(multiworld.get_entrance(f"{RegionName.dr_doppler_lab_3_rematches} -> {RegionName.dr_doppler_lab_3_after_rematches}", player),
lambda state: state.has(EventName.boss_rematch_clear, player, world.options.doppler_lab_3_boss_rematch_count.value))

# Vile entrance rules
Expand Down Expand Up @@ -226,7 +219,8 @@ def set_rules(world: MMX3World):

# Set Byte rules
set_rule(multiworld.get_location(LocationName.byte_defeat, player),
lambda state: state.has(ItemName.maverick_medal, player, world.options.byte_medal_count.value))
lambda state: state.has(ItemName.maverick_medal, player, world.options.byte_medal_count.value) and
state.can_reach_location(LocationName.bit_defeat, player))
set_rule(multiworld.get_location(EventName.byte_defeated, player),
lambda state: state.has(ItemName.maverick_medal, player, world.options.byte_medal_count.value))

Expand Down Expand Up @@ -335,6 +329,10 @@ def set_rules(world: MMX3World):
if world.options.pickupsanity.value:
add_pickupsanity_logic(world)

# Handle helmet logic
if world.options.logic_helmet_checkpoints.value:
add_helmet_logic(world)


def check_weaknesses(state: CollectionState, player: int, rulesets: list) -> bool:
states = list()
Expand All @@ -352,10 +350,31 @@ def add_boss_weakness_logic(world: MMX3World):
boss_dict = {}
for boss, regions in bosses.items():
boss_dict[boss] = regions.copy()

if boss in mavericks and world.options.doppler_lab_3_boss_rematch_count.value == 0:
boss_dict[boss].pop()
boss_dict[boss].pop()

if boss == "Dr. Doppler's Lab 1 Boss":
world.boss_weaknesses["Dr. Doppler's Lab 1 Boss"] = list()
for weakness in world.boss_weaknesses["Godkarmachine"]:
world.boss_weaknesses["Dr. Doppler's Lab 1 Boss"].append(weakness)
for weakness in world.boss_weaknesses["Press Disposer"]:
world.boss_weaknesses["Dr. Doppler's Lab 1 Boss"].append(weakness)

if boss == "Dr. Doppler's Lab 2 Boss":
if world.options.doppler_lab_2_boss == "vile":
boss_dict["Vile Goliath"] = list()
boss_dict["Vile Goliath"].append(LocationName.doppler_lab_2_boss)
boss_dict["Vile Goliath"].append(EventName.dr_doppler_lab_2_clear)
boss_dict["Vile"].append(LocationName.doppler_lab_2_boss)
boss_dict["Vile"].append(EventName.dr_doppler_lab_2_clear)
else:
boss_dict["Volt Kurageil"] = list()
boss_dict["Volt Kurageil"].append(LocationName.doppler_lab_2_boss)
boss_dict["Volt Kurageil"].append(EventName.dr_doppler_lab_2_clear)
del boss_dict["Dr. Doppler's Lab 2 Boss"]

for boss, regions in boss_dict.items():
weaknesses = world.boss_weaknesses[boss]
rulesets = list()
Expand Down Expand Up @@ -405,3 +424,27 @@ def add_pickupsanity_logic(world: MMX3World):
set_rule(multiworld.get_location(LocationName.crush_crawfish_1up_2, player),
lambda state: state.has(ItemName.tornado_fang, player))

def add_helmet_logic(world: MMX3World):
player = world.player
multiworld = world.multiworld

set_rule(multiworld.get_entrance(f"{RegionName.toxic_seahorse} -> {RegionName.toxic_seahorse_underwater}", player),
lambda state: state.has(ItemName.third_armor_helmet, player, 1))
set_rule(multiworld.get_entrance(f"{RegionName.toxic_seahorse} -> {RegionName.toxic_seahorse_dam}", player),
lambda state: state.has(ItemName.third_armor_helmet, player, 1))

set_rule(multiworld.get_entrance(f"{RegionName.tunnel_rhino} -> {RegionName.tunnel_rhino_wall_jump}", player),
lambda state: state.has(ItemName.third_armor_helmet, player, 1))
set_rule(multiworld.get_entrance(f"{RegionName.tunnel_rhino} -> {RegionName.tunnel_rhino_climbing}", player),
lambda state: state.has(ItemName.third_armor_helmet, player, 1))

set_rule(multiworld.get_entrance(f"{RegionName.neon_tiger} -> {RegionName.neon_tiger_bit_byte}", player),
lambda state: state.has(ItemName.third_armor_helmet, player, 1))
set_rule(multiworld.get_entrance(f"{RegionName.neon_tiger} -> {RegionName.neon_tiger_hill}", player),
lambda state: state.has(ItemName.third_armor_helmet, player, 1))

set_rule(multiworld.get_entrance(f"{RegionName.blast_hornet} -> {RegionName.blast_hornet_outside}", player),
lambda state: state.has(ItemName.third_armor_helmet, player, 1))

set_rule(multiworld.get_entrance(f"{RegionName.dr_doppler_lab_3} -> {RegionName.dr_doppler_lab_3_after_rematches}", player),
lambda state: state.has(ItemName.third_armor_helmet, player, 1))
2 changes: 1 addition & 1 deletion worlds/mmx3/Weaknesses.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ def handle_weaknesses(world):
if world.options.doppler_lab_2_boss == "volt_kurageil":
world.boss_weaknesses["Dr. Doppler's Lab 2 Boss"] = world.boss_weaknesses["Volt Kurageil"].copy()
else:
world.boss_weaknesses["Dr. Doppler's Lab 2 Boss"] = []
world.boss_weaknesses["Dr. Doppler's Lab 2 Boss"] = list()
for weakness in world.boss_weaknesses["Vile"]:
world.boss_weaknesses["Dr. Doppler's Lab 2 Boss"].append(weakness)
for weakness in world.boss_weaknesses["Vile Goliath"]:
Expand Down
5 changes: 4 additions & 1 deletion worlds/mmx3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ def create_regions(self) -> None:
itempool += [self.create_item(ItemName.third_armor_body) for _ in range(2)]
itempool += [self.create_item(ItemName.third_armor_arms) for _ in range(2 + self.options.jammed_buster.value)]
else:
itempool += [self.create_item(ItemName.third_armor_helmet, ItemClassification.useful) for _ in range(2)]
if self.options.logic_helmet_checkpoints.value:
itempool += [self.create_item(ItemName.third_armor_helmet) for _ in range(2)]
else:
itempool += [self.create_item(ItemName.third_armor_helmet, ItemClassification.useful) for _ in range(2)]
itempool += [self.create_item(ItemName.third_armor_body, ItemClassification.useful) for _ in range(2)]
itempool += [self.create_item(ItemName.third_armor_arms, ItemClassification.useful)]
itempool += [self.create_item(ItemName.third_armor_arms) for _ in range(1 + self.options.jammed_buster.value)]
Expand Down
Binary file modified worlds/mmx3/data/mmx3_basepatch.bsdiff4
Binary file not shown.

0 comments on commit 4e55510

Please sign in to comment.