[script][cast] cap-aware cambrinth charges behind a new cambrinth_distribute_charges setting - #7561
Open
simtel12 wants to merge 2 commits into
Open
Conversation
Adds the default and an explanation for a new Lich setting that spreads a spell's cambrinth charges over cambrinth_items instead of charging each item in full. It only matters when cambrinth_items lists more than one item. Without it, "cambrinth: [4, 10]" charges 4 and then 10 into every item. The default stays off, so no profile changes behaviour. An older Lich ignores the key.
…e_charges
cast.lic splits the cambrinth mana into charges of one size, then fills each
item up to its cap and never returns to an item once a charge has passed it
by. A character with a cap-4 earcuff, a cap-4 anklet and a cap-48 urchin
therefore charges only the urchin at most discerns, because a charge of 7
fits none of the small items.
With the new cambrinth_distribute_charges setting, cast.lic hands the split
to DRCA.allocate_cambrinth_charges. Each item takes as much as its cap
allows, in the order the profile lists them, so a small worn item fills
before a large stored one:
caps 4/4/48, 3 charges, 20 mana to charge
before: [[], [], [7, 7, 6]]
after: [[4], [4], [12]]
Sharing DRCA's allocator keeps ,cast and the waggle scripts on one scheme.
An older Lich has no such method, so cast.lic checks for it and falls back
to its own split.
The setting is off by default, so nothing changes for anyone who does not
opt in. A single cambrinth item is unaffected either way.
Also stops distribute_num_charges from dividing by zero when the charge
count is 0 and the prep is fixed by a runestone. Undistributed mana now
goes back into the prep.
The base profile documents the new setting and its default.
Contributor
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
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.
Problem
cast.licsplits the cambrinth mana into charges of one size, then fills each item up to its cap and never returns to an item once a charge has passed it by. Both halves of that hurt a character whosecambrinth_itemshave very different caps.Take a cap-4 worn earcuff, a cap-4 worn anklet and a cap-48 stored urchin, with
cambrinth_num_charges: 3:The small worn items therefore sit idle at most discerns, and their mana goes into the base prep instead.
Change
Behind the new
cambrinth_distribute_chargessetting,cast.lichands the split toDRCA.allocate_cambrinth_charges. Each item takes as much as its cap allows, in the order the profile lists them, so a small worn item fills before a large stored one. Each item then splits its own share into charges.Sharing
DRCA's allocator is the point:,cast, the waggle sets andmagic-trainingthen charge the same way instead of each carrying its own scheme. An older Lich has no such method, socast.licchecks for it and falls back to its own split.The setting is off by default, so nothing changes for anyone who does not opt in. A single cambrinth item is unaffected either way.
profiles/base.yamlgains the setting with its default and an explanation.Also fixed
distribute_num_chargesdivides by zero when the charge count is 0 and the prep is fixed by a runestone, because the loop keeps going while mana is left but has no charges to put it in. Mana that the charges cannot take now goes back into the prep.Testing
bundle exec rspec— 3025 examples, 0 failures, including 8 new ones inspec/cast_spec.rb. They cover both schemes, the leftover going back into the prep, the fallback when Lich has no allocator, and the divide-by-zero case.DRCAgenuinely has noallocate_cambrinth_charges, exactly like an older Lich.bundle exec rubocop— clean on both changed files.Companion change
elanthia-online/lich-5#1549 adds
DRCA.allocate_cambrinth_chargesand fixes the same class of problem inDRCAitself, where a flatcambrinth:list is charged into every item in full. This PR does not depend on that one landing first — without it,cast.lickeeps its current behaviour.Test plan
,cast <spell>is unchanged for a profile with one cambrinth item.,cast <spell>is unchanged for any profile that does not setcambrinth_distribute_charges.cambrinth_items, small items are charged up to their cap before a larger item is used.,cast <spell> -yamlexports the new nested charge list correctly.,cast <spell> -c10s) still picks a plan inside the budget.