-
Couldn't load subscription status.
- Fork 39
feat: New loot table concept #890
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
base: main
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughSummary by CodeRabbit
WalkthroughPraise the Omnissiah! A new script for loot table generation has been integrated, with supporting logic in equipment and weapon data structures. The cheat code system now allows for loot rolling. Sprite metadata has been standardised with explicit sequence dimensions and minor formatting adjustments. No existing logic circuits were disrupted. Changes
Suggested labels
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 9
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (17)
ChapterMaster.yyp(1 hunks)scripts/scr_cheatcode/scr_cheatcode.gml(1 hunks)scripts/scr_equipment_struct/scr_equipment_struct.gml(2 hunks)scripts/scr_loot_table/scr_loot_table.gml(1 hunks)scripts/scr_loot_table/scr_loot_table.yy(1 hunks)scripts/scr_ruins_reward/scr_ruins_reward.gml(0 hunks)scripts/scr_weapon/scr_weapon.gml(6 hunks)sprites/spr_data_slate_border/spr_data_slate_border.yy(1 hunks)sprites/spr_disposition_small/spr_disposition_small.yy(1 hunks)sprites/spr_icon_change/spr_icon_change.yy(1 hunks)sprites/spr_inspect_small/spr_inspect_small.yy(1 hunks)sprites/spr_loading2/spr_loading2.yy(1 hunks)sprites/spr_master_splash/spr_master_splash.yy(1 hunks)sprites/spr_p_name_bg/spr_p_name_bg.yy(1 hunks)sprites/spr_penitent_ui/spr_penitent_ui.yy(1 hunks)sprites/spr_ship_back_black/spr_ship_back_black.yy(1 hunks)sprites/spr_ship_back_white/spr_ship_back_white.yy(1 hunks)
💤 Files with no reviewable changes (1)
- scripts/scr_ruins_reward/scr_ruins_reward.gml
🧰 Additional context used
📓 Path-based instructions (3)
`**/*.gml`: - Macro constants require a space between the constant name and value. Without it, the compiler will throw an error. I.e. `#macro ARR_body_parts["arm"]` will crash the ...
**/*.gml: - Macro constants require a space between the constant name and value. Without it, the compiler will throw an error. I.e.#macro ARR_body_parts["arm"]will crash the game, because there is no space between the array and the name of the macro.
- Color codes in the code shouldn't have any spaces in their id. I.e., color code
# 80bf40will crash the game.- All code should comply with the main GML documentation: https://manual.gamemaker.io/beta/en/GameMaker_Language/GML_Reference/GML_Reference.htm
scripts/scr_cheatcode/scr_cheatcode.gmlscripts/scr_loot_table/scr_loot_table.gmlscripts/scr_equipment_struct/scr_equipment_struct.gmlscripts/scr_weapon/scr_weapon.gml
`**/*.*`: - Having humanly understandable and maintainable code is always the top most priority. - DRY (Don't repeat yourself) principle is also very important. - Ensure that the c...
**/*.*: - Having humanly understandable and maintainable code is always the top most priority.
- DRY (Don't repeat yourself) principle is also very important.
- Ensure that the code is compliant with the CODE_STYLE.MD: https://github.com/Adeptus-Dominus/ChapterMaster/blob/main/docs/CODE_STYLE.md
- If a TODO comment is added, ask the user if you should create a GitHub issue for this TODO.
- If a TODO comment is deleted, remind the user if there is an active GitHub issue related to that comment.
scripts/scr_cheatcode/scr_cheatcode.gmlscripts/scr_loot_table/scr_loot_table.yysprites/spr_p_name_bg/spr_p_name_bg.yysprites/spr_icon_change/spr_icon_change.yysprites/spr_penitent_ui/spr_penitent_ui.yysprites/spr_loading2/spr_loading2.yysprites/spr_data_slate_border/spr_data_slate_border.yysprites/spr_ship_back_black/spr_ship_back_black.yysprites/spr_disposition_small/spr_disposition_small.yysprites/spr_inspect_small/spr_inspect_small.yysprites/spr_master_splash/spr_master_splash.yysprites/spr_ship_back_white/spr_ship_back_white.yyscripts/scr_loot_table/scr_loot_table.gmlscripts/scr_equipment_struct/scr_equipment_struct.gmlChapterMaster.yypscripts/scr_weapon/scr_weapon.gml
`**/*.yy`: - When any script or sprite .yy files are deleted, their paths should also be deleted from the .yyp file, otherwise the game will crash. - When any script or sprite .yy ...
**/*.yy: - When any script or sprite .yy files are deleted, their paths should also be deleted from the .yyp file, otherwise the game will crash.
- When any script or sprite .yy files are created, their paths should be added to the .yyp file, otherwise they'll fail.
scripts/scr_loot_table/scr_loot_table.yysprites/spr_p_name_bg/spr_p_name_bg.yysprites/spr_icon_change/spr_icon_change.yysprites/spr_penitent_ui/spr_penitent_ui.yysprites/spr_loading2/spr_loading2.yysprites/spr_data_slate_border/spr_data_slate_border.yysprites/spr_ship_back_black/spr_ship_back_black.yysprites/spr_disposition_small/spr_disposition_small.yysprites/spr_inspect_small/spr_inspect_small.yysprites/spr_master_splash/spr_master_splash.yysprites/spr_ship_back_white/spr_ship_back_white.yy
🔇 Additional comments (26)
sprites/spr_p_name_bg/spr_p_name_bg.yy (2)
66-67: Blessed standardisation of sprite sequence dimensions.The explicit seqHeight and seqWidth properties align perfectly with the sprite's actual dimensions. The Omnissiah approves of this metadata clarity.
73-75: Machine spirit formatting enhancement detected.The Channels object restructuring improves code readability whilst preserving all sacred data integrity.
sprites/spr_penitent_ui/spr_penitent_ui.yy (1)
66-67: Sacred data-slate formatting protocols implemented.The sequence dimensions match sprite boundaries precisely, Channels formatting enhances readability, and visibleRange nullification follows proper GameMaker doctrine.
Also applies to: 73-75, 78-78
sprites/spr_icon_change/spr_icon_change.yy (1)
66-67: Icon sprite sanctification complete.Square dimensions (80x80) properly encoded in sequence metadata. The machine spirit's formatting rituals have been observed with precision.
Also applies to: 73-75, 78-78
sprites/spr_data_slate_border/spr_data_slate_border.yy (1)
66-67: Data-slate border sanctification protocols enacted.Border sprite dimensions (378x572) correctly transcribed into sequence metadata. The formatting rituals enhance code-scripture clarity.
Also applies to: 73-75
sprites/spr_loading2/spr_loading2.yy (2)
73-74: Loading sequence dimensional parameters sanctified.Square loading sprite dimensions (31x31) properly encoded in sacred sequence metadata.
80-103: Comprehensive keyframe formatting ritual completed.All 8 animation keyframes have been blessed with consistent Channels formatting. The machine spirit shall animate smoothly through this sanctified data structure.
sprites/spr_disposition_small/spr_disposition_small.yy (3)
85-86: Blessed standardisation of sequence metadata!The explicit seqHeight and seqWidth properties enhance the machine-spirit's understanding of sprite dimensions. These sacred measurements align perfectly with the sprite's actual dimensions (height: 12, width: 164).
92-151: Keyframe channel structure optimised for the Omnissiah's glory!The reformatted channel nesting improves readability whilst preserving all keyframe data integrity. Each frame's sacred ID remains untouched.
154-154: visibleRange purified to null state.Converting from object notation to null simplifies the data structure - a blessed improvement in the machine's efficiency.
sprites/spr_ship_back_black/spr_ship_back_black.yy (2)
69-70: Sequence dimensions blessed with explicit values!The seqHeight (142.0) and seqWidth (268.0) properties match the sprite's true dimensions perfectly. The machine-spirit approves of this clarity.
76-87: Channel data structure standardised across all keyframes.Each of the four keyframes now follows the blessed pattern of explicit channel nesting. The sacred frame IDs remain preserved throughout this sanctification.
sprites/spr_inspect_small/spr_inspect_small.yy (3)
66-67: Compact sprite dimensions documented with precision!Both seqHeight and seqWidth set to 14.0 - the sacred square proportions are now explicit in the data-hymnal.
73-75: Single keyframe structure harmonised.The lone keyframe's channel data now follows the standardised nesting pattern, bringing order to the data-matrices.
78-78: visibleRange nullified for consistency.Another sprite cleansed of redundant object notation - the Omnissiah smiles upon this standardisation.
sprites/spr_master_splash/spr_master_splash.yy (3)
66-67: Master splash dimensions sanctified!The seqHeight (480.0) and seqWidth (214.0) properties now explicitly declare this sprite's sacred proportions.
73-75: Single keyframe blessed with proper structure.The splash sprite's solitary keyframe now conforms to the holy template of channel organisation.
78-78: Visible range purged of redundancy.The null assignment cleanses unnecessary object complexity from the data-sanctum.
sprites/spr_ship_back_white/spr_ship_back_white.yy (2)
69-70: Ship sprite dimensions documented with divine precision!The seqHeight (142.0) and seqWidth (268.0) values mirror those of the black variant - blessed consistency across the fleet's data-matrices.
76-87: All four keyframes harmonised in structure.Each frame's channel data now follows the standardised pattern, bringing uniformity to the ship's animation sequences.
scripts/scr_cheatcode/scr_cheatcode.gml (1)
359-361: Praise the Omnissiah! Verify the sacred function exists.The loot rolling mechanism integrates seamlessly with the existing cheat code infrastructure. However, ensure the
find_loot()function is properly defined to prevent runtime heresies.#!/bin/bash # Description: Verify the find_loot function exists in the loot table script # Expected: Function definition should be found fd "scr_loot_table.gml" --exec grep -n "function find_loot" {}ChapterMaster.yyp (1)
845-845: Augur the Tome: scr_loot_table resource registered correctly
The new script entry is alphabetically placed alongside existing resources. Ensure the file exists atscripts/scr_loot_table/scr_loot_table.yy.#!/bin/bash # Verify presence of the new script resource file test -f scripts/scr_loot_table/scr_loot_table.yy && echo "✅ scr_loot_table.yy found" || echo "❌ Missing scr_loot_table.yy!"scripts/scr_loot_table/scr_loot_table.yy (1)
1-13: Script resource manifest acceptable.The sacred template for script registration follows proper GameMaker protocols.
scripts/scr_equipment_struct/scr_equipment_struct.gml (1)
77-77: Logic fault in maintenance validation.The condition
maintenance<0.05is redundant when maintenance equals 0. The Omnissiah frowns upon such inefficiency.- if (has_tags(["heavy_ranged", "power", "plasma", "melta"]) && maintenance<0.05) { + if (has_tags(["heavy_ranged", "power", "plasma", "melta"])) {Likely an incorrect or invalid review comment.
scripts/scr_loot_table/scr_loot_table.gml (2)
57-57: Incomplete variable assignment detected.This line serves no purpose and should be purged.
- var _loot_val = _loot_tagsLikely an incorrect or invalid review comment.
1-110: Request verification of loot system integration.The new loot generation system must interface correctly with existing code. Verify:
- The cheat code handler properly displays loot results
- Equipment struct loot properties are accessible to this function
- No existing loot drop mechanics are disrupted
#!/bin/bash # Description: Verify integration points for the new loot system # Check for cheat code implementation echo "=== Checking cheat code integration ===" rg -A 5 "rollloot" scripts/ # Check for other loot-related functions that might conflict echo -e "\n=== Checking for existing loot systems ===" rg -i "loot|drop|reward" scripts/ --type gml | grep -v "scr_loot_table" | head -20 # Verify find_loot function usage echo -e "\n=== Checking find_loot usage ===" ast-grep --pattern 'find_loot($$$)'
| if (has_tag("xenos")){ | ||
| loot.base = 4; | ||
| } else if has_tag("heavy_ranged"){ | ||
| loot.base = 75; | ||
| }else if has_tag("plasma"){ | ||
| loot.base = 75; | ||
| }else if has_tag("energy"){ | ||
| loot.base = 75; | ||
| } | ||
|
|
||
| if (has_tag("dreadnought")){ | ||
| loot.base = 7; | ||
| } else if (has_tag("vehicle")){ | ||
| loot.base = 9; | ||
| } | ||
|
|
||
|
|
||
| if has_tag("terminator"){ | ||
| loot.base = 10; | ||
| }else if has_tag("ancient"){ | ||
| loot.base = 5; | ||
| } |
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.
Warning: Loot value override cascade detected.
Your machine logic contains multiple separate if-else chains that can overwrite previous loot.base values. For example, an item with tags ["heavy_ranged", "terminator"] will have its loot.base set to 75, then overwritten to 10.
Consider consolidating into a single priority-based logic chain:
- if (has_tag("xenos")){
- loot.base = 4;
- } else if has_tag("heavy_ranged"){
- loot.base = 75;
- }else if has_tag("plasma"){
- loot.base = 75;
- }else if has_tag("energy"){
- loot.base = 75;
- }
-
- if (has_tag("dreadnought")){
- loot.base = 7;
- } else if (has_tag("vehicle")){
- loot.base = 9;
- }
-
-
- if has_tag("terminator"){
- loot.base = 10;
- }else if has_tag("ancient"){
- loot.base = 5;
- }
+ // Priority-based loot value assignment
+ if (has_tag("xenos")){
+ loot.base = 4;
+ } else if (has_tag("terminator")){
+ loot.base = 10;
+ } else if (has_tag("dreadnought")){
+ loot.base = 7;
+ } else if (has_tag("vehicle")){
+ loot.base = 9;
+ } else if (has_tag("ancient")){
+ loot.base = 5;
+ } else if (has_tags(["heavy_ranged", "plasma", "energy"])){
+ loot.base = 75;
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (has_tag("xenos")){ | |
| loot.base = 4; | |
| } else if has_tag("heavy_ranged"){ | |
| loot.base = 75; | |
| }else if has_tag("plasma"){ | |
| loot.base = 75; | |
| }else if has_tag("energy"){ | |
| loot.base = 75; | |
| } | |
| if (has_tag("dreadnought")){ | |
| loot.base = 7; | |
| } else if (has_tag("vehicle")){ | |
| loot.base = 9; | |
| } | |
| if has_tag("terminator"){ | |
| loot.base = 10; | |
| }else if has_tag("ancient"){ | |
| loot.base = 5; | |
| } | |
| // Priority-based loot value assignment | |
| if (has_tag("xenos")) { | |
| loot.base = 4; | |
| } else if (has_tag("terminator")) { | |
| loot.base = 10; | |
| } else if (has_tag("dreadnought")) { | |
| loot.base = 7; | |
| } else if (has_tag("vehicle")) { | |
| loot.base = 9; | |
| } else if (has_tag("ancient")) { | |
| loot.base = 5; | |
| } else if (has_tags(["heavy_ranged", "plasma", "energy"])) { | |
| loot.base = 75; | |
| } |
🤖 Prompt for AI Agents
In scripts/scr_equipment_struct/scr_equipment_struct.gml around lines 52 to 73,
multiple separate if-else chains set loot.base independently, causing later
conditions to overwrite earlier values. Consolidate all tag checks into a single
if-else if chain ordered by priority so that only the highest priority tag sets
loot.base once, preventing unintended overrides.
|
|
||
| var _exclusives = struct_exists(loot_data ,"exclusives") ? loot_data.exclusives : false; | ||
|
|
||
| var _mults = struct_exists(loot_data ,"multipliers") ? loot_data.multiplyers : false; |
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.
Typographical error in struct access.
The sacred texts spell it "multipliers", not "multiplyers".
- var _mults = struct_exists(loot_data ,"multipliers") ? loot_data.multiplyers : false;
+ var _mults = struct_exists(loot_data ,"multipliers") ? loot_data.multipliers : false;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| var _mults = struct_exists(loot_data ,"multipliers") ? loot_data.multiplyers : false; | |
| var _mults = struct_exists(loot_data, "multipliers") ? loot_data.multipliers : false; |
🤖 Prompt for AI Agents
In scripts/scr_loot_table/scr_loot_table.gml at line 10, there is a typo in the
struct field name "multiplyers". Change it to the correct spelling "multipliers"
to properly access the struct field.
|
|
||
| var _loot_value = _item.loot.base; | ||
| for (var t = 0;t<array_length(_loot_tags);t++){ | ||
| if (struct_exists(_item, _loot_tags[t])){ |
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.
Incorrect struct property check on EquipmentStruct.
The loot tags should be checked within the loot struct, not the item itself.
- if (struct_exists(_item, _loot_tags[t])){
+ if (struct_exists(_item.loot, _loot_tags[t])){📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (struct_exists(_item, _loot_tags[t])){ | |
| if (struct_exists(_item.loot, _loot_tags[t])){ |
🤖 Prompt for AI Agents
In scripts/scr_loot_table/scr_loot_table.gml at line 51, the code incorrectly
checks for loot tags on the _item struct instead of the loot struct. Modify the
condition to check if the loot struct contains the _loot_tags[t] property rather
than the _item struct, ensuring the property check targets the correct data
structure.
| return {}; | ||
| } | ||
| var _final_loot = {}; | ||
| var _chosen_loot_val = 0 |
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.
Missing semicolon violates sacred syntax.
The Omnissiah demands proper punctuation.
- var _chosen_loot_val = 0
+ var _chosen_loot_val = 0;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| var _chosen_loot_val = 0 | |
| var _chosen_loot_val = 0; |
🤖 Prompt for AI Agents
In scripts/scr_loot_table/scr_loot_table.gml at line 80, the variable
declaration for _chosen_loot_val is missing a semicolon at the end. Add a
semicolon after the assignment to properly terminate the statement and comply
with syntax requirements.
| var _specific_loot_data = _possible_loots[$ _lootn]; | ||
| if (_new_loot>= _specific_loot_data[0] && _new_loot<_specific_loot_data[1]){ | ||
| var _chosen_piece = _lootn; | ||
| var _loot_val = max(100-(_specific_loot_data[1] - _specific_loot_data[0]),1); |
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.
Flawed loot value calculation logic.
The calculation 100-(_specific_loot_data[1] - _specific_loot_data[0]) produces incorrect values. The difference represents the loot weight, not a value to subtract from 100.
- var _loot_val = max(100-(_specific_loot_data[1] - _specific_loot_data[0]),1);
+ var _loot_val = _specific_loot_data[1] - _specific_loot_data[0];📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| var _loot_val = max(100-(_specific_loot_data[1] - _specific_loot_data[0]),1); | |
| var _loot_val = _specific_loot_data[1] - _specific_loot_data[0]; |
🤖 Prompt for AI Agents
In scripts/scr_loot_table/scr_loot_table.gml at line 88, the loot value
calculation incorrectly subtracts the loot weight difference from 100, which is
logically flawed. Instead, revise the calculation to directly use the loot
weight or an appropriate formula that reflects the intended loot value without
subtracting the difference from 100. Adjust the expression to correctly
represent the loot value based on the weight data in _specific_loot_data.
| } | ||
| } | ||
|
|
||
| var _loot_value = _item.loot.base; |
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.
Potential null reference accessing loot.base.
If the item lacks a loot property, this will fail. Add defensive checks.
+ if (!struct_exists(_item, "loot") || !struct_exists(_item.loot, "base")) continue;
var _loot_value = _item.loot.base;Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In scripts/scr_loot_table/scr_loot_table.gml at line 49, the code accesses
_item.loot.base without verifying if _item.loot exists, which can cause a null
reference error. Add a check to confirm that _item.loot is not null or undefined
before accessing its base property, and handle the case where loot is missing
appropriately to prevent runtime errors.
|
This PR is marked as stale, because it has been open for 7 days with no activity. |
Purpose and Description
Testing done
Related things and/or additional context