Damage Control
OpenBOR includes a native system of damage control and mitigation. These settings adjust how entities deliver and respond to damage from different sources. For example, a character may resist, ignore, or absorb burn damage while remaining vulnerable to another attack type.
Offense properties modify damage delivered by an attacker. Defense properties modify incoming damage and reactions for the target. Both sets of properties may be configured independently for each attack type.
Model
The following commands are model properties. They apply to every entity spawned from the model unless changed at runtime through script.
Pain Configuration
pain_config <flags>
# Default
pain_config none
Controls basic reactions to hits. The command accepts one or more of the following flags:
none– No pain configuration. This flag has no effect when combined with other flags.back_pain– Enables back-pain animations when the entity is hit from behind and does not otherwise ignore pain.fall_disable– Prevents knockdown while the entity is at ground level. An airborne hit may still cause knockdown unlessfall_disable_airis also enabled.fall_disable_air– Prevents the automatic knockdown normally caused by an airborne hit.pain_disable– Prevents the entity from entering a pain animation.
Script
Pain configuration is an integer bitmask. The corresponding script constants are:
openborconstant("PAIN_CONFIG_NONE")openborconstant("PAIN_CONFIG_BACK_PAIN")openborconstant("PAIN_CONFIG_FALL_DISABLE")openborconstant("PAIN_CONFIG_FALL_DISABLE_AIR")openborconstant("PAIN_CONFIG_PAIN_DISABLE")
Damage Types
Offense and defense commands accept an attack type followed by the property value. See Attack Types for full details.
all– Applies the property to every non-special attack type, including creator-defined types. Special types must be configured individually.normal#– A numbered attack type. Replace#with the creator-facing, one-indexed type number; for example,normal5selects attack type 5.blast– Blast type.burn– Burn type.freeze– Freeze type.shock– Shock type.steal– Steal type.boss_death– Special type used to KO remaining enemies when a boss is defeated.item– Special type used when an item is collected.land– Special type used for landing damage.lifespan– Special type used when an entity's lifespan expires.lose– Special type used when time expires for players with a lose animation.pit– Special type used when an entity reaches pit depth.sub_entity_parent_kill– Special type used to KO a summon when its parent is removed.sub_entity_unsummon– Special type used to KO a summon at its unsummon frame.timeover– Special type used when time expires for players without a lose animation.
Offense
Offense properties modify the attacker's damage output before ordinary defense mitigation is applied.
| Command | Default | Description |
|---|---|---|
offense.damage.adjust
|
0
|
Adds a fixed amount to damage after applying offense.damage.factor.
|
offense.damage.max
|
MAX_INT
|
Maximum damage after applying the offense factor and adjustment. |
offense.damage.min
|
MIN_INT
|
Minimum damage after applying the offense factor and adjustment. |
offense.damage.factor
|
1.0
|
Multiplies damage output. The intended property is floating-point; for example, 1.5 produces 150% damage. Fractional calculation results are truncated toward zero when converted to an integer.
|
The following model delivers 50% more damage with burn attacks:
offense.damage.factor burn 1.5
Defense
Defense properties modify incoming damage, blocking, pain, knockdown, and death behavior for each attack type.
| Command | Default | Description |
|---|---|---|
defense.block.damage.adjust
|
0
|
Adds a fixed amount to blocked damage after applying defense.block.ratio.
|
defense.block.damage.max
|
MAX_INT
|
Maximum damage taken from a blocked attack after applying the block ratio and adjustment. |
defense.block.damage.min
|
MIN_INT
|
Minimum damage taken from a blocked attack after applying the block ratio and adjustment. |
defense.block.power
|
0
|
Works with attack.block.penetrate. When either value is nonzero, block power must be strictly greater than the attack's penetration value for the attack to remain blockable.
|
defense.block.ratio
|
Special | Multiplies damage when an attack is blocked. For example, 0.25 causes a blocked attack to inflict 25% of its raw damage. The internal default is openborconstant("DEFENSE_BLOCKRATIO_COMPATABILITY_DEFAULT"), allowing an explicit value of 0.0 to be distinguished from an unset property. When the special default remains in place, the engine uses 0.25 if the legacy global block-ratio option is enabled and 0.0 otherwise.
|
defense.block.threshold
|
0
|
Added to the entity's thold value. In the current implementation, a nonzero combined threshold is compared with the attack's raw damage force; attacks below the threshold cannot be blocked, while attacks meeting or exceeding it pass this eligibility test. |
defense.block.type
|
0 (Global)
|
Selects the resource damaged by a blocked attack:
|
defense.damage.adjust
|
0
|
Adds a fixed amount to incoming damage after applying defense.factor.
|
defense.damage.max
|
MAX_INT
|
Maximum damage taken after applying the ordinary defense factor and adjustment. |
defense.damage.min
|
MIN_INT
|
Minimum damage taken after applying the ordinary defense factor and adjustment. |
defense.death.config
|
Default death configuration | Sets death behavior when the entity is killed by the selected attack type. The accepted flags are otherwise identical to model death configuration. |
defense.factor
|
1.0
|
Multiplies damage from an unblocked attack after the attacker's offense calculation. |
defense.knockdown
|
1.0
|
Multiplies the attack's knockdown force before it is deducted from the target's knockdown counter. A value of 0.0 prevents the attack type from accumulating knockdown.
|
defense.pain
|
0
|
Minimum raw attack damage required to trigger pain. A value of 0 disables this resistance, so ordinary pain behavior is always eligible. This test uses the attack's original damage force, not damage after offense or defense calculations.
|
This model takes half damage from attack type 5, requires at least 20 raw damage from that type to enter pain, and prevents that type from accumulating knockdown. It takes 150% damage from unblocked burn attacks and 50% of raw damage when a burn attack is blocked.
defense.factor normal5 0.5
defense.pain normal5 20
defense.knockdown normal5 0.0
defense.factor burn 1.5
defense.block.ratio burn 0.5
Under the current block-threshold implementation, the following additionally prevents burn attacks with less than 20 raw damage from being blocked:
defense.block.threshold burn 20
Calculation Order
For an unblocked hit, OpenBOR calculates damage in this order:
- Begin with
attack.damage.force. - Multiply by
offense.damage.factor, then convert the result to an integer by truncating toward zero. - Add
offense.damage.adjust. - Clamp to
offense.damage.minandoffense.damage.max. - Multiply by
defense.factor, then convert the result to an integer by truncating toward zero. - Add
defense.damage.adjust. - Clamp to
defense.damage.minanddefense.damage.max.
For a blocked hit, OpenBOR first calculates the attacker’s offense-adjusted damage exactly as it would for an unblocked hit. It then applies the defender’s block-specific mitigation in place of the ordinary defense properties:
- Begin with
attack.damage.force. - Multiply by
offense.damage.factor, then truncate the result toward zero. - Add
offense.damage.adjust. - Clamp to
offense.damage.minandoffense.damage.max. - Multiply by
defense.block.ratio, then truncate the result toward zero. - Add
defense.block.damage.adjust. - Clamp to
defense.block.damage.minanddefense.block.damage.max. - Apply the resulting damage to HP, MP, or both according to
defense.block.type.
The ordinary defense.factor, defense.damage.adjust, defense.damage.min, and defense.damage.max properties do not apply to blocked hits.
Tip: Factors and adjustments accept negative values. A negative final damage value restores hit points, up to the entity's maximum health.