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

Pain. Incorrect display of characteristic penalty. #72854

Closed
IdleSol opened this issue Apr 5, 2024 · 3 comments · Fixed by #74116
Closed

Pain. Incorrect display of characteristic penalty. #72854

IdleSol opened this issue Apr 5, 2024 · 3 comments · Fixed by #74116
Labels
(S2 - Confirmed) Bug that's been confirmed to exist

Comments

@IdleSol
Copy link
Contributor

IdleSol commented Apr 5, 2024

Describe the bug

In the character window (@), in the effects section (c), the penalties to characteristics depending on pain are incorrectly specified.

Most likely they just forgot about them when they introduced the changes #72687.

The gif shows the characteristics at 20, 30, and 60 pain.

Attach save file

N/A

Steps to reproduce

Create a character and set the pain value. Then compare the real characteristics with the specified penalties.

Expected behavior

N/A

Screenshots

pain

Versions and configuration

cdda-windows-tiles-x64-2024-04-05-0445

Additional context

No response

@IdleSol IdleSol added the (S1 - Need confirmation) Report waiting on confirmation of reproducibility label Apr 5, 2024
@GuardianDll
Copy link
Member

/confirmed, tho in the world i don't understand why it happens, since effect reads exactly same function that was edited

@github-actions github-actions bot added (S2 - Confirmed) Bug that's been confirmed to exist and removed (S1 - Need confirmation) Report waiting on confirmation of reproducibility labels Apr 9, 2024
@IdleSol
Copy link
Contributor Author

IdleSol commented Apr 10, 2024

Maybe I'm going to say something stupid, but maybe it's about different types? float vs int

float penalty_mod = pain * 0.01f;

penalty_mod = float

ret.intelligence = enchantment_cache ...

ret.perception = float

ret.perception = std::max( ret.perception, 0 );

0 = int

@osuphobia
Copy link
Contributor

I found out why this bug occurs.
When calling Character::get_pain_penalty in Character::disp_info, we are not calculating the displayed penalty with the stats before penalties applied, but with the numbers after the penalties applied.
So, with 50 pain and intelligence 4 (8), ppen.intelligence is not 8*50*0.01 = 4, but 4*50*0.01 = 2.

Also, despite the doc and comment saying // Also not make character has 0 stats, the stats of character can still get lower than 1, I'll fix this also.
You can see that, with 100 pain, you got intelligence 0 (8), and ppen.intelligence is now 0*100*0.01 = 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
(S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants