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

Fix is_critical checks #112

Closed
burner1024 opened this issue Feb 7, 2023 · 6 comments · Fixed by #140 or #142
Closed

Fix is_critical checks #112

burner1024 opened this issue Feb 7, 2023 · 6 comments · Fixed by #140 or #142
Assignees

Comments

@burner1024
Copy link
Member

is_critical is used in stat checks sometimes, that doesn't work.
Need to check the code for this and replace with custom implementation.

@burner1024 burner1024 self-assigned this Feb 7, 2023
@burner1024
Copy link
Member Author

It's actually worse: according to @NovaRain's research, is_critical in skill checks takes into account PC critical chance for calculating when to upgrade a success to a critical success.
And critical chance is affected by perks/traits such as More Criticals. Which means combat perks affect non-combat mechanics, which I consider another bug.
Maybe it should be fixed in sfall, or maybe the scripts can be switched to script-only critical implementation. Anyway, for now it's just a note to keep in mind.

@NovaRain
Copy link

NovaRain commented Feb 8, 2023

is_critical in skill checks takes into account PC critical chance for calculating when to upgrade a success to a critical success.

It's roll_vs_skill script function takes PC critical chance into account when determining whether a success roll can be upgraded to a critical success.
https://github.com/alexbatalov/fallout2-re/blob/main/src/int/support/intextra.c#L689
https://github.com/alexbatalov/fallout2-re/blob/main/src/game/skill.c#L424
https://github.com/alexbatalov/fallout2-re/blob/main/src/game/roll.c#L67
https://github.com/alexbatalov/fallout2-re/blob/main/src/game/roll.c#L83

@burner1024
Copy link
Member Author

burner1024 commented Feb 8, 2023

Right, I misspoke. is_critical just checks the roll, mods are applied in actual roll.

@burner1024
Copy link
Member Author

I think I was wrong in my second comment, trait modifiers seem to be applied separately.
And it does look like crit chance only counts on success roll. I guess... it's acceptable.

@burner1024
Copy link
Member Author

burner1024 commented Mar 27, 2024

As far as I understand, ROLL enums are sequential integer values in engine, so it should be enough to replace just the one stat roll function.

burner1024 added a commit that referenced this issue Mar 27, 2024
burner1024 added a commit that referenced this issue Mar 29, 2024
burner1024 added a commit that referenced this issue Mar 29, 2024
burner1024 added a commit to BGforgeNet/Fallout2_Restoration_Project that referenced this issue Mar 31, 2024
burner1024 added a commit to BGforgeNet/Fallout2_Restoration_Project that referenced this issue Mar 31, 2024
NovaRain added a commit to NovaRain/Fallout2_Restoration_Project that referenced this issue Mar 31, 2024
NovaRain added a commit to NovaRain/Fallout2_Restoration_Project that referenced this issue Mar 31, 2024
@burner1024
Copy link
Member Author

I think I half-assed this.

variable stat_check = do_check(who, stat, mod);

should be is_success(do_check)

Perception_Roll:=do_check(dude_obj,STAT_pe,PERCEPTION_BONUS);
set_local_var(LVAR_Extended_Look,Perception_Roll);
end
if (is_critical(local_var(LVAR_Extended_Look))) then begin

Here perception roll still uses do_check. There are a few more cases like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants