[0.9.002-BACKER#2105] Ranged Critical Hits and Aimed Shot are Nonfunctional

Napargonaga

Well-Known Member
Dec 7, 2021
57
3
32
Right now, some extra ranged properties, such as Critical Hits and the smuggler's "Aimed Shot" will not proc against enemies. Not even having the perk "Alpha Strike" can get a crit to proc with a ranged weapon. Melee weapons on the other hand seem to be unaffected: random crits, alpha strike crits, and sneak attack are working fine.
Also, I cannot get burn to proc with a gun that has a burn chance in over 100 attacks that lower HP. This seems very unlikely. Especially considering "predator talons" can get burn to proc normally.


This is a screenshot showing alpha strike failing with a gun but succeeding with a melee weapon.
Alpha Strike Failure.png
 

OrangeBurner

Well-Known Member
Mar 13, 2022
305
72
From my understanding of the combat code (It's not much but hey at least I can try to help):

They is a function called: applyDamage(baseDamage, attacker, target, special = "") in combat.js.

This then calls calculateDamage(baseDamage, attacker, target, special).
calculateDamage is where crits are calculated. It does different calculations based on the special parameter (which is usually something like "melee" or "ranged").
The problem seems to be that when calculating range attacks the special parameter is given "" instead of "ranged".


I think the problem is in RangedAttack() (which is on, line 992 of CombatAttacks.js:
concentratedFire(attacker, target, CombatAttacks.SingleRangedAttackImpl(attacker, target, asFlurry, (append ? "append":"")));

I think this because the code above actually gives SingleRangedAttackImpl a special parameter of "" when append is false (instead of "ranged").
This then goes on to give applyDamage() a special parameter of "" meaning then that it won't treat it as a actual ranged attack and so it ignores things like crit damage.

I think it should be:
concentratedFire(attacker, target, CombatAttacks.SingleRangedAttackImpl(attacker, target, asFlurry, (append ? "append":"ranged")));

Then again I have no idea how much of this was actually helpful or even if I correctly identified the problem.
 

Napargonaga

Well-Known Member
Dec 7, 2021
57
3
32
Looking through it, even with the change you suggested, it would mean that something like rapid fire would not be able to proc crits at all. SingleRangedAttackImp would keep special as "append" during the call to applyDamage, which is still not an attack type calculateDamage recognizes.
 

OrangeBurner

Well-Known Member
Mar 13, 2022
305
72
"append" seems to only apply to "Flurry" type attacks that usually go with a 'normal' attack (Something like Rapid Fire's 2 extra attacks).
It's arguable weather or not if crits should apply to the extra attacks given that they are treated differently in the code (All I can say on the matter is that these "Flurry" attacks do crit on the Legacy version)

Honestly, I don't know why RangedAttack even uses "append" anyway. (Especially given that these "Flurry" type attacks just call SingleRangedAttackImp directly instead of going through RangedAttack)
MeleeAttack doesn't seem to use "append" at all (which is probably why it doesn't have these problems).
 

mikethor007

Well-Known Member
Jun 26, 2021
1,179
810
52
Indeed this is a bug, and a rather recent one. Last time I played I distinctly remember that at the very least the Aimed Shot perk was working.

Now it seems it is not.
 

OrangeBurner

Well-Known Member
Mar 13, 2022
305
72
If this bug is recent it might have something to do with this change (possibly?)
TiTS 0.9.001, Builds 2089 and up:
- Some multi-hit combat attacks should be better about presenting their output. (Fenoxo)
 

mikethor007

Well-Known Member
Jun 26, 2021
1,179
810
52
This one seems to have been fixed in a recent build, I've started seeing both Criticals and Aimed Shots.