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

Add perceived kwarg to pain_eval math function, apply it in Mind Over Matter #72938

Merged
merged 7 commits into from
May 3, 2024

Conversation

Standing-Storm
Copy link
Contributor

@Standing-Storm Standing-Storm commented Apr 9, 2024

Summary

Infrastructure "Add perceived kwarg to pain_eval math function, apply it in Mind Over Matter"

Purpose of change

While investigating #72882, I discovered that u_pain() checks the absolute pain the character suffers, not the relative pain they're feeling, taking into account any effects that ameliorate the absolute pain (such as painkillers). That seems like a useful function to be able to check.

Fixes #72882.

Describe the solution

Add a perceived kwarg to the pain_eval function, as suggested by Andrei8l and implemented by Guardian DII. I just uploaded the changes.

In Mind Over Matter, changed the function that disables your powers to check u_pain('type': 'perceived'), not u_pain()

Describe alternatives you've considered

Testing

Followed the reproduction instructions in the above issue: set pain to 50, took 2 codeine, waited 15 minutes. Results--powers were usable even though debug menu showed current pain as 48. When pain 50 was assigned, powers were still unusable.

Also GuardianDII tested it and told me it worked.

Additional context

Thank you GuardianDII for giving me the answer since I've been remodeling the condo over the weekend and haven't had time to look up how kwargs work.

@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. NPC / Factions NPCs, AI, Speech, Factions, Ownership [JSON] Changes (can be) made in JSON Mods Issues related to mods or modding [C++] Changes (can be) made in C++. Previously named `Code` Monsters Monsters both friendly and unfriendly. [Markdown] Markdown issues and PRs EOC: Effects On Condition Anything concerning Effects On Condition Mods: Mind Over Matter labels Apr 9, 2024
@Standing-Storm Standing-Storm changed the title Initial commit Add Add u/n_perceived_pain math function, apply it in Mind Over Matter Apr 9, 2024
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-requesting reviews from non-collaborators: @andrei8l

@github-actions github-actions bot added <Bugfix> This is a fix for a bug (or closes open issue) Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Apr 9, 2024
@andrei8l
Copy link
Contributor

andrei8l commented Apr 9, 2024

I think a kwarg for u_pain() would be better. Based on your description, the key would be absolute with the default value true. You can get some code hints from u_proficiency() which recently started using a true/false kwarg.

if( kwargs.count( "direct" ) != 0 ) {
direct_val = *kwargs.at( "direct" );
}

bool const direct = is_true( direct_val.dbl( d ) );

@Standing-Storm Standing-Storm marked this pull request as draft April 9, 2024 21:32
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Apr 10, 2024
@Standing-Storm Standing-Storm changed the title Add Add u/n_perceived_pain math function, apply it in Mind Over Matter Add perceived kwarg to pain_eval math function, apply it in Mind Over Matter Apr 26, 2024
@Standing-Storm Standing-Storm marked this pull request as ready for review April 26, 2024 20:40
src/math_parser_diag.cpp Outdated Show resolved Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions and removed astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Apr 26, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Apr 29, 2024
@Maleclypse Maleclypse merged commit 8b64122 into CleverRaven:master May 3, 2024
27 checks passed
@Standing-Storm Standing-Storm deleted the perceived-pain branch May 3, 2024 03:48
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 <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style <Documentation> Design documents, internal info, guides and help. EOC: Effects On Condition Anything concerning Effects On Condition [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions [Markdown] Markdown issues and PRs Mods: Mind Over Matter Mods Issues related to mods or modding Monsters Monsters both friendly and unfriendly. NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MoM] Pain limits ignore painkiller effects
3 participants