battle: attribute-defence shift rolls its own hit chance per attribute id - #1059
Merged
Conversation
…e id RPG_RT rolls an independent Rand::PercentChance(to_hit_attribute_shift) per targeted attribute id inside Game_BattleAlgorithm::Skill::vExecute's affect_attr_defence loop; apply_attr_shift applied the shift to every listed id unconditionally with no roll at all. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PvVVCj619TThxYzb5CbavC
take-cheeze
enabled auto-merge
August 19, 2026 02:23
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.
Summary
Game::Battle#apply_attr_shift(an RPG2003 skill's attribute-defence rank shift, e.g. a "Ward Fire"-style resistance buff or a curse that weakens a resistance) applied the shift to every targeted attribute id unconditionally, with no accuracy roll at all.Rand::PercentChance(to_hit_attribute_shift)per targeted attribute id insideGame_BattleAlgorithm::Skill::vExecute'saffect_attr_defenceloop (src/game_battlealgorithm.cpp, confirmed by fetching the live source), so a skill tagged to shift several attributes at once can land on some and miss others in the same cast — the same "rolled fresh per affected field" behavior this codebase'sstat_mod_keys/HP/SP skill effects already have via#skill_effect_hits?.#skill_effect_hits?(cmd)once per attribute id inside#apply_attr_shift's loop, reusing the samecmd[:chance]the skill's other effects already roll against.affect_attack/affect_defense/affect_spirit/affect_agility's own independent per-stat rolls are already correctly implemented by this codebase's existingstat_keys = (cmd[:stat_mod_keys] || []).select { skill_effect_hits?(cmd) }(each.selectiteration re-invokes#skill_effect_hits?for a fresh, independent roll) — no change needed there.Game_BattleAlgorithm::Skill::vExecute's separateIsImmuneToAttributeDownshifts()gate on negative shifts is a related, not-yet-investigated gap, deliberately left out of scope here.Test plan
scripts/rpg2k_logic_check.rbcheck: a two-attribute shift with a seeded RNG landing exactly one of two 50%-chance rolls — only the attribute whose own roll hit actually moves.expected [1], got [1, 2]) viagit stash, and passes post-fix.ruby scripts/rpg2k_logic_check.rb— 1035 checks passed.ruby scripts/rpg2k_scene_check.rb— 751 checks passed.ruby scripts/rpg2k_render_check.rb— 41 checks passed.ruby scripts/rpg2k3_battle_gauge_check.rb— 15 checks, 0 failures.ruby scripts/rpg2k3_battle_row_check.rb— 13 checks, 0 failures.Generated by Claude Code