sfall-team / sfall

sfall - Engine modifications for Fallout 2
https://sfall-team.github.io/sfall/
GNU General Public License v3.0
336 stars 40 forks source link

HOOK AFTERHITROLL and Jinxed(and Also Slayer and Sniper) #527

Open dekrus opened 2 months ago

dekrus commented 2 months ago

Arg0 of HOOK_AFTERHITROLL does not correspond to the result of the attack if the result was changed by perks (JINXED, Slayer, Sniper).

If a critical miss occurs due to a Jinxed check, arg0 will be 1 instead of 0. Similarly with the critical hit of “Assassin or Sniper” arg0 = 2 instead of 3.

Also "set_sfall_return(miss|hit)" can turn into a critical miss/hit under the influence of these perks.

It seems to me that the hook should return the “real” result of the attack and be able to change it.

phobos2077 commented 2 months ago

Well you can't change that without possibly breaking some mods.

Hook happens at this line: https://github.com/alexbatalov/fallout2-re/blob/main/src/game/combat.c#L3765

dekrus commented 2 months ago

Then there is no need to change anything. It's easier to temporarily remove these perks/traits than to risk breaking mods