• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Repo] Damage Priority

Level 31
Joined
Jul 10, 2007
Messages
6,306
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