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

Added attack vectors to martial arts techniques #53954

Merged
merged 23 commits into from
Feb 25, 2022
Merged

Added attack vectors to martial arts techniques #53954

merged 23 commits into from
Feb 25, 2022

Conversation

Hymore246
Copy link
Contributor

@Hymore246 Hymore246 commented Jan 1, 2022

Summary

Balance "Added attack vectors to martial arts techniques"

Purpose of change

Adds a way to attack with different parts off the body with martial arts techniques
Fixes #48410
Fixes #52001

Describe the solution

Currently, all martial arts techniques are performed with the player's held weapon for melee techniques and with the "hands" for unarmed techniques. There is no way at the moment to designate what part of the body you are attacking with or what sort of attack you are performing. As a result, kicks are performed with the player's arms and you end up with problems such as #48410. It is also impossible to perform an unarmed attack while armed. For example, Karate cannot perform a Roundhouse Kick while holding a quarterstaff.

The solution is to add "attack vectors" to every technique. An attack vector tells the game how an attack will be performed by the user. Boxing's Jab, Cross, and Uppercut uses HAND while Karate's Roundhouse Kick uses FOOT. It will be possible to designate multiple attack vectors and the player will be forbidden to use an technique with an attack vector they cannot use. For example, you can't punch if both your hands are broken. Lastly, attack vectors can also be used to designate non-limb attacks such as attacking with a weapon or performing a throw/grapple attack. Below is a list of planned attack vectors, examples of attacks that will use the attack vector, and the requirement to use the attack vector:

