aliens

Author Topic: [DONE] Highest reaction priority for preferred weapon  (Read 3826 times)

Online Delian

  • Colonel
  • ****
  • Posts: 496
    • View Profile
[DONE] Highest reaction priority for preferred weapon
« on: June 24, 2022, 02:25:46 am »
I have a soldier that has two weapons: A melee weapon, and a firearm (specialWeapon with specialUseEmptyHand: true) with a melee attack.
I right-click on the firearm to give its hand reaction priority.
An enemy walks into melee range. The soldier reacts with a melee attack.
Expected behavior:
The soldier should react with the preferred hand - the melee attack of the firearm.
Actual behavior:
The soldier reacts with the melee weapon.

In practice, I'm playing xpz and I have a soldier with built-in kung fu and a shield. The soldier reacts with the shield instead of kung-fu.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9085
    • View Profile
Re: [Bug] Melee reaction priority
« Reply #1 on: June 24, 2022, 08:31:45 am »
That's a feature.

It's always melee first, gunbutt second, firearm third. Regardless of indicated preference.

Online Delian

  • Colonel
  • ****
  • Posts: 496
    • View Profile
Re: [Bug] Melee reaction priority
« Reply #2 on: June 24, 2022, 10:01:30 am »
I'm ok with it being default behavior. It's actually correct that in a melee range, melee weapon is prioritized over gunbutt, because if you have a pistol and a sword, then the sword should be used.

However, I still think that if I did indicate priority, then gunbutt should be prioritized over melee weapon. Think about it. If you have a ranged weapon and a melee weapon, what would priority do?
It's certainly not for a ranged attack, since a melee weapon can't attack at range. If you have only one ranged weapon, then priority obviously won't change anything.
So it's simply logic that the player wanted to set up priority for a melee attack. This isn't a maybe; in this case we can say with 100% certainty that this is what the player wanted. That the player wanted to prioritze the melee attack of one hand over the melee attack of the other hand.

So yeah, I can see the reason why it's melee first and gunbutt second by default. But we're talking about the "manual override of default behavior" here, which is what the preference indication does. Or should do?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9085
    • View Profile
Re: [Bug] Melee reaction priority
« Reply #3 on: July 05, 2022, 04:56:00 pm »
I went through all the same thoughts when I was analyzing and implementing this.
It's not that I disagree, it's just always more complicated than what it looks like and compromises are made.

My improvements over the already-available OG and OXC features (of "last active hand") are:
1/ keep it OXC-compatible (OXC also always does melee first, gunbutt second, hardcoded)
2/ visualize it (yellow dot... far from best, but at least something)
3/ allow to select also non-hand special weapons (OG/OXC only supported what's really in hand... no lobster claws, no "martial arts", etc.)

If I implement what you want, I will break compatibility with OXC from point 1... and will be publicly hung by my balls by purists and nitpickers... which I generally try to avoid.


I'll put this on my todolist again to see what I can do... but I can't promise anything.

Online Delian

  • Colonel
  • ****
  • Posts: 496
    • View Profile
Re: [Bug] Melee reaction priority
« Reply #4 on: July 05, 2022, 10:34:09 pm »
Thanks.

I think that gunbutts are modded behavior, so it shouldn't apply to pure games either way...
Then again, I also think that priority should've been implemented as a "strict" priority, instead of the current "only if it's the same type of weapon and attack", because it would provide for a less confusing user experience. But I digress.

Offline N7Kopper

  • Captain
  • ***
  • Posts: 61
    • View Profile
Re: [Bug] Melee reaction priority
« Reply #5 on: July 14, 2022, 02:31:37 pm »
Thanks.

I think that gunbutts are modded behavior, so it shouldn't apply to pure games either way...
Then again, I also think that priority should've been implemented as a "strict" priority, instead of the current "only if it's the same type of weapon and attack", because it would provide for a less confusing user experience. But I digress.
Modded relative to OpenXCom, not the original engine; and even in the original engine, adding rifle butts was just a matter of putting the attack option back in, because it was removed last-minute to the point that even the manual has it as a feature in the screenshots. (You could even do it by merging them with a stun rod!)

Honestly, I think it would be best to make this a toggle, like with extended reload costs - the default is 15 TUs to reload no matter what, but you can choose to add the TUs it takes to move the ammo to your off-hand to reload costs if you want.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9085
    • View Profile
Re: [DONE] Highest reaction priority for preferred weapon
« Reply #6 on: February 07, 2024, 09:37:59 am »
The preferred weapon (marked with a yellow dot) should now be used for reactions (whenever possible) regardless of the other weapon's type.

If not possible (e.g. melee weapon at range, not enough TUs, not enough ammo, etc.), the other weapon will get a chance to shine.

Please test.

https://github.com/MeridianOXC/OpenXcom/commit/1b18f38c52e303d95c3d0afefe477576a60341e6
« Last Edit: February 07, 2024, 09:39:34 am by Meridian »

Online Delian

  • Colonel
  • ****
  • Posts: 496
    • View Profile
Re: [DONE] Highest reaction priority for preferred weapon
« Reply #7 on: February 19, 2024, 07:00:57 pm »
Works great, and much less confusing than the original implementation.