Skip to content
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

make some enchantments work better with percentage #72589

Merged
merged 4 commits into from Mar 27, 2024

Conversation

GuardianDll
Copy link
Contributor

Summary

None

Purpose of change

While making test suite for enchantment, i found a pretty interesting issue: applying enchantment, that gives you +4 BONUS_DODGE (default dodge amount is 1), and then gives -50% to your bonus dodge result not in 2.5 (rounds down to 2) dodges, but 4. It happens because some enchantments (specifically STR, INT, DEX, PER, BONUS_DODGE and BONUS_BLOCK) use multiplier on the base stat. What does it mean is that if we have add +4, multiply -0.5, our formula would be (1 * 0.5) + 4. While it is a valid approach, it means player would be penalized much less from negative mutations, if they will try to use negative multiplier

Describe the solution

Change the code, so formula would be (1 + 4) * 0.5 - it *will* cause positive multipliers give more benefit, but also make negative multipliers actually meaningful punishment

Describe alternatives you've considered

Not doing it

Testing

Compiled the game, spawned different stat increasing mutations, didn't spot obvious issues

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` Mechanics: Enchantments / Spells Enchantments and spells labels Mar 24, 2024
@github-actions github-actions bot requested a review from KorGgenT March 24, 2024 16:18
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Mar 24, 2024
@RedMisao
Copy link
Contributor

This is explained in the docs, yet because they're too long already I guess it's being lost in transit (it's at the values identifier from the enchantments section)

For the topic: I don't think this is the correct approach. This will just do a 180 in how add and multiply are handled, which will be a problem in the future in case someone wants it the other way around.
A better way would be to make them respect the order in which they're added, and/or allow support for having multiple value of the same type respect the order in which they're used (which is not working as it just applies the first value type on the list):

        "values": [ 
          { "value": "DEXTERITY", "add": 2, "multiply": -0.5 },
        ] 
vs
        "values": [ 
          { "value": "DEXTERITY", "multiply": -0.5, "add": 2 },
        ] 
vs
        "values": [ 
          { "value": "DEXTERITY", "add": 2 },
          { "value": "DEXTERITY", "multiply": -0.5 },
        ] 

@GuardianDll
Copy link
Contributor Author

GuardianDll commented Mar 24, 2024

> A better way would be to make them respect the order in which they're added
It is not possible since enchantments are stored as sum of all adds and multiply
changing it is much higher level task than i can afford

@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. Code: Tests Measurement, self-control, statistics, balancing. [Markdown] Markdown issues and PRs labels Mar 24, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Mar 26, 2024
@Maleclypse Maleclypse merged commit 92d29ce into CleverRaven:master Mar 27, 2024
26 checks passed
@GuardianDll GuardianDll deleted the 1234 branch March 27, 2024 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. <Documentation> Design documents, internal info, guides and help. json-styled JSON lint passed, label assigned by github actions [Markdown] Markdown issues and PRs Mechanics: Enchantments / Spells Enchantments and spells
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants