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

Unhardcode and limbify attack vectors take two: Electric boogaloo #73064

Merged
merged 16 commits into from
May 9, 2024

Conversation

Venera3
Copy link
Member

@Venera3 Venera3 commented Apr 17, 2024

Summary

Features "Unhardcode and limbify attack vectors"

Purpose of change

MA attack vectors are hardcoded, undocumented, and prevent further limbification.
Revival of #67883

Describe the solution

Went through a pretty significant restructuring.

  • turn attack vectors into their own JSON object
  • Add filtering based on selected bodypart encumbrance/health
  • Actually integrate into the melee attack sequence
  • Define strike surface in a limb-compatible way
  • Deprecated attack_override and crit_tec_id for redundancy
  • Deprecated the UNARMED_DAMAGE_BONUS mutation flag, and routed the traits using it though integrated armors for the time being (Magiclysm's dragon claws and demon tail)
  • Add unarmed damage for sub_bodyparts
  • Define force modification to e.g. only use one arm's limb scores for the lifting strength It will be a necessary step towards multiwield but strictly speaking not necessary for the issue at hand and depends on how the modifier chaching will look.
  • Allow defining the number of used limbs to facilitate using only the unarmed damage boni of the involved limbs For now we stay at one contact area, otherwise the melee attack logic needs to deal with multiple weapons at the same time so see the previous point. It does mean the tech repeat hack will need to stay for the time being
  • Deprecate old vectors and things pointing at them
  • Add unarmed attacks to vanilla limbs - a kick for each feet, a basic punch and a headbutt. Going forward untyped unarmed attacks shouldn't really be a thing
  • Update all techs, check tech logic - filtering enough legs for kicks, that sort of thing
  • Move basic fang attacks and co over to using their contact area armor for the damage instead of a flat bonus
  • Documentation
  • Eleven billion unit tests Best I can do is three.
  • Calculate unarmed damage from the material covering the actual contact area (currently steel-toed boots would do the same damage on a toe hit as on a heel one) silly me thought armor unarmed damage was dynamically generated based on materials/properties. how naive I was

Describe alternatives you've considered

Stick to limb numbers but this will be huge enough as it is.
Leave attack_override, but vectors as such make it redundant.

Testing

Compiles, complains about wrong definitions.
Tech filters work, vector choice takes damages into account properly, restricted natural attacks don't apply their damage.

Additional context

Since the sublimb system was set up with armor in mind not strike surfaces I had to take some liberties - punches use your fingers, that sort of thing. The good news is that's all JSON to fix, the bad news is I won't audit every armor item ever to add every tiny strike surface. I've also had limited patience to tracking down a video of most moves so the field's open if somebody wants to add a vector just for pinching with your third finger while punching.

Moved the Fang techs into their dedicated file and removed their intrinsic movecost/damage (moving the latter to the integrated armor bit).

@github-actions github-actions bot added [JSON] Changes (can be) made in JSON Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies [C++] Changes (can be) made in C++. Previously named `Code` Melee Melee weapons, tactics, techniques, reach attack Martial Arts Arts, Techniques, weapons and anything touching martial arts. Limbs Limbs, mutable limbs, and code related to them. <Enhancement / Feature> New features, or enhancements on existing astyled astyled PR, label is assigned by github actions labels Apr 17, 2024
@GuardianDll
Copy link
Member

Do you happen to touch this piece of code?

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();
}
}

I have pending #70308 related to it, tho it might not be useful for limbs

@Venera3 Venera3 force-pushed the limb_attack_vector branch from 6487bc4 to aefb432 Compare May 2, 2024 07:43
@Venera3
Copy link
Member Author

Venera3 commented May 2, 2024

Do you happen to touch this piece of code?

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();
}
}

I have pending #70308 related to it, tho it might not be useful for limbs

The problem is we chose the technique first using the wielded weapon (IE the ammo-and-tech-giving armor is not the weapon yet), evaluate if the weapon has ammo (it doesn't) and disable the technique.
Mid-term I do want to decouple techs from crits, which means we get to first choose which attack we are attempting including vector and weapon used, but that's out of scope for this PR.

@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. Mods Issues related to mods or modding Bionics CBM (Compact Bionic Modules) [Markdown] Markdown issues and PRs Mods: Magiclysm Anything to do with the Magiclysm mod Items: Armor / Clothing Armor and clothing Mods: Xedra Evolved Anything to do with Xedra Evolved json-styled JSON lint passed, label assigned by github actions Code: Tests Measurement, self-control, statistics, balancing. Mods: MMA Mythical Martial Arts mod astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions and removed astyled astyled PR, label is assigned by github actions labels May 2, 2024
@Venera3 Venera3 marked this pull request as ready for review May 4, 2024 18:41
@github-actions github-actions bot requested review from KorGgenT and Maleclypse May 4, 2024 19:04
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-requesting reviews from non-collaborators: @Hymore246

@Venera3 Venera3 force-pushed the limb_attack_vector branch from a424102 to 5e01a69 Compare May 4, 2024 19:15
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label May 4, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label May 7, 2024
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label May 7, 2024
You get verified for that, mister
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions Bionics CBM (Compact Bionic Modules) [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. <Documentation> Design documents, internal info, guides and help. <Enhancement / Feature> New features, or enhancements on existing Items: Armor / Clothing Armor and clothing [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Limbs Limbs, mutable limbs, and code related to them. [Markdown] Markdown issues and PRs Martial Arts Arts, Techniques, weapons and anything touching martial arts. Melee Melee weapons, tactics, techniques, reach attack Mods: Magiclysm Anything to do with the Magiclysm mod Mods: MMA Mythical Martial Arts mod Mods: Xedra Evolved Anything to do with Xedra Evolved Mods Issues related to mods or modding Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants