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

needs_ammo checks only equipped weapon, ignoring the armor that can provide technique #70308

Open
GuardianDll opened this issue Dec 19, 2023 · 5 comments
Labels
<Bug> This needs to be fixed Martial Arts Arts, Techniques, weapons and anything touching martial arts. (P3 - Medium) Medium (normal) priority (S2 - Confirmed) Bug that's been confirmed to exist

Comments

@GuardianDll
Copy link
Member

Describe the bug

continuation of #69736, and heavy CQC system still doesn't work :(

Attach save file

n/a

Steps to reproduce

Spawn advanced heavy cqc from xedra evolved mod, equip it, turn on DF_MELEE debug mode
punch debug monster for a few times
see Pneumatic Strike is rejected because "no ammo", while ammo is clearly here

Expected behavior

spending ammo from armor, as expected

Screenshots

image
image

Versions and configuration

  • OS: Windows
    • OS Version: 10.0.19045.3803 (22H2)
  • Game Version: 85926f2 [64-bit]
  • Graphics Version: Tiles
  • Game Language: English [en]
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    Slowdown Fungal Growth [no_fungal_growth],
    Bionic Professions [package_bionic_professions],
    SpeedyDex [speedydex],
    Stats Through Kills [stats_through_kills],
    Stats Through Skills [StatsThroughSkills],
    Magiclysm [magiclysm],
    Xedra Evolved [xedra_evolved]
    ]

Additional context

the issue is this code checking only cur_weapon

Cataclysm-DDA/src/melee.cpp

Lines 1853 to 1865 in 85926f2

if( technique.needs_ammo ) {
const itype_id current_ammo = cur_weapon.get_item()->ammo_current();
// if the weapon needs ammo we now expend it
cur_weapon.get_item()->ammo_consume( 1, pos(), this );
// thing going off should be as loud as the ammo
sounds::sound( pos(), current_ammo->ammo->loudness, sounds::sound_t::combat, _( "Crack!" ), true );
const itype_id casing = *current_ammo->ammo->casing;
if( cur_weapon.get_item()->has_flag( flag_RELOAD_EJECT ) ) {
cur_weapon.get_item()->force_insert_item( item( casing ).set_flag( flag_CASING ),
pocket_type::MAGAZINE );
cur_weapon.get_item()->on_contents_changed();
}
}

Can't fix it on my own

@GuardianDll GuardianDll added the (S1 - Need confirmation) Report waiting on confirmation of reproducibility label Dec 19, 2023
@BrettDong BrettDong added the Martial Arts Arts, Techniques, weapons and anything touching martial arts. label Dec 23, 2023
@Procyonae
Copy link
Contributor

Looking at all the different places weapon specific techniques are looked at it feels like it would be better to use get_all_techniques more and either have it return techniques associated with their source or just all sources that have techniques to be accessed at more appropriate points.

I started attacking it but I don't think the way I'm going about it is sensible master...Procyonae:Cataclysm-DDA:MoreArmorTechniqueSupport

@GuardianDll
Copy link
Member Author

alternatively one can make EoC/math effect that consume charges from an item, and then it can be emulated entirely using EoC

@Procyonae
Copy link
Contributor

Procyonae commented Jan 18, 2024

I think proper technique source tracking is more important with limbs are becoming more relevant and unarmed weapons being armour now, it'd also make auto-switching for #70969 alot cleaner for example too

Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

@github-actions github-actions bot added the stale Closed for lack of activity, but still valid. label Feb 17, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 18, 2024
@Venera3
Copy link
Member

Venera3 commented May 2, 2024

A consequence of the melee attack logic (melee.cpp:melee_attack_abstract):

  • Start with the wielded weapon for the to-hit calculation
  • If you hit pick a technique to use passing the wielded weapon
    • Check if your weapon has ammo (it doesn't, since the game thinks you're attacking with the wielded weapon and fails)
  • With the returned technique/vector replace your weapon with the matching armor
  • Calculate base damage
  • Perform the actual tech

Restructuring the logic to choose an attempted tech first should fix that, and is something I want to get around to eventually.

@Venera3 Venera3 reopened this May 2, 2024
@Venera3 Venera3 added <Bug> This needs to be fixed (S2 - Confirmed) Bug that's been confirmed to exist (P3 - Medium) Medium (normal) priority and removed (S1 - Need confirmation) Report waiting on confirmation of reproducibility stale Closed for lack of activity, but still valid. labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed Martial Arts Arts, Techniques, weapons and anything touching martial arts. (P3 - Medium) Medium (normal) priority (S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

No branches or pull requests

4 participants