Skip to content

Commit 287ae4e

Browse files
committed
Get boss shuffle running, dont merge
1 parent c3acaaf commit 287ae4e

File tree

4 files changed

+126
-16
lines changed

4 files changed

+126
-16
lines changed

worlds/earthbound/Options.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from dataclasses import dataclass
22
from Options import (Toggle, DefaultOnToggle, DeathLink, Choice, Range, PerGameCommonOptions, StartInventoryPool,
3-
OptionGroup, FreeText, Visibility)
3+
OptionGroup, FreeText, Visibility, PlandoBosses)
4+
from .modules.boss_shuffle import boss_plando_keys
45

56

67
class GiygasRequired(DefaultOnToggle):
@@ -90,10 +91,21 @@ class PSIShuffle(Choice):
9091
option_extended = 2
9192

9293

93-
class BossShuffle(Toggle):
94+
class BossShuffle(PlandoBosses):
9495
"""Shuffles boss encounters amongst each other."""
9596
display_name = "Boss Shuffle"
9697

98+
option_false = 0
99+
option_true = 1
100+
default = 0
101+
bosses = boss_plando_keys
102+
locations = boss_plando_keys
103+
duplicate_bosses = False
104+
105+
@classmethod
106+
def can_place_boss(cls, boss: str, location: str) -> bool:
107+
return True
108+
97109

