Files
Grinch-AP/worlds/mm2/items.py

73 lines
2.1 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-19 21:59:29 -05:00
from BaseClasses import Item
from typing import NamedTuple, Dict
from . import names
class ItemData(NamedTuple):
code: int
progression: bool
useful: bool = False # primarily use this for incredibly useful items of their class, like Metal Blade
skip_balancing: bool = False
class MM2Item(Item):
game = "Mega Man 2"
robot_master_weapon_table = {
names.atomic_fire: ItemData(0x880001, True),
names.air_shooter: ItemData(0x880002, True),
names.leaf_shield: ItemData(0x880003, True),
names.bubble_lead: ItemData(0x880004, True),
names.quick_boomerang: ItemData(0x880005, True),
names.time_stopper: ItemData(0x880006, True, True),
names.metal_blade: ItemData(0x880007, True, True),
names.crash_bomber: ItemData(0x880008, True),
}
stage_access_table = {
names.heat_man_stage: ItemData(0x880101, True),
names.air_man_stage: ItemData(0x880102, True),
names.wood_man_stage: ItemData(0x880103, True),
names.bubble_man_stage: ItemData(0x880104, True),
names.quick_man_stage: ItemData(0x880105, True),
names.flash_man_stage: ItemData(0x880106, True),
names.metal_man_stage: ItemData(0x880107, True),
names.crash_man_stage: ItemData(0x880108, True),
}
item_item_table = {
names.item_1: ItemData(0x880011, True, True, True),
names.item_2: ItemData(0x880012, True, True, True),
names.item_3: ItemData(0x880013, True, True, True)
}
filler_item_table = {
names.one_up: ItemData(0x880020, False),
names.weapon_energy: ItemData(0x880021, False),
names.health_energy: ItemData(0x880022, False),
names.e_tank: ItemData(0x880023, False, True),
}
filler_item_weights = {
names.one_up: 1,
names.weapon_energy: 4,
names.health_energy: 1,
names.e_tank: 2,
}
item_table = {
**robot_master_weapon_table,
**stage_access_table,
**item_item_table,
**filler_item_table,
}
item_names = {
"Weapons": {name for name in robot_master_weapon_table.keys()},
"Stages": {name for name in stage_access_table.keys()},
"Items": {name for name in item_item_table.keys()}
}
lookup_item_to_id: Dict[str, int] = {item_name: data.code for item_name, data in item_table.items()}