• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Repo] Damage Priority

A set of rules for system design as more complicated damage detection is getting pretty messy...

Modifiers use priorities of 4 or higher. If you guys come up with other priorities that are important (not map specific), please share and I will add it to this list.
JASS:
library DamagePriority  /*     v3     */
    globals
        /*
        *   Global priorities are priorities that are to be run before damage modifiers
        *
        *   Damage modifiers have priority of DAMAGE_PRIORITY_EXECUTION_DAMAGE_MODIFIER_EFFECTS
        */
        constant integer DAMAGE_PRIORITY_EXECUTION_DAMAGE_MODIFIER_EFFECTS = 1000

        /*
        *   Occurs during system setup for damage event
        *   This is where lists may be created or flushed or w/e
        */
        constant integer DAMAGE_PRIORITY_SETUP = 2147483647
        /*
        *   All damage modifiers must have ids of 5 or higher
        *   This excludes percent modifiers like evasion and critical
        */
        constant integer DAMAGE_PRIORITY_MODIFIER = 8
        constant integer DAMAGE_PRIORITY_MODIFIER_GLOBAL = DAMAGE_PRIORITY_MODIFIER + DAMAGE_PRIORITY_EXECUTION_DAMAGE_MODIFIER_EFFECTS + 1
        /*
        *   Damage modifiers that cancel out negative damage
        */
        constant integer DAMAGE_PRIORITY_MODIFIER_CANCEL_NEGATIVE = 7
        constant integer DAMAGE_PRIORITY_MODIFIER_CANCEL_NEGATIVE_GLOBAL = DAMAGE_PRIORITY_MODIFIER_CANCEL_NEGATIVE + DAMAGE_PRIORITY_EXECUTION_DAMAGE_MODIFIER_EFFECTS + 1
        /*
        *   Damage modifiers that absorb damage into negatives
        */
        constant integer DAMAGE_PRIORITY_ABSORB_MODIFIER_PERCENT = 6
        constant integer DAMAGE_PRIORITY_ABSORB_MODIFIER = 5
        /*
        *   All Damage Creators must have a priority of 4
        *   Damage Creators are sources of damage, like weapons
        *   These add to the Damage Queue
        */
        constant integer DAMAGE_PRIORITY_CREATOR = 4
        /*
        *   All percent modifiers must have a modifier of 3. This may change
        *   depending on possible absorp % effects.
        */
        constant integer DAMAGE_PRIORITY_PERCENT_MODIFIER = 3
        /*
        *   Execute of damage (like DamageQueue execution or DamageModificationEffect execution)
        *   must have priorities of 2.
        */
        constant integer DAMAGE_PRIORITY_EXECUTION = 2
        constant integer DAMAGE_PRIORITY_EXECUTION_GLOBAL = DAMAGE_PRIORITY_EXECUTION + DAMAGE_PRIORITY_EXECUTION_DAMAGE_MODIFIER_EFFECTS + 1
        /*
        *   All damage display must have priority of 1.
        */
        constant integer DAMAGE_PRIORITY_DISPLAY = 1
        /*
        *   All damage cleanup must have a priority of 0
        */
        constant integer DAMAGE_PRIORITY_CLEANUP = 0
    endglobals
endlibrary
 
Last edited:
Top