• 🏆 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!

[vJASS] Spell Steal (Spell Breaker) using Flux's Buff System

Status
Not open for further replies.
Level 14
Joined
Oct 16, 2011
Messages
296
I was looking for a way to make a Spell Steal using Flux's Buff System which would also work on buffs whose effects arent really triggered (Polymorph, Inner Fire, Banish, etc.) by adding the 'OrderId' of a casted spell and a 'SpellStealPriority' integer in its Buff in the Buff System. My idea is:
  • Loop and get the buff with highest 'SpellStealPrio'
  • Remove the buff
  • Dummy casts the buff on another unit using its 'OrderId'
My problem is, I'm still very new to vJass and learning how Flux's Buff Library work is DarkSouls difficulty for me. I am hoping for someone who can tell me how to properly do this, as I desperately need to make this work. Thanks in advance.

Link to Flux's Buff System
JASS:
scope HumanPolymorph

struct HumanPolymorphBuff extends Buff

    private timer t

    private static constant integer RAWCODE = 'A035'        // Blank/Dummy Ability
    private static constant integer DISPEL_TYPE = BUFF_NEGATIVE
    private static constant integer STACK_TYPE =  BUFF_STACK_NONE

    method onRemove takes nothing returns nothing
        call UnitRemoveAbility(this.target, 'Bply')
    endmethod

    method onApply takes nothing returns nothing
    endmethod

    implement BuffApply
endstruct

struct HumanPolymorph extends array

    private static method onCast takes nothing returns nothing
        local HumanPolymorphBuff b
        set b = HumanPolymorphBuff.add(GetTriggerUnit(), GetSpellTargetUnit())
        set b.duration = 60
    endmethod

    static method onInit takes nothing returns nothing
        call RegisterSpellEffectEvent('Aply', function thistype.onCast)
    endmethod

endstruct

endscope
JASS:
scope HumanInnerFire

struct HumanInnerFireBuff extends Buff

    private timer t

    private static constant integer RAWCODE = 'A035'        // Blank/Dummy Ability
    private static constant integer DISPEL_TYPE = BUFF_POSITIVE
    private static constant integer STACK_TYPE =  BUFF_STACK_NONE

    method onRemove takes nothing returns nothing
        call UnitRemoveAbility(this.target, 'Binf')
    endmethod

    method onApply takes nothing returns nothing
    endmethod

    implement BuffApply
endstruct

struct HumanInnerFire extends array

    private static method onCast takes nothing returns nothing
        local HumanInnerFireBuff b
        set b = HumanInnerFireBuff.add(GetTriggerUnit(), GetSpellTargetUnit())
        set b.duration = 60
    endmethod

    static method onInit takes nothing returns nothing
        call RegisterSpellEffectEvent('Ainf', function thistype.onCast)
    endmethod

endstruct

endscope
 
Status
Not open for further replies.
Top