hgkjfhfdsj
Active Member
- Reaction score
- 55
JASS:
//! runtextmacro BuffType("Cleanse")
//! runtextmacro SetBuffName("Cleanse")
//! runtextmacro SetBuffAlignment("POSITIVE")
//! runtextmacro SetBuffTooltip("This unit is has Cleanse; it regains the mana used to cast the next non-ultimate spell.")
//! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTNHeal.blp")
//! runtextmacro BuffStruct()
private method remove takes thistype b returns nothing
call b.destroy()
call BJDebugMsg("remove")
endmethod
method onApply takes nothing returns nothing
call BuffList[.unit].forEachBuff(BUFF_ALIGNMENT_NEGATIVE, .remove)
endmethod
//! runtextmacro EndBuff()
JASS:
scope Cleanse initializer Init
//! textmacro CLEANSE takes SPELL, MANA1, MANA2, MANA3, MANA4
private struct CleanseStruct
unit u
private static method Action takes nothing returns boolean
local thistype kt
local unit u = GetTriggerUnit()
local real array add
if GetSpellAbilityId() == ID and Cleanse.isOn(u) then
set add[1] = $MANA1$
set add[2] = $MANA2$
set add[3] = $MANA3$
set add[4] = $MANA4$
call SetUnitState(u, UNIT_STATE_MANA, GetUnitState(u, UNIT_STATE_MANA) + add[GetUnitAbilityLevel(u, $SPELL$)])
call Cleanse(u).setUnit(null) // < --------------------<
endif
set u = null
return false
endmethod
private static method onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t, Condition(function thistype.Action))
endmethod
endstruct
//! endtextmacro
globals
public constant integer ID = 039;A000039;
endglobals
private function Conditions takes nothing returns boolean
local unit target = GetSpellAbilityUnit()
if GetSpellAbilityId() == ID then
if Cleanse.isOn(target) == false then
call Cleanse.create(target)
set target = null
endif
endif
return false
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
endfunction
endscope
What the spell does
- regains the mana used to cast the next non-ultimate spell. also removes all negative buffs
- uses textmacro to set mana cost of every spell (need helping optimizing it)
- buff is created on cast; icon shows; heals mana
Problem
syntax error (tried both)
cannot convert unit to integer
JASS:
call Cleanse(u).setUnit(null)
call Cleanse(u).destroy()
this is preventing me from removing buff
also which should i use.. setunit(null) or destroy?