refactor: code quality improvements and utility modules#10
Open
VX1D wants to merge 10 commits into1srscx4:mainfrom
Open
refactor: code quality improvements and utility modules#10VX1D wants to merge 10 commits into1srscx4:mainfrom
VX1D wants to merge 10 commits into1srscx4:mainfrom
Conversation
Bug fixes: 1. Frog Hat (content/objects/jokers.lua line 358-360): - Fixed seal propagation not rendering visually - Changed: set_seal(seal) -> set_seal(seal, nil, true) - The nil, true params trigger immediate visual update 2. Glorp deck (content/objects/decks.lua lines 77-90): - Added Cerber joker integration - When Glorp deck creates cards, checks if j_cerber exists - If Cerber is present and card is rank 2, applies Negative edition - Uses inline check (no dependency on utility modules) Testing: - Verify Frog Hat seal propagation shows visually - Verify 2s from Glorp deck become Negative with Cerber active
ac89062 to
f7fc1f3
Compare
Add nil-safe context and pool checks across jokers, enhancements, suit, blind, and editions to reduce runtime crashes from missing game state tables. Keep probability and scoring-hand operations bounded and defensive without changing intended gameplay flow. (cherry picked from commit 69496b56b9881daaa3d1cf4aca3ffb13b8f4770c)
Replace strict assert with soft warning for Lovely patch detection to prevent crash when Lovely isn't properly loaded. (cherry picked from commit 4b8c04f3add1479a5102963a9ebb7e79fdaacd93)
Add safety guards to: - hooks.lua: jokers.cards iteration in open_booster - tags.lua: G.CONTROLLER.locks access in both tag apply functions - modules/hooks/general.lua: jokers.cards check in draw_card hook Prevents crashes when game areas are not yet initialized. (cherry picked from commit 9128a9defb8faa6ce8c49854c539f3c1f3d5defb)
Fix j_vedalsdrink2 description typo (remove extra 'equal' word) Remove 9 commented-out sendDebugMessage calls from handtype.lua (cherry picked from commit 176638e0decd79f4744858c64404a9585f0ee89e)
# Conflicts: # content/hooks/hooks.lua # content/objects/blind.lua # content/objects/editions.lua # content/objects/enhancements.lua
f7fc1f3 to
b95fc62
Compare
ff5cb09 to
44a51e2
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes
New Utility Modules (
modules/utils/)Eight focused modules providing reusable functionality:
constants.lua- Centralized constants (suits, songs, limits) eliminating magic stringsjoker_utils.lua- Joker lookup helpers (find_joker,has_joker,count_cards)probability.lua- Odds calculation withroll_with_odds,get_probability_scalecard_analysis.lua- Card inspection (count_suit,is_flush,has_enhancement)random_utils.lua- Randomization helpers (random_suit,random_rank,random_song)config_builder.lua- Config factory for common joker patternsjoker_patterns.lua- Reusable calculate() patternssafety.lua- Defensive programming utilities (safe_access)Refactored Files
Neuratro.lua- Added module loading systemcontent/hooks/hooks.lua- Removed duplicate joker search loops, usesfind_jokerscontent/hooks/nothooks.lua- Fixed global pollution (sea→Neuratro.sea)content/objects/blind.lua- Uses utility probability functionscontent/objects/editions.lua- DRY coin flip logiccontent/objects/enhancements.lua- Consolidated duplicate loopsBenefits
safe_access