Archipelago/worlds/mm2/locations.py

240 lines
7.3 KiB
Python
Raw Normal View History

Mega Man 2: Implement New Game (#3256) * initial (broken) commit * small work on init * Update Items.py * beginning work, some rom patches * commit progress from bh branch * deathlink, fix soft-reset kill, e-tank loss * begin work on targeting new bhclient * write font * definitely didn't forget to add the other two hashes no * update to modern options, begin colors * fix 6th letter bug * palette shuffle + logic rewrite * fix a bunch of pointers * fix color changes, deathlink, and add wily 5 req * adjust weapon weakness generation * Update Rules.py * attempt wily 5 softlock fix * add explicit test for rbm weaknesses * fix difficulty and hard reset * fix connect deathlink and off by one item color * fix atomic fire again * de-jank deathlink * rewrite wily5 rule * fix rare solo-gen fill issue, hopefully * Update Client.py * fix wily 5 requirements * undo fill hook * fix picopico-kun rules * for real this time * update minimum damage requirement * begin move to procedure patch * finish move to APPP, allow rando boobeam, color updates * fix color bug, UT support? * what do you mean I forgot the procedure * fix UT? * plando weakness and fixes * sfx when item received, more time stopper edge cases * Update test_weakness.py * fix rules and color bug * fix color bug, support reduced flashing * major world overhaul * Update Locations.py * fix first found bugs * mypy cleanup * headerless roms * Update Rom.py * further cleanup * work on energylink * el fixes * update to energylink 2.0 packet * energylink balancing * potentially break other clients, more balancing * Update Items.py * remove startup change from basepatch we write that in patch, since we also need to clean the area before applying * el balancing and feedback * hopefully less test failures? * implement world version check * add weapon/health option * Update Rom.py * x/x2 * specials * Update Color.py * Update Options.py * finally apply location groups * bump minor version number instead * fix duplicate stage sends * validate wily 5, tests * see if renaming fixes * add shuffled weakness * remove passwords * refresh rbm select, fix wily 5 validation * forgot we can't check 0 * oops I broke the basepatch (remove failing test later) * fix solo gen fill error? * fix webhost patch recognition * fix imports, basepatch * move to flexibility metric for boss validation * special case boobeam trap * block strobe on stage select init * more energylink balancing * bump world version * wily HP inaccurate in validation * fix validation edge case * save last completed wily to data storage * mypy and pep8 cleanup * fix file browse validation * fix test failure, add enemy weakness * remove test seed * update enemy damage * inno setup * Update en_Mega Man 2.md * setup guide * Update en_Mega Man 2.md * finish plando weakness section * starting rbm edge case * remove * imports * properly wrap later weakness additions in regen playthrough * fix import * forgot readme * remove time stopper special casing since we moved to proper wily 5 validation, this special casing is no longer important * properly type added locations * Update CODEOWNERS * add animation reduction * deprioritize Time Stopper in rush checks * special case wily phase 1 * fix key error * forgot the test * music and general cleanup * the great rename * fix import * thanks pycharm * reorder palette shuffle * account for alien on shuffled weakness * apply suggestions * fix seedbleed * fix invalid buster passthrough * fix weakness landing beneath required amount * fix failsafe * finish music * fix Time Stopper on Flash/Alien * asar pls * Apply suggestions from code review Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> * world helpers * init cleanup * apostrophes * clearer wording * mypy and cleanup * options doc cleanup * Update rom.py * rules cleanup * Update __init__.py * Update __init__.py * move to defaultdict * cleanup world helpers * Update __init__.py * remove unnecessary line from fill hook * forgot the other one * apply code review * remove collect * Update rules.py * forgot another --------- Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
2024-08-20 02:59:29 +00:00
from BaseClasses import Location, Region
from typing import Dict, Tuple, Optional
from . import names
class MM2Location(Location):
game = "Mega Man 2"
class MM2Region(Region):
game = "Mega Man 2"
heat_man_locations: Dict[str, Optional[int]] = {
names.heat_man: 0x880001,
names.atomic_fire_get: 0x880101,
names.item_1_get: 0x880111,
}
air_man_locations: Dict[str, Optional[int]] = {
names.air_man: 0x880002,
names.air_shooter_get: 0x880102,
names.item_2_get: 0x880112
}
wood_man_locations: Dict[str, Optional[int]] = {
names.wood_man: 0x880003,
names.leaf_shield_get: 0x880103
}
bubble_man_locations: Dict[str, Optional[int]] = {
names.bubble_man: 0x880004,
names.bubble_lead_get: 0x880104
}
quick_man_locations: Dict[str, Optional[int]] = {
names.quick_man: 0x880005,
names.quick_boomerang_get: 0x880105,
}
flash_man_locations: Dict[str, Optional[int]] = {
names.flash_man: 0x880006,
names.time_stopper_get: 0x880106,
names.item_3_get: 0x880113,
}
metal_man_locations: Dict[str, Optional[int]] = {
names.metal_man: 0x880007,
names.metal_blade_get: 0x880107
}
crash_man_locations: Dict[str, Optional[int]] = {
names.crash_man: 0x880008,
names.crash_bomber_get: 0x880108
}
wily_1_locations: Dict[str, Optional[int]] = {
names.wily_1: 0x880009,
names.wily_stage_1: None
}
wily_2_locations: Dict[str, Optional[int]] = {
names.wily_2: 0x88000A,
names.wily_stage_2: None
}
wily_3_locations: Dict[str, Optional[int]] = {
names.wily_3: 0x88000B,
names.wily_stage_3: None
}
wily_4_locations: Dict[str, Optional[int]] = {
names.wily_4: 0x88000C,
names.wily_stage_4: None
}
wily_5_locations: Dict[str, Optional[int]] = {
names.wily_5: 0x88000D,
names.wily_stage_5: None
}
wily_6_locations: Dict[str, Optional[int]] = {
names.dr_wily: None
}
etank_1ups: Dict[str, Dict[str, Optional[int]]] = {
"Heat Man Stage": {
names.heat_man_c1: 0x880201,
},
"Quick Man Stage": {
names.quick_man_c1: 0x880202,
names.quick_man_c2: 0x880203,
names.quick_man_c3: 0x880204,
names.quick_man_c7: 0x880208,
},
"Flash Man Stage": {
names.flash_man_c2: 0x88020B,
names.flash_man_c6: 0x88020F,
},
"Metal Man Stage": {
names.metal_man_c1: 0x880210,
names.metal_man_c2: 0x880211,
names.metal_man_c3: 0x880212,
},
"Crash Man Stage": {
names.crash_man_c2: 0x880214,
names.crash_man_c3: 0x880215,
},
"Wily Stage 1": {
names.wily_1_c1: 0x880216,
},
"Wily Stage 2": {
names.wily_2_c3: 0x88021A,
names.wily_2_c4: 0x88021B,
names.wily_2_c5: 0x88021C,
names.wily_2_c6: 0x88021D,
},
"Wily Stage 3": {
names.wily_3_c2: 0x880220,
},
"Wily Stage 4": {
names.wily_4_c3: 0x880225,
names.wily_4_c4: 0x880226,
}
}
energy_pickups: Dict[str, Dict[str, Optional[int]]] = {
"Quick Man Stage": {
names.quick_man_c4: 0x880205,
names.quick_man_c5: 0x880206,
names.quick_man_c6: 0x880207,
names.quick_man_c8: 0x880209,
},
"Flash Man Stage": {
names.flash_man_c1: 0x88020A,
names.flash_man_c3: 0x88020C,
names.flash_man_c4: 0x88020D,
names.flash_man_c5: 0x88020E,
},
"Crash Man Stage": {
names.crash_man_c1: 0x880213,
},
"Wily Stage 1": {
names.wily_1_c2: 0x880217,
},
"Wily Stage 2": {
names.wily_2_c1: 0x880218,
names.wily_2_c2: 0x880219,
names.wily_2_c7: 0x88021E,
names.wily_2_c8: 0x880227,
names.wily_2_c9: 0x880228,
names.wily_2_c10: 0x880229,
names.wily_2_c11: 0x88022A,
names.wily_2_c12: 0x88022B,
names.wily_2_c13: 0x88022C,
names.wily_2_c14: 0x88022D,
names.wily_2_c15: 0x88022E,
names.wily_2_c16: 0x88022F,
},
"Wily Stage 3": {
names.wily_3_c1: 0x88021F,
names.wily_3_c3: 0x880221,
names.wily_3_c4: 0x880222,
},
"Wily Stage 4": {
names.wily_4_c1: 0x880223,
names.wily_4_c2: 0x880224,
}
}
mm2_regions: Dict[str, Tuple[Tuple[str, ...], Dict[str, Optional[int]], Optional[str]]] = {
"Heat Man Stage": ((names.heat_man_stage,), heat_man_locations, None),
"Air Man Stage": ((names.air_man_stage,), air_man_locations, None),
"Wood Man Stage": ((names.wood_man_stage,), wood_man_locations, None),
"Bubble Man Stage": ((names.bubble_man_stage,), bubble_man_locations, None),
"Quick Man Stage": ((names.quick_man_stage,), quick_man_locations, None),
"Flash Man Stage": ((names.flash_man_stage,), flash_man_locations, None),
"Metal Man Stage": ((names.metal_man_stage,), metal_man_locations, None),
"Crash Man Stage": ((names.crash_man_stage,), crash_man_locations, None),
"Wily Stage 1": ((names.item_1, names.item_2, names.item_3), wily_1_locations, None),
"Wily Stage 2": ((names.wily_stage_1,), wily_2_locations, "Wily Stage 1"),
"Wily Stage 3": ((names.wily_stage_2,), wily_3_locations, "Wily Stage 2"),
"Wily Stage 4": ((names.wily_stage_3,), wily_4_locations, "Wily Stage 3"),
"Wily Stage 5": ((names.wily_stage_4,), wily_5_locations, "Wily Stage 4"),
"Wily Stage 6": ((names.wily_stage_5,), wily_6_locations, "Wily Stage 5")
}
location_table: Dict[str, Optional[int]] = {
**heat_man_locations,
**air_man_locations,
**wood_man_locations,
**bubble_man_locations,
**quick_man_locations,
**flash_man_locations,
**metal_man_locations,
**crash_man_locations,
**wily_1_locations,
**wily_2_locations,
**wily_3_locations,
**wily_4_locations,
**wily_5_locations,
}
for table in etank_1ups:
location_table.update(etank_1ups[table])
for table in energy_pickups:
location_table.update(energy_pickups[table])
location_groups = {
"Get Equipped": {
names.atomic_fire_get,
names.air_shooter_get,
names.leaf_shield_get,
names.bubble_lead_get,
names.quick_boomerang_get,
names.time_stopper_get,
names.metal_blade_get,
names.crash_bomber_get,
names.item_1_get,
names.item_2_get,
names.item_3_get
},
"Heat Man Stage": {*heat_man_locations.keys(), *etank_1ups["Heat Man Stage"].keys()},
"Air Man Stage": {*air_man_locations.keys()},
"Wood Man Stage": {*wood_man_locations.keys()},
"Bubble Man Stage": {*bubble_man_locations.keys()},
"Quick Man Stage": {*quick_man_locations.keys(), *etank_1ups["Quick Man Stage"].keys(),
*energy_pickups["Quick Man Stage"].keys()},
"Flash Man Stage": {*flash_man_locations.keys(), *etank_1ups["Flash Man Stage"].keys(),
*energy_pickups["Flash Man Stage"].keys()},
"Metal Man Stage": {*metal_man_locations.keys(), *etank_1ups["Metal Man Stage"].keys()},
"Crash Man Stage": {*crash_man_locations.keys(), *etank_1ups["Crash Man Stage"].keys(),
*energy_pickups["Crash Man Stage"].keys()},
"Wily 2 Weapon Energy": {names.wily_2_c8, names.wily_2_c9, names.wily_2_c10, names.wily_2_c11, names.wily_2_c12,
names.wily_2_c13, names.wily_2_c14, names.wily_2_c15, names.wily_2_c16}
}
lookup_location_to_id: Dict[str, int] = {location: idx for location, idx in location_table.items() if idx is not None}