CleverRaven/Cataclysm-DDA — pull request #8395 by BevapDin (2014-07-31 12:33:20+00:00)
Title: Unify damaging of monster and characters

- Added source parameter to Creature::hurt function to properly track who hurt it.
- Removed the monster-specific hurt function and override the Creature::hurt function instead. That function includes the body part, so I made up the proper body part based on the surrounding of the function call (hat is used when applying damage to player objects), or, if that did not yield useful information, the body part is `bp_torso`. It doesn't mater at all because monsters ignore the body part anyway.
- Added `monster::die_in_explosion` as it better reflects the intention than calling `monster::hurt(9999)`
- Removed `monster::hit` which is surprisingly not used at all.
- Removed `player::hurt` that uses a hp body part, use the other function hurt function instead.
- Removed `Creature::hurt`, also removed the `hurt` function from `player` and `monster` and replaced it with `apply_damage`
- Changed `game::fling_player_or_monster` to `game::fling_creature`, with only a single Creature pointer as parameter (instead of player *and* monster pointer).

It's not really unified because monsters and characters seem to have different hp scales, easily visible in trapfunc.cpp. But the monster and character specific hurt functions are gone and the damage is now applied through functions defined in the Creature class.

----

Questions:

Some functions (like `game::fling_player_or_monster`, `game::teleport`, `game::knockback`, `game::limb_color`) should probably go into the creature or the player class, don't they? They do not apply to a game, but to a creature.

Is there some design document for the player-npc separation? It sees that player *and* npc are supposed to inherit from Character, but npc should not inherit from player. Is this correct? Does this mean a "simple" move of all the npc-and-player relevant stuff from player to Character is in order? With all the recent work of acidia on npcs, rewriting the npc class from scratch seems like waste.

Is there a common damage conversion factor for damage against monster vs damage against characters? A default player with 8 strength (and not traits) has 84 hp (on *each* body part), a zombie has 80 hp (on the *whole* body). Applying 10 damage to each body part (only the major 6 body parts) by calling `Creature::apply_damage` is only a minor thing for the player, but it would nearly destroy the zombie (60 damage in total).