Cataclysm-DDA
Cataclysm-DDA copied to clipboard
Begin moving mutation attacks to Martial Arts techniques
Summary
Features "FANGS and FANGS_VAMPIRE mutations now add martial arts techniques rather than being free attacks"
Purpose of change
Followup to #70797
Mutation attacks have long been kind of weirdly implemented, being free attacks that happen instantly, often multiple times in a quarter of a second, simultaneously with weapon attacks. The player had no control over them, and they did not respect a lot of the standard attack code.
Describe the solution
- Adds infrastructure for jsonizing mutation attacks. This is currently done via integrated items, building off of #70214 , but in future PRs will be extended to also work with limbs where appropriate.
- Allows martial arts techniques to scale bonuses off of skills. The primary reason for this is scaling mutation attack damage off of the player's Unarmed skill, however the door is left open here for more interesting things to be done with weapons, other mutations (a fish tail attack only usable underwater which is bonused by swimming skill?), martial arts (a krav maga pistol whip that scales with pistols?), or especially mods. All skills are currently included except those which are fully craft/intellectual related.
- Builds off of the natural_stance buff and the conditions system to allow certain mutants to have some influence over how often they use attacks.
- Begins the process of moving mutation venom to specific body parts.
- Adds MOUTH as an attack vector.
Using Attacks Mutation attacks will randomly replace your normal melee attack. Each attack currently has a 1/5 chance of firing. This randomness represents the unpredictability of your animal instincts, and depending on the situation, you may or may not want your attack to go off. Perhaps replacing 20% of your human brain with cat was not as brilliant as it seemed.
All mutation attacks use the Unarmed skill. This gives the skill some utility it was sorely lacking and may help push wannabe martial artists to pursue mutations to keep up with late-game enemies.
Some conditions can affect the chance that you will use certain mutation attacks. Currently, they are:
- Attacking an enemy which is grabbing you will increase your bite chance to 1 in 2. This will actually help fang-bearing mutants quite a bit, as it's not uncommon to have your weapon arm(s) grabbed.
- Having the Natural Stance effect, which is already implemented, will increase your bite chance to 1 in 2. This effect is granted to any mutant with both digitigrade legs and any paws mutation, or bow-legged and bat wings, when they crouch or run without holding anything. Having this buff increases the chance of making a FANGS or FANGS_VAMPIRE attack to 1 in 2. This buff also removes all penalties for crouching in combat, so that quadrupeds are not penalized for fighting naturally.
- If you would like to not use any bite attacks, you can cover your mouth with any piece of equipment which is not flagged to allow natural attacks. A muzzled Lupine will not bite.
- This is not done in this PR, but similar conditions can be added for later mutation attacks. SHARKTEETH might fire more often underwater, FOLDING_FANGS if the target is webbed, etc.
FANGS and VAMPIRE_FANGS These two mutations have been balanced by using the martial arts system to duplicate the code for stabbing attacks found in melee.cpp, and can themselves serve as an example for creating similar mutations. Rather than the stab skill, they use unarmed to scale their damage, and currently that damage is entirely deterministic rather than randomized. This is an issue with martial arts in general and could probably be fixed another time. Due to how flat_bonuses work, damage and arpen scale linearly with skill/strength rather than variably before and after rank 5. I have averaged the bonuses as best I can. The result is that at 0-2 ranks, vampire fangs slightly outperform a stabbing weapon of equivalent base speed. At 3-7 ranks they behave about the same, at 8-10 ranks they perform a bit worse. This makes sense to me - a human can train and master a weapon. While an animal can learn, it relies to a large extent on raw power and ferocity.
One drawback to this method is that the damage output is entirely deterministic, as no dice are rolled for damage. This was however already the case for mutation attacks, so in any event this is a big improvement. Adding a random element to the flat_bonus system might be worthwhile at a later date. Mutation attacks already had this issue, so it's at least not introducing a new problem.
I chose the USMC bayonet to test against as per #69201 it's about in the middle in terms of knife DPS, and has the same attack speed as both fangs. For this test, I removed rapid strike from the blade so that it had the exact same attack speed as both sets of fangs. Note that fangs cannot block and receive no hit bonuses or penalties, nor do they qualify for any martial arts techniques.
The intent here is that Fangs (being a fairly basic mutation) are worse than a proper knife. Vampire fangs are intended to be some of the best teeth in the game (behind shark teeth and saber teeth) and do quite well, but at high skill levels, they drop off compared to the bayonet. Animals may have the edge in power and ferocity, but really mastering a weapon is a human thing.
Draculin Draculin (that's what it's called irl!) is a venom specific to Chiropteran mutants that prolongs bleeding, and was ported over here from #70797 . It does not increase the intensity of bleed effects, but bleeding wounds will take longer to reduce in intensity, so more damage will be done over time.
If they do damage, fangs deliver draculin 70% of the time, or 90% of the time on a crit. If they damage, vampire fangs deliver draculin 90% of the time, or 100% of the time on a crit.
Describe alternatives you've considered
After a lot of testing and trying out different things, I think this is the best method for mutation attacks. The only alternative I can imagine would be to create weapon entries for each one and write up some kind of hardcoded method of attacking with them, but I think we have enough json power to do it this way.
Testing
Ongoing
TEST CHARACTER: 10 str 10 dex 10 int 10 per, fangs mutation only vs Debug Monster All skills 0 Fangs Bite damage: 19 Critical Fangs Bite damage: 21 Vampire Bite damage: 29 Critical Vampire Bite damage: 31 USMC bayonet damage: 16-21 Critical USMC bayonet damage: 18-21
All skills 3 Fangs Bite damage: 22 Critical Fangs Bite damage: 33 Vampire Bite damage: 32 Critical Vampire Bite damage: 43 USMC bayonet damage: 25-28 Critical USMC bayonet damage: 34-44
All skills 6 Fangs Bite damage: 25 Critical Fangs Bite damage: 46 Vampire Bite damage: 35 Critical Vampire Bite damage: 56 USMC bayonet damage: 29-39 damage Critical USMC bayonet damage: 50-60
All skills 9 Fangs Bite damage: 29 Critical Fangs Bite damage: 60 Vampire Bite damage: 39 Critical Vampire Bite damage: 70 USMC bayonet damage: 31-39 damage Critical USMC bayonet damage: 65-84
Additional context
This currently removes some of the interaction FANGS had with various muzzle mutations. I fully intend to re-add those interactions, but in the interest of sanity I'd like to keep this PR from becoming another 1000 line monster.
Sharing these in case they're useful for you:
- MA techniques can proc
SPELL
s viaeocs
+u_cast_spell
, and these spells can be casted automatically at the target (no targeting window) withloc
, if you save their coordinates, done on the fly with the EOC eventcharacter_melee_attacks_monster
- MA buffs can be recognized, added and removed by EOCs when written as
mabuff:buff_niten_onattack
Can you add draculin to the (actual) vampire fangs from Xedra Evolved 👉👈
@TheShadowFerret It looks like it'll be a bit more complex than just sticking a flag on VAMPIRE2, so it's best handled in a separate PR as we're already over 500 lines in this one.
WOOOOOOOOOOOOOOOOOOOOOOOOOO!
IRL vampire bat fangs are some of the sharpest teeth in the animal kingdom and sometimes cause injury even when handling specimens in museums - https://en.wikipedia.org/wiki/Vampire_bat). At 27.5 base DPS, they're right in the middle of "weapons of war", but at high skill levels, they drop off compared to the bayonet.
This rationale doesn't make sense, they're sharp in order to avoid causing pain when biting so vampire bats don't wake up sleeping prey, they're still a set of max 2" or so deep wounds, that can't possibly compete with a deep stab from a knife for damage caused. The bleed extending venom makes sense, but there's no possible world where it's competing with a serious weapon for DPS.
I assume they're larger than 2 inches as they're a further evolution of the Fangs mutation, which is itself described that way, but in any event I've dropped them down to 15 base damage. This puts them at 18.75 base DPS. A gas station butterfly knife, for comparison, does 21.28 base DPS.
The OP has been updated to include this information and the new test results.
I assume they're larger than 2 inches as they're a further evolution of the Fangs mutation,
This is not the right way to think about it, if you're adding bat fangs mutation it should relate to what bat fangs do: cause small bleeds that bats can lick. If you want a powerfull fighting mutation don't base it on bats.
I reduced the damage to below even a subpar knife. It is no longer a powerful fighting mutation.
These animals have proportionally very large teeth, they are just very small animals. A human-sized one would be capable of inflicting a pretty nasty bite. Wikipedia says the typical vampire bat creates an 8mm x 7mm wound. The bat itself is only 76mm. Scaled up directly to human size, that's a roughly 192mm x 168mm wound, or 7.5 x 6.6 inches deep. I'm sure the anatomy doesn't scale up 1:1, but it's at least illustrative. The bat has two daggerlike incisors that protrude forward and several big sharp fangs to the side.
If our regular fangs are 2 inches, these are a bit bigger, and certainly sharper, is all I'm saying.
I think with the additional net nerf to damage this does by removing fangs bonus attack, this makes a lot of sense.
I had my measurements wrong. I'd previously said that a scaled-up vampire bat would make a roughly 3 inch deep bite, but I think it's closer to 7, as a vampire bat is 3 inches long and a 6 foot tall man is 24 times that size. 8mm x 24 = 192mm = 7.5 inches. I've edited my post. A USMC bayonet is 8 inches long and 1.4 inches wide, for comparison. As I mentioned earlier, the mutant is a human hybrid and probably not scaled up 1:1 (their head would probably be proportionally smaller at least, which would scale down the fang size some), but again it is illustrative.
Despite correcting my math there, I've left the base DPS at 18.75, which is much lower than the bayonet's 27.5, or even the much smaller balisong's 21.28, as Fris0uman is right that they shouldn't be pulping enemies with 100 damage bites, because bats are not strong fighters like many of the other animals our mutants are based on. The intent is that they are sneaking around, tagging enemies with their venom, and then escaping to let them bleed out.
I do wonder if it might be more appropriate for the vampire fangs to be a cutting weapon. I'm not sure how exactly we draw that distinction.