Circle of Power v1
450
lvl: 10

ID:

245

Author:

Deemzul

Rarity:

unique

Status:

Approved

Description:

Power! Unlimited power!

Latest Upload Comment:

Restored from 1.10
Circle of Power
Every 5 seconds, if the carrier of this item has less mana than it had 5 seconds ago, the carrier has a 25% chance to restore mana to what it was before.
Download

Toggle Triggers

On Item Pickup

goldcost: 0
function onPickup  takes Item itm returns nothing
    set itm.userReal = GetUnitState(itm.getCarrier().getUnit(),UNIT_STATE_MANA)
endfunction

Periodic

goldcost: 450 PERIODIC_period: 5
function periodic takes Item itm returns nothing
    local Unit u = itm.getCarrier()
    local real curMana = GetUnitState(u.getUnit(),UNIT_STATE_MANA)
    if curMana < itm.userReal and u.calcChance(0.25) then
        call SetUnitState(u.getUnit(), UNIT_STATE_MANA, itm.userReal)
        call Effect.createSimpleAtUnit("Abilities\\Spells\\Items\\AIma\\AImaTarget.mdl",u).destroy()
    else    //had more mana or failed chance
        set itm.userReal = curMana
    endif
endfunction