Fix item duping and disappearing

Fix mutliworld crash
Fix assured sword + start inventory
New bans on enemy placement
This commit is contained in:
aerinon
2023-09-14 08:51:29 -06:00
parent b37bcc987a
commit 26c26acd6e
9 changed files with 52 additions and 33 deletions

View File

@@ -358,6 +358,10 @@ def filter_choices(options, room_id, sprite_idx, denials):
return [x for x in options if key not in denials or x.sprite not in denials[key]]
def filter_water_phobic(options, sprite):
return [x for x in options if not x.water_phobic or not sprite.water]
def randomize_overworld_enemies(data_tables, custom_ow):
ow_candidates, ow_sheets, all_sheets = find_candidate_sprites(data_tables, range(1, 64), False)
areas_to_randomize = [0, 2, 3, 5, 7, 0xA, 0xF, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
@@ -382,6 +386,7 @@ def randomize_overworld_enemies(data_tables, custom_ow):
sprite.kind = sprite_translation[custom_ow[area_id][i]]
else:
candidate_sprites = filter_choices(candidate_sprites, area_id, i, data_tables.ow_enemy_denials)
candidate_sprites = filter_water_phobic(candidate_sprites, sprite)
weight = [data_tables.ow_weights[r.sprite] for r in candidate_sprites]
chosen = random.choices(candidate_sprites, weight, k=1)[0]
sprite.kind = chosen.sprite

View File

@@ -20,6 +20,7 @@ class SpriteRequirement:
self.ow_valid = True
self.uw_valid = True
self.can_randomize = True
self.water_phobic = False
self.groups = []
self.sub_groups = defaultdict(list)
@@ -77,6 +78,10 @@ class SpriteRequirement:
self.water_only = True
return self
def aquaphobia(self):
self.water_phobic = True
return self
def skip(self):
self.dont_use = True
return self
@@ -290,7 +295,7 @@ def init_sprite_requirements():
.allow(WallmasterValidRooms),
SpriteRequirement(EnemySprite.StalfosKnight).sub_group(1, 0x20).exclude({0x10c}),
SpriteRequirement(EnemySprite.HelmasaurKing).exalt().sub_group(2, 0x3a).sub_group(3, 0x3e),
SpriteRequirement(EnemySprite.Bumper).immune().sub_group(3, [0x52, 0x53]),
SpriteRequirement(EnemySprite.Bumper).immune().aquaphobia().sub_group(3, [0x52, 0x53]),
SpriteRequirement(EnemySprite.LaserEyeLeft).affix().sub_group(3, [0x52, 0x53]),
SpriteRequirement(EnemySprite.LaserEyeRight).affix().sub_group(3, [0x52, 0x53]),
SpriteRequirement(EnemySprite.LaserEyeTop).affix().sub_group(3, [0x52, 0x53]),

View File

@@ -34,8 +34,10 @@ UwGeneralDeny:
- [ 0x0021, 4, [ "RollerVerticalDown", "RollerVerticalUp" ] ] #"Sewers - Dark U - Rat 3"
- [ 0x0024, 6, [ "Wizzrobe" ] ] # Wizzrobes can't spawn on pots
- [ 0x0026, 1, [ "SparkCW", "SparkCCW", "RollerVerticalDown", "RollerVerticalUp", "RollerHorizontalRight", "RollerHorizontalLeft", "Beamos", "AntiFairyCircle", "BigSpike", "SpikeBlock", "Bumper" ] ] #"Swamp Palace - Big Spoon - Red Bari 1"
- [ 0x0026, 8, [ "AntiFairyCircle", "Bumper" ] ] #"Swamp Palace - Big Spoon - Red Bari 3"
- [ 0x0026, 9, [ "RollerHorizontalRight" ] ] #"Swamp Palace - Big Spoon - Kyameron"
- [ 0x0026, 8, [ "AntiFairyCircle", "Bumper", "Statue" ] ] #"Swamp Palace - Big Spoon - Red Bari 3"
- [ 0x0026, 9, [ "RollerHorizontalRight", "Statue" ] ] #"Swamp Palace - Big Spoon - Kyameron"
- [ 0x0026, 10, [ "Statue" ] ] # multiple push statues in this room can cause issues
- [ 0x0026, 11, [ "Statue" ] ] # multiple push statues in this room can cause issues
- [ 0x0027, 0, [ "SparkCW", "SparkCCW", "RollerVerticalDown", "RollerVerticalUp", "RollerHorizontalLeft", "FirebarCW" ] ] #"Tower Of Hera - Petting Zoo - Mini Moldorm 1"
- [ 0x0027, 1, [ "RollerVerticalDown", "RollerVerticalUp", "RollerHorizontalRight", "RollerHorizontalLeft", "AntiFairyCircle", "SpikeBlock", "Bumper" ] ] #"Tower Of Hera - Petting Zoo - Mini Moldorm 2"
- [ 0x0027, 2, [ "RollerVerticalDown", "RollerVerticalUp", "RollerHorizontalRight", "RollerHorizontalLeft", "AntiFairyCircle", "SpikeBlock", "Bumper" ] ] #"Tower Of Hera - Petting Zoo - Mini Moldorm 3"
@@ -350,43 +352,43 @@ UwEnemyDrop:
- [0x010C, 2, ["StalfosKnight", "Geldman", "Blob"]]
- [0x010C, 3, ["StalfosKnight", "Geldman", "Blob"]]
# the following are not allowed at certain pits
# because they despawned or clipped away or immediately fell
# because they despawned or clipped away or immediately fell, etc
- [0x007f, 0, ["HardhatBeetle", "Wizzrobe", "MiniHelmasaur", "BlueGuard", "GreenGuard", "RedSpearGuard",
"BluesainBolt", "UsainBolt", "BlueArcher", "GreenBushGuard", "RedJavelinGuard", "RedBushGuard",
"BombGuard", "GreenKnifeGuard"]]
"BombGuard", "GreenKnifeGuard", "Stal"]]
- [0x007f, 1, ["HardhatBeetle", "Wizzrobe", "MiniHelmasaur", "BlueGuard", "GreenGuard", "RedSpearGuard",
"BluesainBolt", "UsainBolt", "BlueArcher", "GreenBushGuard", "RedJavelinGuard", "RedBushGuard",
"BombGuard", "GreenKnifeGuard"]]
"BombGuard", "GreenKnifeGuard", "Stal"]]
- [0x007f, 2, ["HardhatBeetle", "Wizzrobe", "MiniHelmasaur", "BlueGuard", "GreenGuard", "RedSpearGuard",
"BluesainBolt", "UsainBolt", "BlueArcher", "GreenBushGuard", "RedJavelinGuard", "RedBushGuard",
"BombGuard", "GreenKnifeGuard"]]
"BombGuard", "GreenKnifeGuard", "Stal"]]
- [0x007f, 3, ["HardhatBeetle", "Wizzrobe", "MiniHelmasaur", "BlueGuard", "GreenGuard", "RedSpearGuard",
"BluesainBolt", "UsainBolt", "BlueArcher", "GreenBushGuard", "RedJavelinGuard", "RedBushGuard",
"BombGuard", "GreenKnifeGuard"]]
"BombGuard", "GreenKnifeGuard", "Stal"]]
- [0x00b5, 0, ["HardhatBeetle", "Wizzrobe", "MiniHelmasaur", "BlueGuard", "GreenGuard", "RedSpearGuard",
"BluesainBolt", "UsainBolt", "BlueArcher", "GreenBushGuard", "RedJavelinGuard", "RedBushGuard",
"BombGuard", "GreenKnifeGuard"]]
"BombGuard", "GreenKnifeGuard", "Stal"]]
- [0x00b5, 1, ["HardhatBeetle", "Wizzrobe", "MiniHelmasaur", "BlueGuard", "GreenGuard", "RedSpearGuard",
"BluesainBolt", "UsainBolt", "BlueArcher", "GreenBushGuard", "RedJavelinGuard", "RedBushGuard",
"BombGuard", "GreenKnifeGuard"]]
"BombGuard", "GreenKnifeGuard", "Stal"]]
- [0x00b5, 2, ["HardhatBeetle", "Wizzrobe", "MiniHelmasaur", "BlueGuard", "GreenGuard", "RedSpearGuard",
"BluesainBolt", "UsainBolt", "BlueArcher", "GreenBushGuard", "RedJavelinGuard", "RedBushGuard",
"BombGuard", "GreenKnifeGuard"]]
"BombGuard", "GreenKnifeGuard", "Stal"]]
- [0x00c6, 2, ["HardhatBeetle", "Wizzrobe", "MiniHelmasaur", "BlueGuard", "GreenGuard", "RedSpearGuard",
"BluesainBolt", "UsainBolt", "BlueArcher", "GreenBushGuard", "RedJavelinGuard", "RedBushGuard",
"BombGuard", "GreenKnifeGuard"]]
"BombGuard", "GreenKnifeGuard", "Stal"]]
- [0x00c6, 3, ["HardhatBeetle", "Wizzrobe", "MiniHelmasaur", "BlueGuard", "GreenGuard", "RedSpearGuard",
"BluesainBolt", "UsainBolt", "BlueArcher", "GreenBushGuard", "RedJavelinGuard", "RedBushGuard",
"BombGuard", "GreenKnifeGuard"]]
"BombGuard", "GreenKnifeGuard", "Stal"]]
- [0x00c6, 4, ["HardhatBeetle", "Wizzrobe", "MiniHelmasaur", "BlueGuard", "GreenGuard", "RedSpearGuard",
"BluesainBolt", "UsainBolt", "BlueArcher", "GreenBushGuard", "RedJavelinGuard", "RedBushGuard",
"BombGuard", "GreenKnifeGuard"]]
"BombGuard", "GreenKnifeGuard", "Stal"]]
- [0x00c6, 5, ["HardhatBeetle", "Wizzrobe", "MiniHelmasaur", "BlueGuard", "GreenGuard", "RedSpearGuard",
"BluesainBolt", "UsainBolt", "BlueArcher", "GreenBushGuard", "RedJavelinGuard", "RedBushGuard",
"BombGuard", "GreenKnifeGuard", "Bumper"]]
"BombGuard", "GreenKnifeGuard", "Bumper", "Stal"]]
- [0x00c6, 6, ["HardhatBeetle", "Wizzrobe", "MiniHelmasaur", "BlueGuard", "GreenGuard", "RedSpearGuard",
"BluesainBolt", "UsainBolt", "BlueArcher", "GreenBushGuard", "RedJavelinGuard", "RedBushGuard",
"BombGuard", "GreenKnifeGuard"]]
"BombGuard", "GreenKnifeGuard", "Stal"]]
# wizzrobe despawn issues - on pots/blocks
- [0x004e, 3, ["Wizzrobe"]]
- [0x005e, 4, ["Wizzrobe"]]