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 typing import DefaultDict
|
|
|
|
from collections import defaultdict
|
|
|
|
|
2024-11-18 01:22:25 +00:00
|
|
|
MM2_WEAPON_ENCODING: DefaultDict[str, int] = defaultdict(lambda: 0x6F, {
|
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
|
|
|
' ': 0x40,
|
|
|
|
'A': 0x41,
|
|
|
|
'B': 0x42,
|
|
|
|
'C': 0x43,
|
|
|
|
'D': 0x44,
|
|
|
|
'E': 0x45,
|
|
|
|
'F': 0x46,
|
|
|
|
'G': 0x47,
|
|
|
|
'H': 0x48,
|
|
|
|
'I': 0x49,
|
|
|
|
'J': 0x4A,
|
|
|
|
'K': 0x4B,
|
|
|
|
'L': 0x4C,
|
|
|
|
'M': 0x4D,
|
|
|
|
'N': 0x4E,
|
|
|
|
'O': 0x4F,
|
|
|
|
'P': 0x50,
|
|
|
|
'Q': 0x51,
|
|
|
|
'R': 0x52,
|
|
|
|
'S': 0x53,
|
|
|
|
'T': 0x54,
|
|
|
|
'U': 0x55,
|
|
|
|
'V': 0x56,
|
|
|
|
'W': 0x57,
|
|
|
|
'X': 0x58,
|
|
|
|
'Y': 0x59,
|
|
|
|
'Z': 0x5A,
|
|
|
|
# 0x5B is the small r in Dr Light
|
|
|
|
'.': 0x5C,
|
|
|
|
',': 0x5D,
|
|
|
|
'\'': 0x5E,
|
|
|
|
'!': 0x5F,
|
|
|
|
'(': 0x60,
|
|
|
|
')': 0x61,
|
|
|
|
'#': 0x62,
|
|
|
|
'$': 0x63,
|
|
|
|
'%': 0x64,
|
|
|
|
'&': 0x65,
|
|
|
|
'*': 0x66,
|
|
|
|
'+': 0x67,
|
|
|
|
'/': 0x68,
|
|
|
|
'\\': 0x69,
|
|
|
|
':': 0x6A,
|
|
|
|
';': 0x6B,
|
|
|
|
'<': 0x6C,
|
|
|
|
'>': 0x6D,
|
|
|
|
'=': 0x6E,
|
|
|
|
'?': 0x6F,
|
|
|
|
'@': 0x70,
|
|
|
|
'[': 0x71,
|
|
|
|
']': 0x72,
|
|
|
|
'^': 0x73,
|
|
|
|
'_': 0x74,
|
|
|
|
'`': 0x75,
|
|
|
|
'{': 0x76,
|
|
|
|
'}': 0x77,
|
|
|
|
'|': 0x78,
|
|
|
|
'~': 0x79,
|
|
|
|
'\"': 0x92,
|
|
|
|
'-': 0x94,
|
|
|
|
'0': 0xA0,
|
|
|
|
'1': 0xA1,
|
|
|
|
'2': 0xA2,
|
|
|
|
'3': 0xA3,
|
|
|
|
'4': 0xA4,
|
|
|
|
'5': 0xA5,
|
|
|
|
'6': 0xA6,
|
|
|
|
'7': 0xA7,
|
|
|
|
'8': 0xA8,
|
|
|
|
'9': 0xA9,
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
class MM2TextEntry:
|
|
|
|
def __init__(self, text: str = "", coords: int = 0x0B):
|
|
|
|
self.target_area: int = 0x25 # don't change
|
|
|
|
self.coords: int = coords # 0xYX, Y can only be increments of 0x20
|
|
|
|
self.text: str = text
|
|
|
|
|
|
|
|
def resolve(self) -> bytes:
|
|
|
|
data = bytearray()
|
|
|
|
data.append(self.target_area)
|
|
|
|
data.append(self.coords)
|
|
|
|
data.extend([MM2_WEAPON_ENCODING[x] for x in self.text.upper()])
|
|
|
|
data.extend([0x40] * (14 - len(self.text)))
|
|
|
|
return bytes(data)
|