So I've been trying to map out a combat system and I have an idea I'm laying out that I'm looking for a sanity check on, as well as suggestions.
The idea is that all things that can do damage (weapons, spells, environmental traps, monsters that deal damage sans weapon) will have a CombatTalker()
object attached that will contain information about the amount of damage and damage types (fire, frost, physical, magical, etc.), modifiers that it might have, and any special effects (apply DoT, blind, slow, etc.).
Everything that can take damage will have a CombatListener()
object that takes that information and transmogrifies it with the receivers resistances and any special properties it may have.
The CombatTalker()
will create a CombatPackage()
from a collection class any time there is a collision, and send it to the CombatListener()
on the collided objects, supposing it has one. The CombatPackage()
is basically the raw data about the damage and effects. The CombatTalker()
is a wrapper of sorts that generates the CombatPackage()
based on the weapon (or whatever) base damage, then the specific details of that individual weapon, and sends it (like a network packet) to the CombatListener()
. The CombatListener()
unwraps the package, and in reverse applies the resistances then applies any relevant damage and effects.
I know some of that was slightly repetitive, but I was trying to outline the idea completely, which apparently took two paragraphs.
I know this might be slightly complex, but the creatures and players and weapons and spells can change over time, so there isn't just a pool of static data that can be attached to the item. It needs to be able to read stats from JSON, apply specific information about the damage and send it. The same goes on the other side in reverse.
Is there a reason that this is "too complex"? Am I considerably overthinking it, or is this a reasonable method for a combat system?
Thanks!
Combatant
(things that can receive damage) and simplyDamage
for what you callCombatPackage
. \$\endgroup\$