forked from AtmaTek/WorldsCollide
-
Notifications
You must be signed in to change notification settings - Fork 13
Add 'Oops All <Boss> Mode #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wrjones104
wants to merge
4
commits into
ff6wc:dev
Choose a base branch
from
wrjones104:oops-all-boss
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -179,6 +179,64 @@ def mod(self): | |||||||||||||||||||
| if self.args.random_encounters_chupon: | ||||||||||||||||||||
| self.add_chupon() | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if self.args.oops is not None: | ||||||||||||||||||||
| self.oops_mod() | ||||||||||||||||||||
|
|
||||||||||||||||||||
| def oops_mod(self): | ||||||||||||||||||||
| boss_enemy_ids = set() | ||||||||||||||||||||
| import data.bosses as bosses | ||||||||||||||||||||
| boss_enemy_ids.update(bosses.normal_enemy_name.keys()) | ||||||||||||||||||||
| boss_enemy_ids.update(bosses.dragon_enemy_name.keys()) | ||||||||||||||||||||
| boss_enemy_ids.update(bosses.statue_enemy_name.keys()) | ||||||||||||||||||||
| boss_enemy_ids.update(bosses.final_battle_enemy_name.keys()) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # The user-selected target boss ID | ||||||||||||||||||||
| target_boss_id = self.args.oops | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if target_boss_id == "random": | ||||||||||||||||||||
| import random | ||||||||||||||||||||
| excluded_final_battle_ids = set(bosses.final_battle_enemy_name.keys()) | ||||||||||||||||||||
| excluded_final_battle_ids.remove(298) # Keep Kefka (Final) as valid! | ||||||||||||||||||||
| valid_boss_ids = [eid for eid in bosses.enemy_name.keys() if eid not in excluded_final_battle_ids and eid not in bosses.removed_enemy_name] | ||||||||||||||||||||
| target_boss_id = random.choice(valid_boss_ids) | ||||||||||||||||||||
| self.args.oops = target_boss_id | ||||||||||||||||||||
|
|
||||||||||||||||||||
| boss_name = bosses.enemy_name.get(target_boss_id) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if self.args.spoiler_log: | ||||||||||||||||||||
| from log import section | ||||||||||||||||||||
| section("Oops All Bosses", [f" Boss: {boss_name} (ID {target_boss_id})"], []) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Find the native mold of the chosen boss from any formation containing it | ||||||||||||||||||||
| target_mold = None | ||||||||||||||||||||
| for formation in self.formations: | ||||||||||||||||||||
| if target_boss_id in formation.enemies(): | ||||||||||||||||||||
| target_mold = formation.mold | ||||||||||||||||||||
| break | ||||||||||||||||||||
|
|
||||||||||||||||||||
| for formation in self.formations: | ||||||||||||||||||||
| has_boss = False | ||||||||||||||||||||
| for enemy_index in range(formation.ENEMY_CAPACITY): | ||||||||||||||||||||
| if formation.enemy_slots & (1 << enemy_index): | ||||||||||||||||||||
| if formation.enemy_ids[enemy_index] in boss_enemy_ids: | ||||||||||||||||||||
| has_boss = True | ||||||||||||||||||||
| break | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if has_boss: | ||||||||||||||||||||
|
Comment on lines
+218
to
+225
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This nested loop can be simplified and made more Pythonic by using the built-in
Suggested change
|
||||||||||||||||||||
| # Set only the first slot (slot 0) as active to prevent multi-boss VRAM overlays | ||||||||||||||||||||
| formation.enemy_slots = 1 | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Set slot 0's enemy ID to the target boss ID | ||||||||||||||||||||
| formation.enemy_ids[0] = target_boss_id | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Center the single boss perfectly on screen (y = 5, x = 6) | ||||||||||||||||||||
| formation.enemy_y_positions[0] = 5 | ||||||||||||||||||||
| formation.enemy_x_positions[0] = 6 | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Apply the native mold for correct VRAM layout & rendering | ||||||||||||||||||||
| if target_mold is not None: | ||||||||||||||||||||
| formation.mold = target_mold | ||||||||||||||||||||
|
|
||||||||||||||||||||
| def print_scripts(self): | ||||||||||||||||||||
| for formation_index, formation in enumerate(self.formations): | ||||||||||||||||||||
| if formation.enable_event_script: | ||||||||||||||||||||
|
|
||||||||||||||||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using a
try-exceptblock to handle control flow and checking the exception string to decide whether to re-raise, you can check if the input is numeric usingstr.isdigit(). This makes the logic cleaner, more readable, and avoids relying on exception message parsing.