mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-08-07 15:16:19 -07:00
ALttP: Fix Randomzie Enemy Damage (#6296)
This commit is contained in:
@@ -385,10 +385,11 @@ def _randomize_enemy_damage(rom: "LocalRom", rng: random.Random, allow_zero_dama
|
||||
for sprite_id in range(0xF3):
|
||||
if sprite_id in EXCLUDED_ENEMY_TABLE_SPRITE_IDS:
|
||||
continue
|
||||
damage_address = ENEMY_DAMAGE_TABLE_ADDRESS + sprite_id
|
||||
new_damage = rng.randrange(8)
|
||||
if not allow_zero_damage and new_damage == 2:
|
||||
continue
|
||||
rom.write_byte(ENEMY_DAMAGE_TABLE_ADDRESS + sprite_id, new_damage)
|
||||
rom.write_byte(damage_address, (rom.read_byte(damage_address) & 0xF0) | new_damage)
|
||||
|
||||
|
||||
def _shuffle_damage_groups(
|
||||
|
||||
@@ -106,10 +106,12 @@ class TestEnemizerPatches(unittest.TestCase):
|
||||
|
||||
included_hp_sprite_id = 0x01
|
||||
included_damage_sprite_id = 0x02
|
||||
boss_damage_sprite_id = 0x53
|
||||
excluded_sprite_id = min(EXCLUDED_ENEMY_TABLE_SPRITE_IDS)
|
||||
rom.write_byte(ENEMY_HP_TABLE_ADDRESS + included_hp_sprite_id, 0x06)
|
||||
rom.write_byte(ENEMY_HP_TABLE_ADDRESS + excluded_sprite_id, 0x07)
|
||||
rom.write_byte(ENEMY_DAMAGE_TABLE_ADDRESS + included_damage_sprite_id, 0x06)
|
||||
rom.write_byte(ENEMY_DAMAGE_TABLE_ADDRESS + included_damage_sprite_id, 0x86)
|
||||
rom.write_byte(ENEMY_DAMAGE_TABLE_ADDRESS + boss_damage_sprite_id, 0x17)
|
||||
rom.write_byte(ENEMY_DAMAGE_TABLE_ADDRESS + excluded_sprite_id, 0x05)
|
||||
|
||||
world = self._build_world(
|
||||
@@ -133,7 +135,10 @@ class TestEnemizerPatches(unittest.TestCase):
|
||||
self.assertGreaterEqual(rom.read_byte(ENEMY_HP_TABLE_ADDRESS + included_hp_sprite_id), 2)
|
||||
self.assertLess(rom.read_byte(ENEMY_HP_TABLE_ADDRESS + included_hp_sprite_id), 25)
|
||||
self.assertEqual(rom.read_byte(ENEMY_HP_TABLE_ADDRESS + excluded_sprite_id), 0x07)
|
||||
self.assertIn(rom.read_byte(ENEMY_DAMAGE_TABLE_ADDRESS + included_damage_sprite_id), range(8))
|
||||
randomized_damage = rom.read_byte(ENEMY_DAMAGE_TABLE_ADDRESS + included_damage_sprite_id)
|
||||
self.assertEqual(randomized_damage & 0xF0, 0x80)
|
||||
self.assertIn(randomized_damage & 0x0F, range(8))
|
||||
self.assertEqual(rom.read_byte(ENEMY_DAMAGE_TABLE_ADDRESS + boss_damage_sprite_id), 0x17)
|
||||
self.assertEqual(rom.read_byte(ENEMY_DAMAGE_TABLE_ADDRESS + excluded_sprite_id), 0x05)
|
||||
for group_id in range(10):
|
||||
group_address = DAMAGE_GROUP_TABLE_ADDRESS + (group_id * 3)
|
||||
|
||||
Reference in New Issue
Block a user