function Trig_Tranquility_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A03M'
endfunction
function Trig_Tranquility_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetTriggerPlayer()
local unit pu
local integer a = 0
local integer mpcost = GetUnitAbilityLevel(u, 'A03M') * 10
local real heal = GetUnitAbilityLevel(u, 'A03M') * 100 + udg_TotalSpellPower[GetPlayerId(p)+1]
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local group gr = bj_lastCreatedGroup
local string s = "Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl"
loop
exitwhen (GetWidgetLife(u)<0.435 or (OrderId2String(GetUnitCurrentOrder(u)) != "tranquility") or GetUnitState(u,UNIT_STATE_MANA)<5)
call GroupEnumUnitsInRange(gr, x, y, 250.00, null)
loop
set pu = FirstOfGroup(gr)
exitwhen (pu==null)
if ((IsUnitEnemy(pu, p)==false) and (GetWidgetLife(pu) > 0.435)) then
call DestroyEffect(AddSpecialEffectTarget(s, pu, "origin"))
call SetWidgetLife(pu, GetWidgetLife(u)+heal)
endif
call GroupRemoveUnit(gr, pu)
endloop
call SetUnitState(u, UNIT_STATE_MANA, GetUnitState(u,UNIT_STATE_MANA) - mpcost)
call TriggerSleepAction(1)
endloop
set u = null
set gr = null
set p = null
set s = null
endfunction
//===========================================================================
function InitTrig_Tranquility takes nothing returns nothing
set gg_trg_Tranquility = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Tranquility, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Tranquility, Condition( function Trig_Tranquility_Conditions ) )
call TriggerAddAction( gg_trg_Tranquility, function Trig_Tranquility_Actions )
endfunction