function WC2HealConditions takes nothing returns boolean
if ( GetSpellAbilityId() == 'A000') then
return true
endif
return false
endfunction
function WC2Heal takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local real mana = GetUnitState( caster, UNIT_STATE_MANA )
local real health = GetUnitState( target, UNIT_STATE_LIFE )
local real healing = GetUnitState( target, UNIT_STATE_MAX_LIFE ) - health
local real maxhealing = 100 * I2R( GetUnitAbilityLevel( caster, 'A000' ) )
if ( healing > mana ) then
set healing = mana
if ( healing > maxhealing ) then
set healing = maxhealing
endif
endif
call SetUnitState( target, UNIT_STATE_LIFE, RMaxBJ( 0, health + healing ) )
call SetUnitState( caster, UNIT_STATE_MANA, RMaxBJ( 0, mana - healing ) )
endfunction
//===========================================================================
function InitTrig_WC2Heal takes nothing returns nothing
local trigger trg_WC2Heal = CreateTrigger()
// call TriggerRegisterAnyUnitEventBJ( trg_WC2Heal, EVENT_PLAYER_UNIT_SPELL_EFFECT ) //For All Players
call TriggerRegisterPlayerUnitEvent( trg_WC2Heal, Player(0), EVENT_PLAYER_UNIT_SPELL_EFFECT, null ) //For One Player
call TriggerAddCondition( trg_WC2Heal, Condition( function WC2HealConditions ) )
call TriggerAddAction( trg_WC2Heal, function WC2Heal )
endfunction