Skip to content

Damage Effects

Slashscreen edited this page May 1, 2023 · 3 revisions

Damage effects in Skelerealms take a slightly different approach to normal systems.
Damage information is conveyed by a dynamic list of effects, rather than a hardcoded one - this is for flexibility, so you can have any arbitrary amount of different kinds of effects (even dynamically generated ones!) at the cost of perhaps being a bit annoying to deal with. Damage is also managed on the receiver's end, rather than the giver, although this is more standard.

An example of the effects of, say, a mace that gives frost damage could look like this:

{
    &"basic" : 10,
    &"frost" : 20,
    &"blunt" : 15,
}

Whatever is hit with the mace can then process each effect independently. The enemy has armor, so the blunt damage is reduced, but the enemy comes from the desert, so frost damage is increased.
This is a dictionary internally, so you can use whatever keys and values you want. Not sure what you would anything other than strings/ stringnames for, but that's up to you!

Any damage sources must create a DamageInfo object. This object contains the following info:

  • Who did the hitting.
  • The effects of the hit, as described above.
  • Optionally, spell effects to be applied once damaged. This is an alternative way of delivering spell effects instead of the spell system. This is included for, say, enchanted weapons.
  • Optionally, any arbitrary info you wish to send along with. This is usually used for sending info about the weapon, but can be used for anything. For example, if ghosts can only be hit by silver weapons, you would send along whether the weapon is silver or not.

Damage should be processed using an AI module for NPCs.

Clone this wiki locally