Damage Control

Damage Control post thumbnail image

OpenBOR includes a native system of damage control and mitigation. These settings allow you to adjust how entities deliver and respond to damage from different sources. As an example, you could make a character in your game partially resistant, totally immune, or even able to absorb damage from fire attacks. At the same time, you could make them more vulnerable to certain other attack types like water or ice.

Model

Model properties override their global counterparts for entities spawned from a given model. See individual properties for details.

Pain Configuration

Basic reaction behavior to hits.

pain_config <flags>

# Default
pain_config none

Accepts the following flags:

  • none – No pain configuration. No effect if used with other flags.
  • back_pain – Enables back pain animations when hit from behind (and not ignoring pain).
  • fall_disable – Entity does not fall if hit with knockdown attack when at its base height.
  • fall_disable_air – Entity does not fall from hits when in the air. Normally any midair hit causes knockdown.
  • pain_disable – Entity does not enter pain animation.

Script

Pain config is an integer property with the following bitmasks:

  • openborconstant("PAIN_CONFIG_BACK_PAIN")
  • openborconstant("PAIN_CONFIG_FALL_DISABLE")
  • openborconstant("PAIN_CONFIG_FALL_DISABLE_AIR")
  • openborconstant("PAIN_CONFIG_NONE")
  • openborconstant("PAIN_CONFIG_PAIN_DISABLE")

Offense

Modifies damage output. Use one of the following commands followed by attack type and the property value. Offense accepts the following types:

  • all – All non special types.
  • normal# – Numbered attack types. Substitute # for the attack type number. Example: normal5 for attack type 5.
  • blast – Blast type.
  • burn – Burn type.
  • shock – Shock type.
  • steal – Steal type.
  • boss_deathSpecial.
  • itemSpecial.
  • landSpecial.
  • lifespanSpecial.
  • loseSpecial.
  • pitSpecial.
  • sub_entity_parent_killSpecial.
  • timeoverSpecial.
NameDefaultDescription
offense.damage.adjust0Direct adjustment to damage output.
offense.damage.maxMAX_INTMaximum damage output.
offense.damage.minMIN_INTMinimum damage output.
offense.damage.factor1.0Multiplier for damage output. OpenBOR multiplies damage output for the type by this value. If the result is a fraction, the engine will round it. Example: If the attack damage is 10 and factor is 1.5, final damage output is 15.
NameDefaultDescription

This model outputs 50% extra damage when it hits with burn attacks.

offense.damage.factor burn 1.5 

Defense

Defense is a set of model and (coming soon) body box properties that adjusts incoming damage and reactions. To add defense, use one of the following commands followed by attack type and the property value. Attack type entry is identical to offense.

NameDefaultDescription
defense.block.damage.adjust0Direct adjustment to damage when blocking attack.
defense.block.damage.maxMAX_INTMaximum damage taken when blocking attack.
defense.block.damage.maxMIN_INTMinimum damage taken when blocking attack.
defense.block.power0Works with attack.block.penetrate. If this value exceeds attack.block.penetrate, the target is able to block attack.
defense.block.ratioSpecialDamage multiplier when blocking an attack. For example, a value of 0.25 means blocked attacks cause 25% of their normal damage. For legacy compatibility and to allow setting 0.0, the default value is a special constant: openborconstant("DEFENSE_BLOCKRATIO_COMPATABILITY_DEFAULT"). If this value is in place when an attack hits, a value of 0.0 is used for the calculation.
defense.block.threshold0Added to entity’s thold setting. If the combined result is any value other than 0 and less than final damage (after attacker’s offense and target’s defense factors apply), target cannot block attack.
defense.block.typeSeriesHow any blocking damage applies.

* HP – Directly from hit points.

* Global – Use global MPonly setting.

* Series – Use MP until exhausted, then use HP.

* Both – Use MP and HP at once.
defense.damage.adjust0Direct adjustment to damage when hit by attack.
defense.damage.maxMAX_INTMaximum damage taken when hit by attack.
defense.damage.minMIN_INTMinimum damage taken when hit by attack.
defense.death.configSpecialDeath behavior when killed by attack type. Otherwise identical to model Death Config.
defense.factor1.0Damage multiplier when hit by attack.
defense.knockdown1.0Knockdown multiplier when hit by attack.
defense.pain0.0If any value other than 0.0, final damage (after attacker’s offense and target’s defense factors apply) must meet or exceed this value to trigger a pain animation.
NameDefaultDescription

This model is more resistant to Attack Type 5. It takes 50% damage, doesn’t go into pain unless the attack does more than 20 points after all damage calculations, and effectively ignores knockdowns. We’ve also made it weak against fire attacks. It takes 150% damage when hit by Burn Type, and still takes 50% even if it successfully blocks. Finally, it can’t block burns at all if the final damage of a hit would cause 20 or more damage.

defense.factor normal5 0.5
defense.pain normal5 20
defense.knockdown normal5 0.0

defense.factor burn 1.5
defense.block.ratio burn 0.50
defense.block.threshold burn 20

Note OpenBOR calculates damage mitigation in the following order:

  1. damage = damage * offense.factor
  2. damage = damage + offense.adjustment
  3. damage = damage ≥ offense.damage_min
  4. damage = damage ≤ offense.damage_max
  5. damage = damage * defense.factor
  6. damage = damage + defense.adjustment
  7. damage = damage ≥ defense.damage_min
  8. damage = damage ≤ defense.damage_max

Tip: Multipliers and adjustments are exactly what they say: Multipliers and adjustments. Try using negative values to reverse their effects. For example, a negative defense.factor will cause the target to gain hit points.

Related Post