LIST OF ATTACK VECTORS

  • HAND - Any technique that hits with any part of the hand (backhand, jab, hammer fist). Can be used as long as at least one hand/arm limb is not broken.
  • FINGERS - Any technique that hits with the fingers (eye gouge, spearhand). Can be used as long as at least one hand/arm limb is not broken.
  • PALM - Any technique that hits with the palm of the hand(palm strike). Can be used as long as at least one hand/arm limb is not broken.
  • HAND_BACK - Any technique that hits with the back of the hand(backfist, backhand slap). Can be used as long as at least one hand/arm limb is not broken.
  • WRIST - Any technique that hits with the wrist (crane strike). Can be used as long as at least one hand/arm limb is not broken.
  • ARM - Any technique that hits with the arm itself (clothesline). Can be used as long as at least one hand/arm limb is not broken.
  • ELBOW - Any technique that hits with an elbow (elbow strike). Can be used as long as at least one hand/arm limb is not broken.
  • SHOULDER - Any technique that hits with the upper part of the arm (shoulder check). Can be used as long as at least one hand/arm limb is not broken.
  • FOOT - Any technique that hits with any part of the foot (roundhouse kick, foot stomp, heel drop). Can be used only if both legs are not broken. You need one functional leg to perform the attack and another functional leg to balance on.
  • LOWER_LEG - Any technique that hits with shin (Muay Thai kicks). Can be used only if both legs are not broken. You need one functional leg to perform the attack and another functional leg to balance on.
  • KNEE - Any technique that hits with the knee (knee bash). Can be used only if both legs are not broken. You need one functional leg to perform the attack and another functional leg to balance on.
  • HIP - Any technique that hits with the hips or buttocks (Peach Bomber, R. Mika's Flying Peach). Can be used only if both legs are not broken. You need one functional leg to perform the attack and another functional leg to balance on.
  • TORSO - Any technique that hits with the center mass of the user's body (flying body splash, throwing yourself at an enemy). Can always be used because if your Torso is broken, you are dead.
  • HEAD - Any technique that hits with the user's head such as a headbutt. Can always be used because if your Head is broken, you are dead.
  • WEAPON - Any technique the requires a held item to perform (see any weapon style). Can be used if the user is holding a valid style weapon for their martial art and at least one hand/arm is not broken.
  • THROW - Any technique that forcefully moves an opponent (judo throws, suplex). Can be used only if both hands/arms are not broken.
  • GRAPPLE - Any technique that maintains contact with an opponent and squeezes (chock, headlock), bends (Krav Maga's Arm Breaker), or twists (arm twist) some part of the opponent. Can be used only if both hands/arms are not broken.

NEW MARTIAL ARTS ATTRIBUTES

Martial art techniques have two new attributes attack_vectors and attack_vectors_random.

attack_vectors is a technique attribute that indicates a list of possible ways to use the technique. For example, Cross would be "attack_vectors": [ "HAND" ]. This attribute works using priority. For example, if a technique had "attack_vectors": [ "WEAPON", "HAND" ], the game would always try to hit with a style weapon first and only tries to hit with your hands if you had no weapon.

attack_vectors_random works the same way as attack_vectors but picks randomly from its list instead of using priority. For example, Power Kick would be "attack_vectors_random": [ "LEG", "FOOT" ] and could hit with either the leg or foot. This attribute will only be used if all choices from attack_vectors are not usable.

Both attack_vectors and attack_vectors_random are optional attributes and will not cause JSON errors if either is excluded from a technique. However, if both attributes are excluded (i.e. empty lists) the technique will never be able to trigger since no attack vector was given. Defensive technique (feint and grab break) do not need either attribute and will be ignored even if given.

UPDATE TO DAMAGE FORMULAS

Because #41209 added a way to use gloves to boost unarmed damage, this PR will expand on that idea and allow all forms of clothing to improve unarmed damage. This means your FOOT techniques will do more damage if your were wearing something like Steel-Toed Boots. The damage formulas will also be updated to allow you to attack with an unarmed technique while holding a weapon such as Karate using a Roundhouse Kick while holding a quarterstaff.

LIST OF TECHNIQUE ATTACK VECTORS

Below is the complete list of all techniques in the CDDA and the MMA mod with their proposed attack vectors:

Martial Art Technique Attack Vector Attack Vector (Random)
Weapon Tech disarm WEAPON, HAND
Weapon Tech Spinning Strike WEAPON
Weapon Tech Wide Strike WEAPON
Weapon Tech Impaling Strike WEAPON
Weapon Tech Brutal Strike WEAPON
Weapon Tech Rapid Strike WEAPON
Weapon Tech Vorpal Strike WEAPON
Weapon Tech Wrap Attack WEAPON
Weapon Tech Sweep Attack WEAPON
Weapon Tech Precise Strike WEAPON
Weapon Tech Disarm WEAPON
Weapon Tech Precise Strike WEAPON
Aikido Counter Throw (block) THROW
Aikido Counter Throw (dodge) THROW
Aikido Disarming Throw (block) THROW
Aikido Disarming Throw (dodge) THROW
Barbaran Montante Impaling Estocada WEAPON
Barbaran Montante Swift Atajo WEAPON
Boxing Cross HAND
Boxing Cross Counter HAND
Boxing Jab HAND
Boxing Uppercut HAND
Brawling Disarm (melee) WEAPON
Brawling Disarm (unarmed) HAND
Brawling Power Hit HAND
Brawling Trip HAND
Capoeira Circle Kick FOOT
Capoeira Sweep Kick FOOT, LOWER_LEG
Capoeira Spin Kick FOOT
Crane Kung Fu Crane Kick FOOT
Crane Kung Fu Crane Strike WRIST
Dragon Kung Fu Dragon Claw HAND
Dragon Kung Fu Dragon Tail FOOT, LOWER_LEG
Dragon Kung Fu Dragon Strike HAND
Eskrima Round Strike WEAPON
Eskrima Fan Strike WEAPON
Eskrima Snap Strike WEAPON
Eskrima Combination Strike WEAPON
Eskrima Stunning Strike WEAPON
Eskrima Low Strike WEAPON
Fencing Fencing Lunge WEAPON
Fencing Compound Attack (Remise) WEAPON
Fencing Compound Attack (Counter Time) WEAPON
Fencing Fencing Riposte WEAPON
Fior Di Battaglia Fencing Riposte WEAPON
Fior Di Battaglia Displace and Hook WEAPON
Fior Di Battaglia High Round Strike WEAPON
Fior Di Battaglia Hook and Drag WEAPON
Fior Di Battaglia Colpo di Grazia WEAPON
Judo Throw THROW
Judo Disarming Throw THROW
Judo Back Throw THROW
Karate Knifehand Strike HAND
Karate Backfist Strike HAND
Karate Roundhouse Kick FOOT
Karate Staff Strike WEAPON
Karate Heavy Staff Strike WEAPON
Krav Maga Jab WEAPON, HAND
Krav Maga Cheapshot WEAPON HAND, FINGERS, ELBOW, LOWER_LEG, FOOT, HEAD
Krav Maga Takedown THROW
Krav Maga Bone Breaker GRAPPLE
Leopard Kung Fu Leopard Fist HAND
Leopard Kung Fu Leopard Swipe HAND
Leopard Kung Fu Leopard Claw HAND
Leopard Kung Fu Leopard Pounce HAND
Medieval Swordsmanship Grab WEAPON
Medieval Swordsmanship Lethal Strike WEAPON
Muay Thai Elbow Strike ELBOW
Muay Thai Power Kick LOWER_LEG, FOOT
Muay Thai Flying Knee KNEE
Ninjutsu Swift Strike (normal) WEAPON HAND, ELBOW, LOWER_LEG, FOOT
Ninjutsu Swift Strike (crit) WEAPON HAND, ELBOW, LOWER_LEG, FOOT
Ninjutsu Assassinate WEAPON
Ninjutsu Ninjutsu Takedown THROW
Niten Ichi-Ryu Flowing Water Cut WEAPON
Niten Ichi-Ryu Red Leaf's Cut WEAPON
Niten Ichi-Ryu Fire and Stone's Cut WEAPON
Niten Ichi-Ryu In-One Timing WEAPON
Pankration Cross HAND
Pankration Kick FOOT
Pankration Grab and Knee KNEE
Pankration Arm Lock KNEE
Pankration Grab and Throw THROW
Silat Hamstring WEAPON
Silat Vicious Precision WEAPON
Silat Dirty Hit WEAPON
Silat Silat Brutality WEAPON
Snake Kung Fu Snake Snap HAND
Snake Kung Fu Snake Strike HAND
Sojutsu Shove WEAPON
Sojutsu Trip WEAPON
Taekwondo Snatch Weapon HAND
Taekwondo Spinning Back Kick FOOT
Taekwondo Side Kick FOOT
Taekwondo Sweep Kick FOOT, LOWER_LEG
Taekwondo Roundhouse Kick FOOT
Tai Chi Disarm HAND
Tai Chi Palm Strike HAND
Tai Chi Grasp the Sparrow's Tail THROW
Tai Chi Double Palm Strike HAND
Tiger Kung Fu Tiger Takedown THROW
Tiger Kung Fu Tiger Palm HAND
Tiger Kung Fu Tiger Claw HAND
Tiger Kung Fu Tiger Rampage HAND
Wing Chun Straight Punch HAND
Wing Chun Straight Punch (Knockback) HAND
Wing Chun L-hook HAND
Wing Chun L-hook (Knockback) HAND
Zui Quan Drunk Fist HAND
Zui Quan Whirling Strikes HAND, FOOT
Debug Mastery low strike HAND
Debug Mastery phasing strike WEAPON, HAND
Desert Wind Burning Blade WEAPON
Desert Wind Inferno Blade WEAPON
Desert Wind Firesnake WEAPON
Desert Wind Ring of Fire WEAPON
Desert Wind Flashing Sun WEAPON
Diamond Mind Insightful Strike WEAPON
Diamond Mind Greater Insightful Strike WEAPON
Hylian Swordsmanship Spin Attack (spin) WEAPON
Hylian Swordsmanship Spin Attack (wide) WEAPON
Iron Heart Disarming Strike WEAPON
Iron Heart Finishing Move WEAPON
Iron Heart Dazing Move WEAPON
Iron Heart Steel Wind WEAPON
Iron Heart Scything Blade WEAPON
Panzer Kunst Kumai Sharinraku FOOT
Panzer Kunst Herzschlag HAND
Panzer Kunst Geschoss Schlag HAND
Pokken Mega Kick FOOT
Pokken Darkest Lariat ARM
Pokken Smart Strike HAND, FOOT, HEAD, TORSO, HEAD
Pokken Low Sweep FOOT, LOWER_LEG
Setting Sun Hydra Slaying Strike WEAPON, HAND
Setting Sun Mighty Throw THROW
Setting Sun Ballista Throw THROW
Shii Cho Disarming Slash WEAPON
Shii Cho Sarlacc Sweep WEAPON
Stone Dragon Mountain Hammer WEAPON, HAND
Stone Dragon Irrestistible Mountain Strike WEAPON, HAND
Stone Dragon Colossus Strike WEAPON, HAND

Testing

Certain techniques such as Karate's Roundhouse Kick should now trigger when holding a staff. Testing this is as simple as holding a staff and attacking with karate a few times.

Wearing different types of clothing and attacking with the same style and technique should cause the average damage done to change.

Finally, breaking limbs that are required for specific techniques should prevent those techniques from triggering when fighting.

Additional context

This all started because I couldn't get Karate's Roundhouse Kick to work while holding a weapon. Sometime you only need to make a minor change for a big impact but other times, the reverse is true.

@bombasticSlacks
Copy link
Contributor

This update is limited by what CDDA determines as body parts. Due to this limitation, some clothing and CBMs can add damage to techniques that doesn't make any sense such as spiked-knuckled gloves making your Knife Hand (hits with the bottom of the hand) stronger. This also affects clothing durability such as having Hot Pants losing durability from a Knee Bash technique despite the clothing not covering that part of the body. Outside of rewriting a good section of game code, this problem isn't possible to fix.

The game has body sublocations. For example at https://github.com/CleverRaven/Cataclysm-DDA/pull/53954/files#diff-2cd8dac3d0903ca1ee60a47c28e09bcb56290214bc8d1fe5cf4afaed108b9d92R710-R711 you could instead specify
covers = worn_item.covers( sub_bodypart_id( "leg_knee_l" ) ) && worn_item.covers( sub_bodypart_id( "leg_knee_r" ) );
and it would check if those hot pants cover the knees.

The list of current sublocations are in bodyparts.json
There aren't any for hands. It would be easy to add them.

@Venera3
Copy link
Member

Venera3 commented Jan 2, 2022

Character anatomy is about to become much more fluid, so I'd advise against using hardcoded bodypart ids. You could instead filter by bodypart type + a bool for nonstandard attacks, and accept the vector as valid if the player has a functioning limb of that type that doesn't deviate too much from normal anatomy to be usable.

Something like nonstandard_allowed for the tech definition and a matching NONSTANDARD_ATTACK flag on the bodypart, similar to how the block code filters NONSTANDARD_BLOCK if the MA doesn't allow for blocking with your nifty new tail.

@PatrikLundell
Copy link
Contributor

Building on Venera3's comment, FOOT, LEG, THROW. and GRAPPLE currently describe them as being used when both limbs are available. For THROW and GRAPPLE I'd say at least two "arms" (even for e.g. a six armed naga), while FOOT and LEG would require > number of legs / 2, so two legged critters would still require both, while centaurs and other quadrupeds would require at least 3 (1 to hit with and two for balance). With hexopeds and octopeds I think half +1 would be good enough, although some combinations of fewer limbs would probably still work, while some won't.

@Venera3
Copy link
Member

Venera3 commented Jan 2, 2022

I could see something like required_limbs: [ "arm", 2 ] , but I think until we actually get around to doing multiwield it's a bit of an overkill. It would be nicer if the attack's effectivity scaled with the used limbs' scores etc, but that's the kind of code we'll need for choosing which arm you keep your weapon in and such. For the moment I think the simpler solution is enough to limb-proof MAs and open up the design space for e.g. MAs made for mutated anatomies.

@Hymore246
Copy link
Contributor Author

The game has body sublocations.

Well, that complicates things. That going to mean a lot more checking and that it is going to be harder to manage since the code used to find the outer most clothing layer isn't ideal.

Character anatomy is about to become much more fluid, so I'd advise against using hardcoded bodypart ids.

I probably need to wait until that is done since that is going to completely break my work.

MAs made for mutated anatomies

Maybe in the MMA mod but not in the base game. I see those martial arts being too niche and hard to explain how they came to be since most martial arts are dervided from older styles and it takes a lot of type to adapt into new forms for humans let alone mutants.

Furthermore, mutant limbs are going disqualify players from using certain techniques. You can't Roundhouse Kick as a centaur. Any kick from a horse body would not be supported by any existing martial arts style. Likewise, having tentacles instead for arms would prevent you from doing punches. Sure you could argue that you could do a Boxing Jab with a tentacle the same way as with an arm but the Boxing is taught with arms in mind and the Jab wouldn't work the same way due to the large amount of differences between those limbs. I can see all of this getting messy with game balance too. I might want to shelve this draft and rethink all of this.

@Venera3
Copy link
Member

Venera3 commented Jan 2, 2022

The way I'd handle this little can of worms is:

  • Both whole MAs and single techs can specify if they work with nonstandard anatomy
  • Attack vectors decide which bodypart type to use, the selection check would then filter out nonstandard parts of they aren't allowed.
  • Bodyparts have a flag to denote them as "nonstandard": you're not doing Karate with your tentacles, but feathered arms should work, for example

I agree on mutant MAs being either mod content or gated differently - some combination of EOC + time/skill based progression so an Apex predator Chimera could "develop their own style" (in reality a predefined MA that's not attainable any other way).

@wapcaplet wapcaplet added Martial Arts Arts, Techniques, weapons and anything touching martial arts. Melee Melee weapons, tactics, techniques, reach attack [C++] Changes (can be) made in C++. Previously named `Code` labels Jan 3, 2022
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Jan 10, 2022
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 10, 2022
@NetSysFire
Copy link
Member

Can you add to the PR description that this fixes #52001?

@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label Feb 17, 2022
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Feb 18, 2022
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Feb 18, 2022
@Hymore246 Hymore246 marked this pull request as ready for review February 18, 2022 03:30
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Feb 19, 2022
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Feb 22, 2022
@kevingranade kevingranade merged commit 3e260d6 into CleverRaven:master Feb 25, 2022
@Night-Pryanik
Copy link
Contributor

@Hymore246 does this close #42451?

@LeahLuong
Copy link

@Hymore246 This is huge! Thanks for doing this. Quick question: does this fix the issue where reach attacks are not triggering non-feint techniques?? If not, I can write out a bug report for it.

@Hymore246
Copy link
Contributor Author

@Hymore246 This is huge! Thanks for doing this. Quick question: does this fix the issue where reach attacks are not triggering non-feint techniques?? If not, I can write out a bug report for it.

Last time I checked, reach attacks were triggering feint as long as it was a valid style weapon. Did that change?

@LeahLuong
Copy link

LeahLuong commented Mar 1, 2022

@Hymore246 Sorry for the confusion! I didn't not say feints were triggering. It's the non-feint moves that aren't not non-triggering. I kid! But I think if you reread my previous post you'll find it much easier to parse after reading these last couple of sentences.

The gist: reach feints seem fine; it's the other techniques. MA techniques as well as weapon-inherent techniques seem to have this issue.

@Hymore246
Copy link
Contributor Author

@Hymore246 Sorry for the confusion! I didn't not say feints were triggering. It's the non-feint moves that aren't not non-triggering. I kid! But I think if you reread my previous post you'll find it much easier to parse after reading these last couple of sentences.

The gist: reach feints seem fine; it's the other techniques. MA techniques as well as weapon-inherent techniques seem to have this issue.

Reach weapons can trigger techs if you are next to a target. They cannot trigger from reach attacks. Allowing this would a big power creep and I am unsure if it is a good idea to allow it since kiting is a very strong way to to fight.

@Night-Pryanik
Copy link
Contributor

@Hymore246 does this close #42451?

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 [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions Martial Arts Arts, Techniques, weapons and anything touching martial arts. Melee Melee weapons, tactics, techniques, reach attack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Smashing with Taekwondo Can Result in Wielded Damage Broken arms taekwondo fix
9 participants