98110
class DecoupleDiamondDog(Toggle):
99111
"""Shuffles Diamond Dog as a boss separate from Carbon Dog. Carbon Dog will transform into a random boss.

worlds/earthbound/archipelago.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"compatible_version": 7, "version": 7, "world_version": "4.2.7", "game": "EarthBound"}
1+
{"compatible_version": 7, "world_version": "4.2.7", "game": "EarthBound"}

worlds/earthbound/modules/boss_shuffle.py

Lines changed: 109 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,77 @@
3434
"Heavily Armed Pokey": 0xEF49AA,
3535
"Starman Junior": 0xEF3A59,
3636
"Diamond Dog": 0xEF3D08,
37-
"Giygas (4)": 0xEF40F2
37+
"Giygas": 0xEF40F2
3838

3939
}
4040

41+
boss_plando_keys = {
42+
"Frank",
43+
"Frankystein Mark II",
44+
"Frankystein",
45+
"Captain Strong",
46+
"Strong",
47+
"Everdred",
48+
"Mr. Carpainter",
49+
"Mr Carpainter",
50+
"Carpainter",
51+
"Mondo Mole",
52+
"Boogey Tent",
53+
"Mini Barf",
54+
"Master Belch",
55+
"Belch",
56+
"Trillionage Sprout",
57+
"Guardian Digger",
58+
"Dept. Store Spook",
59+
"Dept Store Spook",
60+
"Evil Mani Mani",
61+
"Mani Mani",
62+
"Clumsy Robot",
63+
"Shrooom!",
64+
"Shrooom",
65+
"Shroom!",
66+
"Shroooooom!",
67+
"Shroom",
68+
"Plague Rat of Doom",
69+
"Thunder and Storm",
70+
"Kraken",
71+
"The Kraken",
72+
"Guardian General",
73+
"Master Barf",
74+
"Starman Deluxe",
75+
"Starman DX",
76+
"Electro Specter",
77+
"Carbon Dog",
78+
"Ness's Nightmare",
79+
"Nesss Nightmare",
80+
"Heavily Armed Pokey",
81+
"Pokey"
82+
"Starman Junior",
83+
"Diamond Dog",
84+
"Giygas"
85+
}
86+
87+
boss_typo_key = {
88+
"Frankystein": "Frankystein Mark II",
89+
"Strong": "Captain Strong",
90+
"Mr Carpainter": "Mr. Carpainter",
91+
"Carpainter": "Mr. Carpainter",
92+
"Belch": "Master Belch",
93+
"Dept Store Spook": "Dept. Store Spook",
94+
"Evil Mani Mani": "Evil Mani-Mani",
95+
"Mani Mani": "Evil Mani-Mani",
96+
"Shroom": "Shrooom!",
97+
"Shrooom": "Shrooom!",
98+
"Shroom!": "Shrooom!",
99+
"Shroooooom!": "Shrooom!",
100+
"The Kraken": "Kraken",
101+
"Starman DX": "Starman Deluxe",
102+
"Nesss Nightmare": "Ness's Nightmare",
103+
"Pokey": "Heavily Armed Pokey"
104+
}
105+
41106
banned_transformations = ["Master Belch", "Master Barf", "Kraken", "Heavily Armed Pokey"]
42-
hard_final_bosses = ["Carbon Dog", "Kraken", "Clumsy Robot", "Starman Junior", "Starman Deluxe", "Giygas (4)", "Thunder and Storm", "Electro Specter",
107+
hard_final_bosses = ["Carbon Dog", "Kraken", "Clumsy Robot", "Starman Junior", "Starman Deluxe", "Giygas", "Thunder and Storm", "Electro Specter",
43108
"Evil Mani-Mani", "Ness's Nightmare", "Shrooom!", "Master Belch"]
44109

45110

@@ -60,6 +125,11 @@ class BossData(NamedTuple):
60125

61126

62127
def initialize_bosses(world: "EarthBoundWorld") -> None:
128+
from ..Options import BossShuffle
129+
130+
world.spoil_dog_shuffle = world.options.decouple_diamond_dog.value
131+
world.spoil_giygas_shuffle = world.options.boss_shuffle_add_giygas.value
132+
63133
world.boss_list = [
64134
"Frank",
65135
"Frankystein Mark II",
@@ -89,7 +159,7 @@ def initialize_bosses(world: "EarthBoundWorld") -> None:
89159
"Heavily Armed Pokey",
90160
"Starman Junior",
91161
"Diamond Dog",
92-
"Giygas (4)"
162+
"Giygas"
93163
]
94164

95165
world.boss_slots = {
@@ -138,7 +208,7 @@ def initialize_bosses(world: "EarthBoundWorld") -> None:
138208
"Heavily Armed Pokey": SlotInfo([0x09C2EC], [0x2EEEC3, 0x2EEECC], [], []),
139209
"Starman Junior": SlotInfo([], [], [], []),
140210
"Diamond Dog": SlotInfo([], [], [], []),
141-
"Giygas (4)": SlotInfo([0x09C2BF, 0x09C2E5], [0x2EF0A9], [0x2EF09F], [])
211+
"Giygas": SlotInfo([0x09C2BF, 0x09C2E5], [0x2EF0A9], [0x2EF09F], [])
142212
}
143213

144214
world.boss_info = {
@@ -170,29 +240,32 @@ def initialize_bosses(world: "EarthBoundWorld") -> None:
170240
"Heavily Armed Pokey": BossData(0x01CA, 0xEEF064, 0xEEF056, 0x000E, 0xD8, 0x69),
171241
"Starman Junior": BossData(0x012F, 0xEEF082, 0xEEF07A, 0x01DA, 0xD6, 0x94),
172242
"Diamond Dog": BossData(0x014A, 0xEEF052, 0xEEF089, 0x01D9, 0x53, 0x61),
173-
"Giygas (4)": BossData(0x0172, 0xEEF095, 0xEEF095, 0x01DD, 0xDC, 0x49)
243+
"Giygas": BossData(0x0172, 0xEEF095, 0xEEF095, 0x01DD, 0xDC, 0x49)
174244
}
175245

176246
if world.options.skip_prayer_sequences:
177247
# Boss shuffle sprites needs to apply to the skip prayer cleanup too
178-
world.boss_slots["Giygas (4)"].sprite_addrs.append(0x07B9AC)
248+
world.boss_slots["Giygas"].sprite_addrs.append(0x07B9AC)
179249
world.boss_slots["Heavily Armed Pokey"].sprite_addrs.append(0x07B9A7)
180250

181251
# mole/rat text
182252
# todo; Giygas sprites/text
183253

184254
world.boss_slot_order = world.boss_list.copy()
255+
boss_plando = world.options.boss_shuffle.value.split(";")
256+
shuffle_result = boss_plando.pop()
185257

186-
if world.options.boss_shuffle:
258+
if shuffle_result:
187259
world.random.shuffle(world.boss_list)
188260

189261
if not world.options.decouple_diamond_dog:
190262
world.boss_list.remove("Diamond Dog")
191263
insert_index = 28 if not world.options.boss_shuffle_add_giygas else 27
192264
world.boss_list.insert(insert_index, "Diamond Dog")
265+
193266
if not world.options.boss_shuffle_add_giygas:
194-
world.boss_list.remove("Giygas (4)")
195-
world.boss_list.insert(29, "Giygas (4)")
267+
world.boss_list.remove("Giygas")
268+
world.boss_list.insert(29, "Giygas")
196269

197270
if world.boss_list[25] == "Carbon Dog" and world.boss_list[27] in banned_transformations:
198271
original_boss = world.boss_list[27]
@@ -204,11 +277,36 @@ def initialize_bosses(world: "EarthBoundWorld") -> None:
204277
while world.boss_list[25] in hard_final_bosses:
205278
i = world.random.randrange(len(world.boss_list))
206279
if (world.boss_list[i] == "Diamond Dog" and not world.options.decouple_diamond_dog) or (
207-
world.boss_list[i] == "Giygas (4)" and not world.options.boss_shuffle_add_giygas
280+
world.boss_list[i] == "Giygas" and not world.options.boss_shuffle_add_giygas
208281
):
209282
continue
210283
world.boss_list[25], world.boss_list[i] = world.boss_list[i], world.boss_list[25]
211284

285+
print(f"Old: {world.boss_list}")
286+
for item in boss_plando:
287+
boss_block = item.split("-")
288+
boss = boss_block[0].title()
289+
slot = boss_block[1].title()
290+
if boss in boss_typo_key:
291+
boss = boss_typo_key[boss]
292+
293+
if slot in boss_typo_key:
294+
slot = boss_typo_key[boss]
295+
296+
if slot == "Diamond Dog":
297+
world.spoil_dog_shuffle = True
298+
299+
if slot == "Giygas":
300+
world.spoil_dog_shuffle = True
301+
302+
world.boss_list.remove(boss)
303+
world.boss_list.insert(world.boss_slot_order.index(slot), boss)
304+
305+
306+
print(f"New {world.boss_list}")
307+
308+
309+
212310
def write_bosses(world: "EarthBoundWorld", rom: "LocalRom") -> None:
213311
rom.write_bytes(0x15E527, bytearray([0x00, 0x00])) # Blank out Pokey's end battle action
214312
rom.write_bytes(0x15B8B9, bytearray([0x00, 0x00]))
@@ -298,7 +396,7 @@ def write_bosses(world: "EarthBoundWorld", rom: "LocalRom") -> None:
298396
rom.write_bytes(0x2FFF17, struct.pack("H", world.boss_info[world.boss_list[27]].enemy_id)) # Add diamond dog
299397
rom.write_bytes(0x2FFF19, bytearray([0xFF]))
300398
rom.write_bytes(world.enemies[world.boss_list[27]].address + 91, bytearray([0x00])) # Force to front row
301-
elif world.boss_list[25] == "Giygas (4)":
399+
elif world.boss_list[25] == "Giygas":
302400
rom.write_bytes(0x0121DF, bytearray([0x00]))
303401
rom.write_bytes(0x2FFF16, bytearray([0xFF]))
304402
else:

worlds/earthbound/modules/enemy_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def initialize_enemies(world: "EarthBoundWorld") -> None:
131131
"Criminal Caterpillar": ["fire", "fire", "fire", "fire"],
132132
"Evil Eye": ["null", "diamond_eyes", "paralysis", "null"],
133133
"Master Criminal Worm": ["fire", "fire", "fire", "fire"],
134-
"Giygas (4)": ["giygas_phase2_thunder", "giygas_phase2_freeze", "giygas_phase2_flash", "null"],
134+
"Giygas": ["giygas_phase2_thunder", "giygas_phase2_freeze", "giygas_phase2_flash", "null"],
135135
"Giygas (5)": ["giygas_phase3_thunder", "giygas_phase3_freeze", "giygas_phase3_flash", "null"],
136136
"Giygas (6)": ["giygas_phase4_thunder", "giygas_phase4_freeze", "giygas_phase4_flash", "null"],
137137
"Starman Junior": ["fire", "null", "freeze", "fire"],
@@ -483,7 +483,7 @@ def initialize_enemies(world: "EarthBoundWorld") -> None:
483483
# "Heavily Armed Pokey": EarthBoundEnemy("Heavily Armed Pokey", 0x15e537, 1746, 999, 0, 0, 51, 150, 274, 72, False), Cutscene?
484484
"Giygas (2)": EarthBoundEnemy("Giygas (2)", 0x15e595, 9999, 999, 70000, 0, 80, 255, 255, 80, 5, 255, False),
485485
"Giygas (3)": EarthBoundEnemy("Giygas (3)", 0x15e5f3, 9999, 0, 0, 0, 80, 255, 255, 80, 5, 255, False),
486-
"Giygas (4)": EarthBoundEnemy("Giygas (4)", 0x15e651, 2000, 0, 0, 0, 80, 255, 255, 80, 5, 255, False),
486+
"Giygas": EarthBoundEnemy("Giygas", 0x15e651, 2000, 0, 0, 0, 80, 255, 255, 80, 5, 255, False),
487487
"Giygas (5)": EarthBoundEnemy("Giygas (5)", 0x15e6af, 9999, 0, 0, 0, 80, 255, 255, 80, 5, 255, False),
488488
"Farm Zombie": EarthBoundEnemy("Farm Zombie", 0x15e70d, 171, 0, 700, 58, 10, 31, 24, 19, 15, 24, False),
489489
"Criminal Caterpillar": EarthBoundEnemy("Criminal Caterpillar", 0x15e76b, 250, 168, 30384, 0, 134, 37, 16, 23, 0, 0, False),

0 commit comments

Comments
 (0)