Repository navigation
fix(items): require the skill requirements to learn a skill with an item - #1243
Merged
Merged
Conversation
A player could learn a skill with a scroll, orb or crystal without complying with the requirements of the skill itself, and then couldn't use it. E.g. the Orb of Summoning has no energy requirement, but Summon Goblin needs 90 energy and Summon Soldier (orb +6) 280. Learning a skill with an item now also requires the requirements of the skill. The requirement check of Player.TryConsumeForSkillAsync is extracted to Player.CompliesRequirements(Skill) and reused for it. Split out of #995, without the client data packets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uz47mrsSwm3hxZc7gCMxd9
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.
Split out of #995 (the server-side part of Diego Amatte's "send skill requirements to the client" commit), without the client data packets.
Problem
LearnablesConsumeHandlerPlugInonly checked the item's own requirements. A player could therefore learn a skill they can't use, and the item was used up. The clearest case is the Orb of Summoning: the item has no energy requirement, but the skills of its levels do:Change
LearnablesConsumeHandlerPlugIn.CheckPreconditionsnow also requires the player to meet theSkill.Requirementsof the skill the item teaches. It gets that skill through the existing virtualGetLearnableSkill, so the Summoning Orb's override (item level → skill) applies.Player.TryConsumeForSkillAsyncis extracted toPlayer.CompliesRequirements(Skill)and reused here, so the rule isn't duplicated.Compared to the original commit, this leaves out the static
LearnableSkillRequirementshelper, which replaced the Summoning Orb'sGetLearnableSkilloverride with anIsSummoningOrbcheck (rule 8), andItemExtensions.GetRequiredAttribute. Both were only needed for theC2 F5 04/05packets. Those packets have no consumer in the open source client yet and aren't part of this PR.Testing
LearnablesConsumeHandlerPlugInTest:The two "not learned" cases fail without the change.
dotnet test tests/MUnique.OpenMU.Tests: 1856/1856 passed.Generated by Claude Code