CleverRaven/Cataclysm-DDA — pull request #4982 by swwu (2013-12-10 06:41:04+00:00)
Title: Creature rework

Just to save a bit on merging pains down the road, and to get wider playtesting on the current state of the rework. Most things should be up to feature parity with pre-rework, with some small exceptions:

* weapons with the `BOUNCE` tag don't bounce (I think the only weapon that uses it is CBM: Chain Lightning?).
* grabs/grabbing techniques and disarms don't work in melee.
* burstfire doesn't reacquire targets if the first one dies (will keep shooting the same spot)
* Rivet's `UNDERWATER_GUN` weapon misfire maluses don't work. The accuracy penalty does, however.

What's been done so far:

* `Creature` base class for all things ever. `Character` base class for the player, human NPCs, and other such dialogue-enabled folk.
* Unified combat mechanics (everything but throwing weapons for the player, everything not from `monattack` for monsters). To copy what I said in #4970:
> These functions are Creature::melee_attack + Creature::deal_melee_attack for melee, and Creature::projectile_attack + Creature::deal_projectile_attack for ranged. The attacking_creature._attack functions roll the attack/generate the damage/etc from attacking_creature against a specified target, and target_creature.deal__attack deals an attack with a specified damage and hitroll to target_creature, which can then dodge/mitigate the attack.
> All attacks go through one of these, e.g. gunfire goes through player::fire_gun, which generates the bullet damage/dispersion values from the player's stats, and then calls player::projectile_attack (which then computes the trajectory and calls Creature::deal_projectile_attack on whatever gets hit, etc). So it should be fairly straightforward to just stick all the hit/damage messages in those functions, with message variations (e.g. technique messages) being read from JSON.
* Player diseases and monster effects now unified under Creature effects. About 1/3 of the diseases and all of the creature effects have been converted to the new effects system.
* More fleshed out damage types and resistances. Not all types and resistances are fully implemented (so, e.g. freeze grenades don't do cold damage yet, they just do regular grenade damage, and acid resist doesn't properly protect against acid) but a good deal are in. Borrowing from #2030, the damage types are:
```
DT_TRUE, // typeless damage, should always go through
DT_INTERNAL, // internal damage, like from smoke or poison
DT_BASH, // bash damage
DT_CUT, // cut damage
DT_ACID, // corrosive damage, e.g. acid
DT_STAB, // stabbing/piercing damage
DT_HEAT, // e.g. fire, plasma
DT_COLD, // e.g. heatdrain, cryogrenades
DT_ELECTRIC, // e.g. electrical discharge
```
All the damage types can be mitigated separately, and monsters can resist specific types of them. Damage types now also "carry" special effects, so e.g. all cold/electric damage will reduce movespeed as well as deal damage.
* A lot of combat/damage numbers are now carried in floats, so resistances can work at a higher granularity.
* Since monsters now use the same melee combat mechanics as players instead of special monster combat mechanics, their skills are considered at a -2 penalty when making attack rolls (a fair number of relatively common zombies had melee skills >=8, namely dogs). This is a temporary fix until we fully integrate and balance monsters in the "new" system (wherein they can have real stats).