Cataclysm-DDA icon indicating copy to clipboard operation
Cataclysm-DDA copied to clipboard

Add bodypart on-hit effects, unhardcode bleeding / blinding on damage, allow effects to modify limb scores

Open Venera3 opened this issue 3 years ago • 1 comments

Summary

Features "Add bodypart on-hit effects, allow effects to directly modify limb scores"

Purpose of change

Unhardcode and limbify all the things - specifically different limbs should bleed differently, and different eyes should be able to be more/less resistant to blinding, and player status effects beyond those should move out of monster special attacks and instead be a function of the player's anatomy itself.

Describe the solution

  • Add on-hit limb effects, checked by Character::deal_damage_handle_type (which needed a bit of adjustment to track the damage source)
  • Deprecate Character::make_bleed, the Monster-level function is useful enough until we get freely-defined monster effect resistances. Lead to having to mess with a lot of one-off hardcoded bleed sources
  • Unhardcode the dodge effect of adjacent creatures and adjust the grab logic to prevent zombies sponatneously letting you go after two turns
  • Slightly limb-proof blinding ranged attacks, but that whole function will need a slight overhaul for Limb Stuff in the future
  • Slightly limb-proof the hardcoded monster attacks, though they should mostly be on the way out
  • Limb-proofed adding glare
  • Added the previously hardcoded effects to the limbs where they make sense (for a full list see Additional Context)
  • Added ability to modify limb scores via effects - either as global modifiers per effect instance or locally on the affected limb itself

TODO:

  • [x] Audit monster attacks for effects that fit more as on-hit ones
  • [ ] More playtesting

Describe alternatives you've considered

Overhaul bleeding in general - int_dur_factor means the scaling is pretty much linear, and the whole functionality could comfortably move over to EoCs / effect vitamin adjustments but that's pretty out of scope for this. I might look into that in a separate PR.

Don't bundle effect/limb score stuff into this, but that really opens the design space up for new onhit effects.

Testing

Loads, unit tests including the bleed inheritance one work. Debugmode messages tell you what is happening under the hood, intensity/duration limits are respected, scaling works as intended. Differential handling of minor and major parts works.

Additional context

The major change is you will usually get bled slightly more, but different bodyparts have different capacity to bleed and slightly different damage scaling based on damage type or limb - there's only so much bleeding a head can do, but a torso will rush up to major bleeding when shot pretty quickly.

The other important points are the potential to get stunned (by major bash damage to your head), staggered (bash on torso), or downed (high amounts of any damage on your torso or bash damage on your legs), that should even the playing field slightly when it comes to incoming/outgoing status effects. Numbers are WIP, but there's no rush what with it being a definite Feature Freeze PR.

Bodypart hit effects

Torso

  • Bleed on cut (max 1800s duration, 3% max HP threshold), stab, and bullet damage (unlimited duration, 1% damage threshold and faster scaling)
  • Winded on bash (10% base chance at 10% max HP threshold, max 15s duration)
  • Staggered (a new character version using limb score modifiers) scaling from 5% max HP for bash and 15% max HP for other damage types
  • Downed (15% max HP for bash and 25% max HP threshold for other damage types, 5% base chance)

Head

  • Bleed (lower max duration than torso)
  • Stun (lower threshold on bash damage)

Eyes

  • Chance to blind on any damage above 3 HP, base 50% scaling with damage

Arms

  • Bleed with a relatively low max duration limit
  • Staggered with the same setup as the torso

Legs

  • Bleed (higher max duration than arms, lower than torso)
  • Bouldering
  • Downed
Effect limb score modifiers

Heading

  1. Foo
  2. Bar
    • Baz
    • Qux

Some Code

function logSomething(something) {
  console.log('Something', something);
}

Venera3 avatar Nov 05 '22 12:11 Venera3

Includes changes from #63097 for the tests to pass properly, that should probably merge before this.

Venera3 avatar Feb 19 '23 08:02 Venera3