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

Investigate the dual wielding CalcChanceToHitGun() code #700

Open
Manuel-K opened this Issue Jan 29, 2018 · 6 comments

Comments

Projects
None yet
4 participants
@Manuel-K
Contributor

Manuel-K commented Jan 29, 2018

This came up in #495:

https://github.com/ja2-stracciatella/ja2-stracciatella/blob/master/src/game/Tactical/Weapons.cc#L2169

I do not understand the that code block at all. The logic seems to be:
If we do not use a two-handed weapon, we assume that we are dual-wielding and:

  • give a penalty to SMGs.
  • if the soldier is not ambidextrous and !IsValidSecondHandShot() is true penalize the hit chance by AIM_PENALTY_DUAL_PISTOLS.

The second part seems correct, because IsValidSecondHandShot() checks if the soldier has two weapons.
The first part does not do that. The TODO0007 note mentions this as well: “Deduct AIM_PENALTY_SMG when firing a SMG even when second hand is free?”

Note: The questionable code is part of the original source code release.

@JAsmine-ja2

This comment has been minimized.

Show comment
Hide comment
@JAsmine-ja2

JAsmine-ja2 Jan 30, 2018

Collaborator

I'm not sure if this is relevant, but AFAIR, when holding a one-handed gun in one hand and an item (e.g. a break light) in the other hand, the CtH is penalized to simulate that the merc is holding the gun with only one hand.

Collaborator

JAsmine-ja2 commented Jan 30, 2018

I'm not sure if this is relevant, but AFAIR, when holding a one-handed gun in one hand and an item (e.g. a break light) in the other hand, the CtH is penalized to simulate that the merc is holding the gun with only one hand.

@DSeyka

This comment has been minimized.

Show comment
Hide comment
@DSeyka

DSeyka Jan 30, 2018

Not an expert on reading the code but it seems like SMGs are being given a penalty in all cases (so even when second hand is empty), which is probably not intended.

DSeyka commented Jan 30, 2018

Not an expert on reading the code but it seems like SMGs are being given a penalty in all cases (so even when second hand is empty), which is probably not intended.

@Manuel-K

This comment has been minimized.

Show comment
Hide comment
@Manuel-K

Manuel-K Jan 30, 2018

Contributor

@DSeyka Yes, that's exactly what it does.

Contributor

Manuel-K commented Jan 30, 2018

@DSeyka Yes, that's exactly what it does.

@lynxlynxlynx

This comment has been minimized.

Show comment
Hide comment
@lynxlynxlynx

lynxlynxlynx Jan 30, 2018

Member

Not a weapon expert, but since SMGs have longer barrels than guns, I don't see a good reason why they would be less accurate (should be more at the same distance), if both are fired two-handed. I could see the penalty making sense for one-handed firing (including dual-wielding), since SMGs are heavier.

Member

lynxlynxlynx commented Jan 30, 2018

Not a weapon expert, but since SMGs have longer barrels than guns, I don't see a good reason why they would be less accurate (should be more at the same distance), if both are fired two-handed. I could see the penalty making sense for one-handed firing (including dual-wielding), since SMGs are heavier.

@JAsmine-ja2

This comment has been minimized.

Show comment
Hide comment
@JAsmine-ja2

JAsmine-ja2 Jan 30, 2018

Collaborator

Agree. Dual wielding (or one handedly firing) SMGs resulting in slightly lower CtH compared to dual wielding (firing w/ one hand) pistols seems okay to me.
Penalizing SMGs when firing it two-handed seems wrong to me.

Collaborator

JAsmine-ja2 commented Jan 30, 2018

Agree. Dual wielding (or one handedly firing) SMGs resulting in slightly lower CtH compared to dual wielding (firing w/ one hand) pistols seems okay to me.
Penalizing SMGs when firing it two-handed seems wrong to me.

@DSeyka

This comment has been minimized.

Show comment
Hide comment
@DSeyka

DSeyka Jan 30, 2018

Well, it hardly makes any sense to me to apply a flat penalty to weapon type in the code; it'd make more sense to lower item stats themselves if that was the intention.
I'm tempted to say that it's an incomplete vanilla game feature which should probably work like JAsmine-ja2 describes.

DSeyka commented Jan 30, 2018

Well, it hardly makes any sense to me to apply a flat penalty to weapon type in the code; it'd make more sense to lower item stats themselves if that was the intention.
I'm tempted to say that it's an incomplete vanilla game feature which should probably work like JAsmine-ja2 describes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment