• 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.

[Framework] DDS - Damage Detection System


DDS
v1.0.0.0
Nestharus
__
A DDS Framework that various DDS Components can plug into
____________________________________________________________________________________________________

[tr]

Supports
____________________________________________________________________________________________________

[tr]

Damage Event Core
_____________________________

The simplest and lightest damage event possible
_______________________________________________________________________

Damage Event Modification

Damage modification general, use of timers and health ability

Damage Event Archetype

Able to differentiate between
  • Physical
  • Spell
  • Code

Uses the spell damage reduction ability

Damage Event Unit Modification

Unit specific damage modification
How To Create A Plugin
Plugin Name Format
Plugin Position Information
Advantage
Common API Suggestion
[tr]

[td]
Create the modules/macros (all optional)
Use DDS and any other required plugins
Users now may use your plugin and automatically use DDS as well as any other plugins all through a common API
____________________________________________________________________________________________________
[/td]
[/tr]
[tr]

[td]
PLUGIN_POSITION

Example

//! textmacro DAMAGE_EVENT_CODE
module DAMAGE_EVENT_API
____________________________________________________________________________________________________
[/td]
[/tr]
[tr]

//! textmacro CODE
___________________________

Plugs code above the DDS struct
Place module declarations and general code here
Keep things private that shouldn't be part of the API
Keep things scoped for plugin (make use of scopes and private structs)
_________________________________________________________________________

module API

Plugs code into the DDS struct above the onDamage function

Can either use a delegate to take properties from a struct or put the properties
directly into the module. Use whichever promotes readability.

module RESPONSE_LOCALS

Plugs code into the start of the onDamage function (for locals)

module RESPONSE_BEFORE

Plugs code into the onDamage function before user events are fired

module RESPONSE

Plugs code into the onDamage function when user events are fired

module RESPONSE_AFTER

Plugs code into the onDamage function after user events are fired

module RESPONSE_CLEANUP

Plugs code into the end of the onDamage function

module INTERFACE

Plugs code into the DDS module
Implemented into a struct, not a method

module INIT

Implemented at bottom of library
Put all init code here
Implemented into a method
[/tr]
[tr]

[td]
Plugin properties and methods go through a common DDS struct
____________________________________________________________________________________________________
[/td]
[/tr]
[tr]

Why follow a common API? It allows plugins to work with any other plugin regardless of the API and allows users to pick whichever plugin they want without having to modify their code. Of course, common API guidelines don't need to be followed, but at the very least, the Damage Event and Damage Event Advanced guidelines should be followed as they follow closely to the JASS Standard.
____________________________________________________________________________________________________

Damage Event

Damage Event Modification

Damage Event Archetype

Damage Event Unit Modification

Unexpected tab 5


  • source - damager (readonly)
  • target - damaged (readonly)
  • damage - amount of damage (readonly)
  • enabled - enable/disable DDS
  • ANY - the event if the module is not used (readonly)
____________________________________________________________________________________________________

  • damageOriginal - original damage (readonly)
  • damage - extend damage for set
____________________________________________________________________________________________________

  • Archetype.SPELL
  • Archetype.PHYSICAL
  • Archetype.CODE
  • archetype
  • damageCode
____________________________________________________________________________________________________

See Damage Modification Effect and Damage Queue for possible implementations of this.
____________________________________________________________________________________________________

[td][/td]
[/tr]
[TD][/TD]
[/tr]
[/tr]
 
Last edited:
Index

JASS:
library DDS /* v1.0.0.0
*************************************************************************************
*
*   */uses/*
*
*       */ TriggerRefresh   /*      hiveworkshop.com/forums/submissions-414/trigger-refresh-systems-using-single-unit-events-like-dds-231167/
*
************************************************************************************
*
*   SETTINGS
*/
globals
    /*************************************************************************************
    *
    *   How many units can refresh at a given moment (when a trigger is rebuilt).
    *   larger size means less triggers but harder refreshes.
    *
    *************************************************************************************/
    private constant integer TRIGGER_SIZE = 80
endglobals
/*
*************************************************************************************
*
*   struct DDS extends array
*
*       Plugin properties
*
*   module DDS
*
*       Plugin interface
*       Plugin properties (from DDS struct)
*
*************************************************************************************/
    private keyword DAMAGE_EVENT_API
    private keyword DAMAGE_EVENT_MODIFICATION_API
    private keyword DAMAGE_EVENT_ARCHETYPE_API
    private keyword DAMAGE_EVENT_UNIT_MODIFICATION_API
    private keyword DAMAGE_EVENT_RESPONSE_LOCALS
    private keyword DAMAGE_EVENT_MODIFICATION_RESPONSE_LOCALS
    private keyword DAMAGE_EVENT_ARCHETYPE_RESPONSE_LOCALS
    private keyword DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE_LOCALS
    private keyword DAMAGE_EVENT_RESPONSE_BEFORE
    private keyword DAMAGE_EVENT_MODIFICATION_RESPONSE_BEFORE
    private keyword DAMAGE_EVENT_ARCHETYPE_RESPONSE_BEFORE
    private keyword DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE_BEFORE
    private keyword DAMAGE_EVENT_RESPONSE
    private keyword DAMAGE_EVENT_MODIFICATION_RESPONSE
    private keyword DAMAGE_EVENT_ARCHETYPE_RESPONSE
    private keyword DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE
    private keyword DAMAGE_EVENT_RESPONSE_AFTER
    private keyword DAMAGE_EVENT_MODIFICATION_RESPONSE_AFTER
    private keyword DAMAGE_EVENT_ARCHETYPE_RESPONSE_AFTER
    private keyword DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE_AFTER
    private keyword DAMAGE_EVENT_RESPONSE_CLEANUP
    private keyword DAMAGE_EVENT_MODIFICATION_RESPONSE_CLEANUP
    private keyword DAMAGE_EVENT_ARCHETYPE_RESPONSE_CLEANUP
    private keyword DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE_CLEANUP
    private keyword DAMAGE_EVENT_INTERFACE
    private keyword DAMAGE_EVENT_MODIFICATION_INTERFACE
    private keyword DAMAGE_EVENT_ARCHETYPE_INTERFACE
    private keyword DAMAGE_EVENT_UNIT_MODIFICATION_INTERFACE
    private keyword DAMAGE_EVENT_INIT
    private keyword DAMAGE_EVENT_MODIFICATION_INIT
    private keyword DAMAGE_EVENT_ARCHETYPE_INIT
    private keyword DAMAGE_EVENT_UNIT_MODIFICATION_INIT

    //! runtextmacro optional DAMAGE_EVENT_CODE()
    //! runtextmacro optional DAMAGE_EVENT_MODIFICATION_CODE()
    //! runtextmacro optional DAMAGE_EVENT_ARCHETYPE_CODE()
    //! runtextmacro optional DAMAGE_EVENT_UNIT_MODIFICATION_CODE()
    
    private keyword DDS_onDamage
    struct DDS extends array
        implement optional DAMAGE_EVENT_API
        implement optional DAMAGE_EVENT_MODIFICATION_API
        implement optional DAMAGE_EVENT_ARCHETYPE_API
        implement optional DAMAGE_EVENT_UNIT_MODIFICATION_API
    
        static method DDS_onDamage takes nothing returns nothing
            implement optional DAMAGE_EVENT_RESPONSE_LOCALS
            implement optional DAMAGE_EVENT_MODIFICATION_RESPONSE_LOCALS
            implement optional DAMAGE_EVENT_ARCHETYPE_RESPONSE_LOCALS
            implement optional DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE_LOCALS
            
            implement optional DAMAGE_EVENT_RESPONSE_BEFORE
            implement optional DAMAGE_EVENT_MODIFICATION_RESPONSE_BEFORE
            implement optional DAMAGE_EVENT_ARCHETYPE_RESPONSE_BEFORE
            implement optional DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE_BEFORE
            
            implement optional DAMAGE_EVENT_RESPONSE
            implement optional DAMAGE_EVENT_MODIFICATION_RESPONSE
            implement optional DAMAGE_EVENT_ARCHETYPE_RESPONSE
            implement optional DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE
            
            implement optional DAMAGE_EVENT_RESPONSE_AFTER
            implement optional DAMAGE_EVENT_MODIFICATION_RESPONSE_AFTER
            implement optional DAMAGE_EVENT_ARCHETYPE_RESPONSE_AFTER
            implement optional DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE_AFTER
            
            implement optional DAMAGE_EVENT_RESPONSE_CLEANUP
            implement optional DAMAGE_EVENT_MODIFICATION_RESPONSE_CLEANUP
            implement optional DAMAGE_EVENT_ARCHETYPE_RESPONSE_CLEANUP
            implement optional DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE_CLEANUP
        endmethod
    endstruct
    
    module DDS
        private static delegate DDS dds = 0
        
        implement optional DAMAGE_EVENT_INTERFACE
        implement optional DAMAGE_EVENT_MODIFICATION_INTERFACE
        implement optional DAMAGE_EVENT_ARCHETYPE_INTERFACE
        implement optional DAMAGE_EVENT_UNIT_MODIFICATION_INTERFACE
    endmodule

    //! runtextmacro TRIGGER_REFRESH("TRIGGER_SIZE", "EVENT_UNIT_DAMAGED", "function DDS.DDS_onDamage")
    
    private module DDS_Init_Module
        private static method onInit takes nothing returns nothing
            implement optional DAMAGE_EVENT_INIT
            implement optional DAMAGE_EVENT_MODIFICATION_INIT
            implement optional DAMAGE_EVENT_ARCHETYPE_INIT
            implement optional DAMAGE_EVENT_UNIT_MODIFICATION_INIT
        endmethod
    endmodule
    private struct DDS_Init extends array
        implement DDS_Init_Module
    endstruct
endlibrary
 
Last edited:
Index

Examples
JASS:
/*
*   Notice how the stuff from the plugin pops up in the module
*   Module gets access to anything put into the API portion of the plugin
*   Furthermore, the interface portion will allow new event responses to be written in the module, like the below onDamage
*/
struct Test extends array
    private static method onDamage takes nothing returns nothing
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"Damage: "+R2S(amount))
    endmethod

    implement DDS
endstruct
JASS:
library MyCustomDamageEventPlugin uses DDS, PriorityEvent
    //! textmacro DAMAGE_EVENT_CODE
        /*
        *   DDS API
        *
        *       DDS.ANY
        *       DDS.target
        *       DDS.source
        *       DDS.amount
        *
        */
        private keyword damageEventInit
        private module DAMAGE_EVENT_API
            readonly static PriorityEvent ANY
            readonly static UnitIndex target = 0
            readonly static UnitIndex source = 0
            readonly static real amount = 0

            static method damageEventInit takes nothing returns nothing
                set ANY = PriorityEvent.create()
            endmethod
        endmodule
        module DAMAGE_EVENT_INIT
            call DDS.damageEventInit()
        endmodule

        /*
        *   DDS Interface
        *
        *       (optional) private static constant ineger PRIORITY          defaults 0
        *       (optional) private static method onDamage takes nothing     defaults nothing
        *
        *       
        */
        private struct DamageEventPriority extends array
            readonly static constant integer PRIORITY = 0
        endstruct
        module DAMAGE_EVENT_INTERFACE
            private static delegate DamageEventPriority priority = 0

            static if thistype.onDamage.exists then
                private static method init takes code c returns nothing
                    call ANY.register(Condition(c), PRIORITY)
                    return
                endmethod

                private static method onInit takes nothing returns nothing
                    call init(function thistype.onDamage)
                endmethod
            endif
        endmodule

        /*
        *   DDS Event Handling
        */
module DAMAGE_EVENT_RESPONSE_LOCALS
                local UnitIndex prevTarget = target
                local UnitIndex prevSource = source
                local real prevAmount = amount
endmodule
module DAMAGE_EVENT_RESPONSE_BEFORE
                set target = GetUnitUserData(GetTriggerUnit())
                set source = GetUnitUserData(GetEventDamageSource())
                set amount = GetEventDamage()
endmodule
module DAMAGE_EVENT_RESPONSE
                call ANY.fire()
endmodule
module DAMAGE_EVENT_RESPONSE_AFTER
endmodule
module DAMAGE_EVENT_RESPONSE_CLEANUP
                set target = prevTarget
                set source = prevSource
                set amount = prevAmount
endmodule
    //! endtextmacro
endlibrary
 
Last edited:
Index

Templates

Damage Event

Damage Event Modification

Damage Event Archetype

Damage Event Unit Modification

JASS:
library DamageEvent /* v1.0.0.0
*************************************************************************************
*
*   Damage Event plugin for DDS
*
*       source
*       target
*       damage
*       ANY (PriorityEvent or Event)
*
*************************************************************************************
*
*   */uses/*
*
*       */ DDS                      /*      hiveworkshop.com/forums/submissions-414/framework-dds-damage-detection-system-231169/
*       */ optional PriorityEvent   /*      hiveworkshop.com/forums/jass-resources-412/snippet-priority-event-213573/
*
************************************************************************************
*
*   SETTINGS
*/
globals
    /*************************************************************************************
    *
    *   
    *
    *************************************************************************************/
    
endglobals
/*
*************************************************************************************
*
*   API
*
*       
*
*************************************************************************************
*
*   Interface
*
*       
*
*************************************************************************************/
    //! textmacro DAMAGE_EVENT_CODE
        /*
        *   DDS API
        *
        *       
        *
        */
        private module DAMAGE_EVENT_API
            
        endmodule
        module DAMAGE_EVENT_INIT
            
        endmodule

        /*
        *   DDS Interface
        *
        *       
        *
        */
        module DAMAGE_EVENT_INTERFACE
            
        endmodule

        /*
        *   DDS Event Handling
        */
module DAMAGE_EVENT_RESPONSE_LOCALS
                
endmodule
module DAMAGE_EVENT_RESPONSE_BEFORE
                
endmodule
module DAMAGE_EVENT_RESPONSE
                
endmodule
module DAMAGE_EVENT_RESPONSE_AFTER
endmodule
module DAMAGE_EVENT_RESPONSE_CLEANUP
                
endmodule
    //! endtextmacro
endlibrary
JASS:
library DamageEventModification /* v1.0.0.0
*************************************************************************************
*
*   Damage Event Modification plugin for DDS
*
*       
*
*************************************************************************************
*
*   */uses/*
*
*       */ DDS                      /*      hiveworkshop.com/forums/submissions-414/framework-dds-damage-detection-system-231169/
*       */ DamageEvent              /*      
*
************************************************************************************
*
*   SETTINGS
*/
globals
    /*************************************************************************************
    *
    *   
    *
    *************************************************************************************/
    
endglobals
/*
*************************************************************************************
*
*   API
*
*       
*
*************************************************************************************
*
*   Interface
*
*       
*
*************************************************************************************/
    //! textmacro DAMAGE_EVENT_MODIFICATION_CODE
        /*
        *   DDS API
        *
        *       
        *
        */
        private module DAMAGE_EVENT_MODIFICATION_API
            
        endmodule
        module DAMAGE_EVENT_MODIFICATION_INIT
            
        endmodule

        /*
        *   DDS Interface
        *
        *       
        *
        *       
        */
        module DAMAGE_EVENT_MODIFICATION_INTERFACE
            
        endmodule

        /*
        *   DDS Event Handling
        */
module DAMAGE_EVENT_MODIFICATION_RESPONSE_LOCALS
                
endmodule
module DAMAGE_EVENT_MODIFICATION_RESPONSE_BEFORE
                
endmodule
module DAMAGE_EVENT_MODIFICATION_RESPONSE
                
endmodule
module DAMAGE_EVENT_MODIFICATION_RESPONSE_AFTER
                
endmodule
module DAMAGE_EVENT_MODIFICATION_RESPONSE_CLEANUP
                
endmodule
    //! endtextmacro
endlibrary
JASS:
library DamageEventArchetype /* v1.0.0.0
*************************************************************************************
*
*   Damage Event Archetype plugin for DDS
*
*       
*
*************************************************************************************
*
*   */uses/*
*
*       */ DDS                      /*      hiveworkshop.com/forums/submissions-414/framework-dds-damage-detection-system-231169/
*       */ DamageEventModification  /*      
*
************************************************************************************
*
*   SETTINGS
*/
globals
    /*************************************************************************************
    *
    *   
    *
    *************************************************************************************/
    
endglobals
/*
*************************************************************************************
*
*   API
*
*       
*
*************************************************************************************
*
*   Interface
*
*       
*
*************************************************************************************/
    //! textmacro DAMAGE_EVENT_ARCHETYPE_CODE
        /*
        *   DDS API
        *
        *       
        *
        */
        private module DAMAGE_EVENT_ARCHETYPE_API
            
        endmodule
        module DAMAGE_EVENT_ARCHETYPE_INIT
            
        endmodule

        /*
        *   DDS Interface
        *
        *       
        *
        *       
        */
        module DAMAGE_EVENT_ARCHETYPE_INTERFACE
            
        endmodule

        /*
        *   DDS Event Handling
        */
module DAMAGE_EVENT_ARCHETYPE_RESPONSE_LOCALS
                
endmodule
module DAMAGE_EVENT_ARCHETYPE_RESPONSE_BEFORE
                
endmodule
module DAMAGE_EVENT_ARCHETYPE_RESPONSE
                
endmodule
module DAMAGE_EVENT_ARCHETYPE_RESPONSE_AFTER
                
endmodule
module DAMAGE_EVENT_ARCHETYPE_RESPONSE_CLEANUP
                
endmodule
    //! endtextmacro
endlibrary
JASS:
library DamageEventUnitModification /* v1.0.0.0
*************************************************************************************
*
*   Damage Event Unit Modification plugin for DDS
*
*       
*
*************************************************************************************
*
*   */uses/*
*
*       */ DDS                      /*      hiveworkshop.com/forums/submissions-414/framework-dds-damage-detection-system-231169/
*       */ DamageEventModification  /*      
*
************************************************************************************
*
*   SETTINGS
*/
globals
    /*************************************************************************************
    *
    *   
    *
    *************************************************************************************/
    
endglobals
/*
*************************************************************************************
*
*   API
*
*       
*
*************************************************************************************
*
*   Interface
*
*       
*
*************************************************************************************/
    //! textmacro DAMAGE_EVENT_UNIT_MODIFICATION_CODE
        /*
        *   DDS API
        *
        *       
        *
        */
        private module DAMAGE_EVENT_UNIT_MODIFICATION_API
            
        endmodule
        module DAMAGE_EVENT_UNIT_MODIFICATION_INIT
            
        endmodule

        /*
        *   DDS Interface
        *
        *       
        *
        *       
        */
        module DAMAGE_EVENT_UNIT_MODIFICATION_INTERFACE
            
        endmodule

        /*
        *   DDS Event Handling
        */
module DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE_LOCALS
                
endmodule
module DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE_BEFORE
                
endmodule
module DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE
                
endmodule
module DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE_AFTER
                
endmodule
module DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE_CLEANUP
                
endmodule
    //! endtextmacro
endlibrary
 
Last edited:
JASS:
library DDS /* v1.0.0.0
*************************************************************************************
*
*   */uses/*
*
*       */ TriggerRefresh

Fuck+that+bitch.jpg
 
By requiring TriggerRefresh you also depend on:

http://www.hiveworkshop.com/forums/jass-resources-412/system-unit-indexer-172090/

which uses UnitUserData

http://www.hiveworkshop.com/forums/jass-resources-412/snippet-worldbounds-180494/

which is completely unnecessary for any application that doesn't use dynamic map size

http://www.hiveworkshop.com/forums/jass-resources-412/snippet-event-186555/

which completely unnecessary for any application of a DD system

http://www.hiveworkshop.com/forums/jass-resources-412/snippet-binary-heap-199353/

which provides no performance metrics for efficiency in JASS.

But even if all these systems were flawless, I would never want to extend my system through this. Besides the fact that it creates a massive dependency tree, it also produces extremely unintelligible code.

If I could offer you any advice I would say that you should consider your application before considering your implementation. For the same reason as you would not program tetris in CMOS, you should also not treat jass like a compiled programming language.
 
[System] Unit Indexer

which uses UnitUserData

Required for onIndex and onDeindex. Also supports locking.

[Snippet] WorldBounds

which is completely unnecessary for any application that doesn't use dynamic map size

Required by UnitIndexer and easy to put in map with a Plugin Installation Pack

[Snippet] Event

which completely unnecessary for any application of a DD system

Required by UnitIndexer. I also happen to use either it or Priority Event in my DDS plugin, and I'll be using them for another plugin too, so not entirely unnecessary.

[Snippet] Binary Heap

which provides no performance metrics for efficiency in JASS.

You really need a comparison of a Binary Heap vs a Sorted Linked List?... lol

But even if all these systems were flawless, I would never want to extend my system through this. Besides the fact that it creates a massive dependency tree, it also produces extremely unintelligible code.

Dependency tree solved with Plugin Installation Pack.

I personally found the code to be highly readable and I wrote the new DDS Plugin stuff in a fraction of the time using the templates. It was ridiculously easy. I was even laughing at how easy it was with the templates =o. Furthermore, I found my code to be extremely readable... it was so easy to modify things during debugging... I was just so happy with the result, haha.

edit
I'll implement an optimized Binary Heap for Trigger Refresh rather than the general purpose one =).
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Index

Templates

Damage Event

Damage Event Modification

Damage Event Archetype

Damage Event Unit Modification

JASS:
library DamageEvent /* v1.0.0.0
*************************************************************************************
*
*   Damage Event plugin for DDS
*
*       source
*       target
*       damage
*       ANY (PriorityEvent or Event)
*
*************************************************************************************
*
*   */uses/*
*
*       */ DDS                      /*      hiveworkshop.com/forums/submissions-414/framework-dds-damage-detection-system-231169/
*       */ optional PriorityEvent   /*      hiveworkshop.com/forums/jass-resources-412/snippet-priority-event-213573/
*
************************************************************************************
*
*   SETTINGS
*/
globals
    /*************************************************************************************
    *
    *   
    *
    *************************************************************************************/
    
endglobals
/*
*************************************************************************************
*
*   API
*
*       
*
*************************************************************************************
*
*   Interface
*
*       
*
*************************************************************************************/
    //! textmacro DAMAGE_EVENT_CODE
        /*
        *   DDS API
        *
        *       
        *
        */
        private module DAMAGE_EVENT_API
            
        endmodule
        module DAMAGE_EVENT_INIT
            
        endmodule

        /*
        *   DDS Interface
        *
        *       
        *
        */
        module DAMAGE_EVENT_INTERFACE
            
        endmodule

        /*
        *   DDS Event Handling
        */
module DAMAGE_EVENT_RESPONSE_LOCALS
                
endmodule
module DAMAGE_EVENT_RESPONSE_BEFORE
                
endmodule
module DAMAGE_EVENT_RESPONSE
                
endmodule
module DAMAGE_EVENT_RESPONSE_AFTER
endmodule
module DAMAGE_EVENT_RESPONSE_CLEANUP
                
endmodule
    //! endtextmacro
endlibrary
JASS:
library DamageEventModification /* v1.0.0.0
*************************************************************************************
*
*   Damage Event Modification plugin for DDS
*
*       
*
*************************************************************************************
*
*   */uses/*
*
*       */ DDS                      /*      hiveworkshop.com/forums/submissions-414/framework-dds-damage-detection-system-231169/
*       */ DamageEvent              /*      
*
************************************************************************************
*
*   SETTINGS
*/
globals
    /*************************************************************************************
    *
    *   
    *
    *************************************************************************************/
    
endglobals
/*
*************************************************************************************
*
*   API
*
*       
*
*************************************************************************************
*
*   Interface
*
*       
*
*************************************************************************************/
    //! textmacro DAMAGE_EVENT_MODIFICATION_CODE
        /*
        *   DDS API
        *
        *       
        *
        */
        private module DAMAGE_EVENT_MODIFICATION_API
            
        endmodule
        module DAMAGE_EVENT_MODIFICATION_INIT
            
        endmodule

        /*
        *   DDS Interface
        *
        *       
        *
        *       
        */
        module DAMAGE_EVENT_MODIFICATION_INTERFACE
            
        endmodule

        /*
        *   DDS Event Handling
        */
module DAMAGE_EVENT_MODIFICATION_RESPONSE_LOCALS
                
endmodule
module DAMAGE_EVENT_MODIFICATION_RESPONSE_BEFORE
                
endmodule
module DAMAGE_EVENT_MODIFICATION_RESPONSE
                
endmodule
module DAMAGE_EVENT_MODIFICATION_RESPONSE_AFTER
                
endmodule
module DAMAGE_EVENT_MODIFICATION_RESPONSE_CLEANUP
                
endmodule
    //! endtextmacro
endlibrary
JASS:
library DamageEventArchetype /* v1.0.0.0
*************************************************************************************
*
*   Damage Event Archetype plugin for DDS
*
*       
*
*************************************************************************************
*
*   */uses/*
*
*       */ DDS                      /*      hiveworkshop.com/forums/submissions-414/framework-dds-damage-detection-system-231169/
*       */ DamageEventModification  /*      
*
************************************************************************************
*
*   SETTINGS
*/
globals
    /*************************************************************************************
    *
    *   
    *
    *************************************************************************************/
    
endglobals
/*
*************************************************************************************
*
*   API
*
*       
*
*************************************************************************************
*
*   Interface
*
*       
*
*************************************************************************************/
    //! textmacro DAMAGE_EVENT_ARCHETYPE_CODE
        /*
        *   DDS API
        *
        *       
        *
        */
        private module DAMAGE_EVENT_ARCHETYPE_API
            
        endmodule
        module DAMAGE_EVENT_ARCHETYPE_INIT
            
        endmodule

        /*
        *   DDS Interface
        *
        *       
        *
        *       
        */
        module DAMAGE_EVENT_ARCHETYPE_INTERFACE
            
        endmodule

        /*
        *   DDS Event Handling
        */
module DAMAGE_EVENT_ARCHETYPE_RESPONSE_LOCALS
                
endmodule
module DAMAGE_EVENT_ARCHETYPE_RESPONSE_BEFORE
                
endmodule
module DAMAGE_EVENT_ARCHETYPE_RESPONSE
                
endmodule
module DAMAGE_EVENT_ARCHETYPE_RESPONSE_AFTER
                
endmodule
module DAMAGE_EVENT_ARCHETYPE_RESPONSE_CLEANUP
                
endmodule
    //! endtextmacro
endlibrary
JASS:
library DamageEventUnitModification /* v1.0.0.0
*************************************************************************************
*
*   Damage Event Unit Modification plugin for DDS
*
*       
*
*************************************************************************************
*
*   */uses/*
*
*       */ DDS                      /*      hiveworkshop.com/forums/submissions-414/framework-dds-damage-detection-system-231169/
*       */ DamageEventModification  /*      
*
************************************************************************************
*
*   SETTINGS
*/
globals
    /*************************************************************************************
    *
    *   
    *
    *************************************************************************************/
    
endglobals
/*
*************************************************************************************
*
*   API
*
*       
*
*************************************************************************************
*
*   Interface
*
*       
*
*************************************************************************************/
    //! textmacro DAMAGE_EVENT_UNIT_MODIFICATION_CODE
        /*
        *   DDS API
        *
        *       
        *
        */
        private module DAMAGE_EVENT_UNIT_MODIFICATION_API
            
        endmodule
        module DAMAGE_EVENT_UNIT_MODIFICATION_INIT
            
        endmodule

        /*
        *   DDS Interface
        *
        *       
        *
        *       
        */
        module DAMAGE_EVENT_UNIT_MODIFICATION_INTERFACE
            
        endmodule

        /*
        *   DDS Event Handling
        */
module DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE_LOCALS
                
endmodule
module DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE_BEFORE
                
endmodule
module DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE
                
endmodule
module DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE_AFTER
                
endmodule
module DAMAGE_EVENT_UNIT_MODIFICATION_RESPONSE_CLEANUP
                
endmodule
    //! endtextmacro
endlibrary


what is this i dont even? is this finished code..?

e/ no idea why its not formatting properly
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Wow, this is a lot of new stuff to check^^

The TriggerRefresh as a seperate resource is actually a good thing, I maybe will make it optional in my system. Then people can decide for themselfes if they want to use this massive amount of additional systems or not. But its a nice thing to have such a resource.

What seems strange: If I deal spell damage to a unit, further physical damages are not registered... So this:

JASS:
struct Test extends array
    private static method onDamage takes nothing returns nothing
        if (archetype == Archetype.SPELL) then
            call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"SPELL Damage: "+R2S(damage))
        else
            call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"PHYSICAL Damage: "+R2S(damage))
        endif
    endmethod

    implement DDS
endstruct

won't do anything for physical damage events when there was a spell damage event before...
 
Required for onIndex and onDeindex. Also supports locking.

Not required for StructuredDD. And it breaks every amateur's ability to write MUI spells. UnitUserData should be reserved for inexperienced map developers.


Required by UnitIndexer and easy to put in map with a Plugin Installation Pack

Not required by StructuredDD. Just as easily installed with copy and paste. That's not the point.

Required by UnitIndexer. I also happen to use either it or Priority Event in my DDS plugin, and I'll be using them for another plugin too, so not entirely unnecessary.

Not required by StructuredDD.

You really need a comparison of a Binary Heap vs a Sorted Linked List?... lol

You shouldn't need anything sorted in a DD system unless you want to prioritize some handlers. In that case, yes, I would love to see some value of handlers for which a binary heap is faster than a linked list. I'm not even convinced that this is faster than naively sorting an array (eg selection sort)
 
Okay, Nestharus, here we go.

This system is easy to install (just copypasting 3 abilities + some folders is very nice and classic way of a good system).
A lot of keywords, but that makes this system pretty functional. I'd recommended this system to some of the moderate-skilled vJass coders because newcomers trying to learn that will be completely amused about its size.
Anyways, this makes spellmaking a bit easier when it comes to the damage detection. It saves some time (no need to make a large event triggers - just use the onDamage. Simple and clean code :>).
Overall - T-up for that one.

Comparison: All of them are easy to use and easy to import, the spells of these forms go like 1-2-3 with those things... You are all nice coders, but Nes did the nicest work on his snippet. This is only my humble opinion.
 
Last edited:
Wow, this is a lot of new stuff to check^^

The TriggerRefresh as a seperate resource is actually a good thing, I maybe will make it optional in my system. Then people can decide for themselfes if they want to use this massive amount of additional systems or not. But its a nice thing to have such a resource.

What seems strange: If I deal spell damage to a unit, further physical damages are not registered... So this:

JASS:
struct Test extends array
    private static method onDamage takes nothing returns nothing
        if (archetype == Archetype.SPELL) then
            call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"SPELL Damage: "+R2S(damage))
        else
            call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"PHYSICAL Damage: "+R2S(damage))
        endif
    endmethod

    implement DDS
endstruct

won't do anything for physical damage events when there was a spell damage event before...

Fixed : )

Improved Install Pack to be 1 folder ;o

Optimized Binary Heap in Trigger Refresh thing to be awesomely fast and use minimal code (fully tested to be bugless update)

Changed Event and WorldBounds to library_once and included them in Trigger Refresh. The only extra thing Trigger Refresh includes is Unit Indexer >.>. Is 1 requirement seriously too much? Furthermore, it's cnp'd into the map via the plugin pack... seriously... you can do the same for your own plugins or plugin packs...

TriggerRefresh no longer locks unit indexes on index/deindex. That was really pointless, rofl

DDS Plugin Damage Event now locks unit indexes at the start/end of the damage event to ensure that they aren't lost.

Archetype plugin now correctly re-enables user events. The re-enable condition was wrong : o.
 
Top