library setAttribute initializer Initialization
globals
//===================================================================================================================//
// Information. ReadMe. //
//-------------------------------------------------------------------------------------------------------------------//
// The library provides the following abilities //
//-------------------------------------------------------------------------------------------------------------------//
// //
// The bonus parameters are limited: (-8191;8191) //
// It's impossible to set the parameters over that amount via this system //
// //
// - Ability to control unit's Bonus Damage //
// [function SetUnitExtraDamage takes unit u, integer ammount] - Sets damage //
// [function GetUnitExtraDamage takes unit u returns integer] - Returns damage //
// //
// - Ability to control unit's Bonus Armor //
// [function SetUnitExtraArmor takes unit u, integer ammount] - Sets armor //
// [function GetUnitExtraArmor takes unit u returns integer] - Returns armor //
// //
// - Ability to control unit's max. HP //
// [function SetUnitLife takes unit u, integer ammount] - Sets unit's max. HP //
// [function GetUnitLife takes unit u returns integer] - Returns unit's max. HP bonus taken from this system //
// //
// - Ability to control unit's max. Mana //
// [function SetUnitMana takes unit u, integer ammount] - Sets unit's max. Mana //
// [function GetUnitMana takes unit u returns integer] - Returns unit's max. Mana bonus taken from this system // // //
// //
// - Ability to control unit's HP Regeneration //
// [function SetUnitLifeRegeneration takes unit u, real ammount] - Sets unit's HP regeneration //
// [function GetUnitLifeRegeneration takes unit u returns real] - Returns unit's HP regeneration //
// //
// - Ability to control unit's Mana Regeneration //
// [function SetUnitManaRegeneration takes unit u, real ammount] - Sets unit's Mana regeneration //
// [function GetUnitManaRegeneration takes unit u returns real] - Returns unit's Mana regeneration //
// //
// - Ability to control unit's Base Damage //
// [function SetUnitBaseDamage takes unit getUnit, integer ammount] - Sets unit's Base Damage //
// [function GetUnitBaseDamage takes unit u returns integer] - Returns unit's Base Damage bonus //
// //
// - Ability to block some ammount of damage for any unit //
// [function SetUnitBlockDamageAmmount takes unit u, real ammount] - Sets unit's damage block ammount //
// [function GetUnitBlockDamageAmmount takes unit u, real ammount] - Returns unit's damage block ammount //
// //
// - Ability to block some percent of damage for any unit (0-100) //
// [function SetUnitBlockDamagePercent takes unit u, real ammount] - Sets unit's damage block percent //
// [function GetUnitBlockDamagePercent takes unit u, real ammount] - Returns unit's damage block percent //
// //
// - Ability to control unit's Attack Speed (the bonus AS is limited from 0 to 400(%)) //
// [function SetUnitAttackSpeed takes unit u, integer ammount] - Sets unit's Attack Speed //
// [function GetUnitAttackSpeed takes unit u, integer ammount] - Returns unit's Attack Speed //
// //
//-------------------------------------------------------------------------------------------------------------------//
// Replace "Hash" with the name of your hashtable (CTRL+H)
// Configure the following arrays
private integer HASH_BASE_DAMAGE_INDEX = 1 //The Base Damage data are stored in Hashtable on unit's handle with this key
private integer HASH_LIFE_REGENERATION_INDEX = 2 //The HP regeneration data are stored in Hashtable on unit's handle with this key
private integer HASH_MANA_REGENERATION_INDEX = 3 //The Mana regeneration data are stored in Hashtable on unit's handle with this key
private integer HASH_EXTRA_ARMOR_INDEX = 4 //The Bonus Damage data are stored in Hashtable on unit's handle with this key
private integer HASH_EXTRA_DAMAGE_INDEX = 5 //The Bonus Armor data are stored in Hashtable on unit's handle with this key
private integer HASH_BLOCK_DAMAGE_AMMOUNT_INDEX = 6 //The Block Damage Ammount data are stored in Hashtable on unit's handle with this key
private integer HASH_BLOCK_DAMAGE_PERCENT_INDEX = 7 //The Block Damage Percent data are stored in Hashtable on unit's handle with this key
private integer HASH_ATTACK_SPEED_INDEX = 8 //The Attack Speed data are stored in Hashtable on unit's handle with this key
private integer HASH_MAX_LIFE_BONUS_INDEX = 9 //The Max HP data are stored in Hashtable on unit's handle with this key
private integer HASH_MAX_MANA_BONUS_INDEX = 10 //The Max Mana data are stored in Hashtable on unit's handle with this key
private real restorationPeriod = 0.01 //The period of restoration of HP/Mana
private integer array abilityAddArmor //An array of abilities to increase an armor
private integer array abilityRemoveArmor //An array of abilities to reduce an armor
private integer array abilityAddHp //An array of abilities to increase HP
private integer array abilityRemoveHp //An array of abilities to reduce HP
private integer array abilityAddMana //An array of abilities to increase Mana
private integer array abilityRemoveMana //An array of abilities to reduce HP
private integer array abilityAddDamage //An array of abilities to increase Bonus Damage
private integer array abilityRemoveDamage //An array of abilities to reduce Bonus Damage
private integer array itemAddBaseDamage //An array of items to increase Base Damage
private integer array itemRemoveBaseDamage //An array of items to reduce Bonus Damage
private integer array abilityAddAttackSpeed //An array of abilities to increase Attack Speed
private trigger detectDamage
private timer restoration = CreateTimer()
private group allUnits = CreateGroup()
private region wholeMap
endglobals
function GetUnitMana takes unit u returns integer
local integer iD = GetHandleId(u)
local integer ammount
set ammount = LoadInteger(Hash,iD,HASH_MAX_MANA_BONUS_INDEX)
return ammount
endfunction
function GetUnitLife takes unit u returns integer
local integer iD = GetHandleId(u)
local integer ammount
set ammount = LoadInteger(Hash,iD,HASH_MAX_LIFE_BONUS_INDEX)
return ammount
endfunction
function GetUnitExtraArmor takes unit u returns integer
local integer iD = GetHandleId(u)
local integer ammount
set ammount = LoadInteger(Hash,iD,HASH_EXTRA_ARMOR_INDEX)
return ammount
endfunction
function GetUnitExtraDamage takes unit u returns integer
local integer iD = GetHandleId(u)
local integer ammount
set ammount = LoadInteger(Hash,iD,HASH_EXTRA_DAMAGE_INDEX)
return ammount
endfunction
function GetUnitBaseDamage takes unit u returns integer
local integer iD = GetHandleId(u)
local integer ammount
set ammount = LoadInteger(Hash,iD,HASH_BASE_DAMAGE_INDEX)
return ammount
endfunction
function GetUnitLifeRegeneration takes unit u returns real
local integer iD = GetHandleId(u)
local real ammount
set ammount = LoadReal(Hash,iD,HASH_LIFE_REGENERATION_INDEX)
return ammount
endfunction
function GetUnitManaRegeneration takes unit u returns real
local integer iD = GetHandleId(u)
local real ammount
set ammount = LoadReal(Hash,iD,HASH_MANA_REGENERATION_INDEX)
return ammount
endfunction
function GetUnitBlockDamageAmmount takes unit u returns real
local integer iD = GetHandleId(u)
local real ammount
set ammount = LoadReal(Hash,iD,HASH_BLOCK_DAMAGE_AMMOUNT_INDEX)
return ammount
endfunction
function GetUnitBlockDamagePercent takes unit u returns real
local integer iD = GetHandleId(u)
local real ammount
set ammount = LoadReal(Hash,iD,HASH_BLOCK_DAMAGE_PERCENT_INDEX)
return ammount
endfunction
function GetUnitAttackSpeed takes unit u returns integer
local integer iD = GetHandleId(u)
local integer ammount
set ammount = LoadInteger(Hash,iD,HASH_ATTACK_SPEED_INDEX)
return ammount
endfunction
function SetUnitBlockDamageAmmount takes unit u, real ammount returns nothing
local integer iD = GetHandleId(u)
if ammount > 8191 then
set ammount = 8191
call SaveReal(Hash,iD,HASH_BLOCK_DAMAGE_AMMOUNT_INDEX,ammount)
elseif ammount < 0 then
set ammount = 0
call SaveReal(Hash,iD,HASH_BLOCK_DAMAGE_AMMOUNT_INDEX,ammount)
else
call SaveReal(Hash,iD,HASH_BLOCK_DAMAGE_AMMOUNT_INDEX,ammount)
endif
endfunction
function SetUnitBlockDamagePercent takes unit u, real ammount returns nothing
local integer iD = GetHandleId(u)
if ammount > 100 then
set ammount = 100
call SaveReal(Hash,iD,HASH_BLOCK_DAMAGE_PERCENT_INDEX,ammount)
elseif ammount < 0 then
set ammount = 0
call SaveReal(Hash,iD,HASH_BLOCK_DAMAGE_PERCENT_INDEX,ammount)
else
call SaveReal(Hash,iD,HASH_BLOCK_DAMAGE_PERCENT_INDEX,ammount)
endif
endfunction
function SetUnitAttackSpeed takes unit u, integer ammount returns nothing
local integer iD = GetHandleId(u)
local integer power = 8
local integer index = 0
local integer rest
if ammount > 400 then
set ammount = 400
endif
loop
call UnitRemoveAbility(u,abilityAddAttackSpeed[index])
exitwhen index == 8
set index = index+1
endloop
if ammount > 0 then
set rest = ammount
loop
exitwhen rest <= 0
if R2I(Pow(2,power)) > rest then
set power = power-1
elseif R2I(Pow(2,power)) <= rest then
call UnitAddAbility(u,abilityAddAttackSpeed[power])
set rest = rest-R2I(Pow(2,power))
set power = power-1
endif
endloop
call SaveInteger(Hash,iD,HASH_ATTACK_SPEED_INDEX,ammount)
endif
endfunction
function SetUnitExtraArmor takes unit u, integer ammount returns nothing
local integer iD = GetHandleId(u)
local integer power = 13
local integer index = 0
local integer rest
if ammount > 8191 then
set ammount = 8191
elseif ammount < -8191 then
set ammount = -8191
endif
loop
call UnitRemoveAbility(u,abilityAddArmor[index])
call UnitRemoveAbility(u,abilityRemoveArmor[index])
exitwhen index == 12
set index = index+1
endloop
if ammount > 0 then
set rest = ammount
loop
exitwhen rest <= 0
if R2I(Pow(2,power)) > rest then
set power = power-1
elseif R2I(Pow(2,power)) <= rest then
call UnitAddAbility(u,abilityAddArmor[power])
set rest = rest-R2I(Pow(2,power))
set power = power-1
endif
endloop
call SaveInteger(Hash,iD,HASH_EXTRA_ARMOR_INDEX,ammount)
elseif ammount < 0 then
set ammount = -ammount
set rest = ammount
loop
exitwhen rest <= 0
if R2I(Pow(2,power)) > rest then
set power = power-1
elseif R2I(Pow(2,power)) <= rest then
call UnitAddAbility(u,abilityRemoveArmor[power])
set rest = rest-R2I(Pow(2,power))
set power = power-1
endif
endloop
call SaveInteger(Hash,iD,HASH_EXTRA_ARMOR_INDEX,-ammount)
endif
endfunction
function SetUnitBaseDamage takes unit u, integer ammount returns nothing
local integer power = 12
local integer rest
local integer iD = GetHandleId(u)
local integer prevID = LoadInteger(Hash,iD,HASH_BASE_DAMAGE_INDEX)
local boolean removeInventory = false
if GetUnitAbilityLevel(u,'AInv') <= 0 then
set removeInventory = true
call UnitAddAbility(u,'AInv')
endif
if ammount > 8191 then
set ammount = 8191
endif
if prevID+ammount < 0 then
set ammount = -prevID
else
if prevID != 0 and prevID+ammount > 0 then
set ammount = -(prevID-ammount)
endif
endif
if ammount > 0 then
set rest = ammount
loop
exitwhen rest <= 0
if R2I(Pow(2,power)) > rest then
set power = power-1
elseif R2I(Pow(2,power)) <= rest then
set bj_lastCreatedItem = CreateItem(itemAddBaseDamage[power],GetUnitX(u),GetUnitY(u))
call UnitAddItem(u,bj_lastCreatedItem)
call RemoveItem(bj_lastCreatedItem)
set rest = rest-R2I(Pow(2,power))
set power = power-1
endif
endloop
set prevID = prevID+ammount
call SaveInteger(Hash,iD,HASH_BASE_DAMAGE_INDEX,prevID)
elseif ammount < 0 then
set ammount = -ammount
set rest = ammount
loop
exitwhen rest <= 0
if R2I(Pow(2,power)) > rest then
set power = power-1
elseif R2I(Pow(2,power)) <= rest then
set bj_lastCreatedItem = CreateItem(itemRemoveBaseDamage[power],GetUnitX(u),GetUnitY(u))
call UnitAddItem(u,bj_lastCreatedItem)
call RemoveItem(bj_lastCreatedItem)
set rest = rest-R2I(Pow(2,power))
set power = power-1
endif
endloop
set prevID = prevID-ammount
call SaveInteger(Hash,iD,HASH_BASE_DAMAGE_INDEX,prevID)
endif
if GetUnitAbilityLevel(u,'AInv') > 0 and removeInventory == true then
call UnitRemoveAbility(u,'AInv')
endif
endfunction
function SetUnitExtraDamage takes unit u, integer ammount returns nothing
local integer iD = GetHandleId(u)
local integer power = 12
local integer index = 0
local integer rest
if ammount > 8191 then
set ammount = 8191
elseif ammount < -8191 then
set ammount = -8191
endif
loop
call UnitRemoveAbility(u,abilityAddDamage[index])
call UnitRemoveAbility(u,abilityRemoveDamage[index])
exitwhen index == 12
set index = index+1
endloop
if ammount > 0 then
set rest = ammount
loop
exitwhen rest <= 0
if R2I(Pow(2,power)) > rest then
set power = power-1
elseif R2I(Pow(2,power)) <= rest then
call UnitAddAbility(u,abilityAddDamage[power])
set rest = rest-R2I(Pow(2,power))
set power = power-1
endif
endloop
call SaveInteger(Hash,iD,HASH_EXTRA_DAMAGE_INDEX,ammount)
elseif ammount < 0 then
set ammount = -ammount
set rest = ammount
loop
exitwhen rest <= 0
if R2I(Pow(2,power)) > rest then
set power = power-1
elseif R2I(Pow(2,power)) <= rest then
call UnitAddAbility(u,abilityRemoveDamage[power])
set rest = rest-R2I(Pow(2,power))
set power = power-1
endif
endloop
call SaveInteger(Hash,iD,HASH_EXTRA_DAMAGE_INDEX,-ammount)
endif
endfunction
function SetUnitLife takes unit u, integer ammount returns nothing
local integer power = 12
local integer rest
local integer loadedLife
local integer newLife
local integer iD = GetHandleId(u)
if ammount > 8191 then
set ammount = 8191
elseif GetUnitState(u,UNIT_STATE_MAX_LIFE)+ammount <= 0 then
set ammount = 1
endif
set loadedLife = LoadInteger(Hash,iD,HASH_MAX_LIFE_BONUS_INDEX)
set newLife = loadedLife+(ammount-R2I(GetUnitState(u,UNIT_STATE_MAX_MANA)))
call SaveInteger(Hash,iD,HASH_MAX_LIFE_BONUS_INDEX,newLife)
set ammount = ammount-R2I(GetUnitState(u,UNIT_STATE_MAX_LIFE))
if ammount > 0 then
set rest = ammount
loop
exitwhen rest <= 0
if R2I(Pow(2,power)) > rest then
set power = power-1
elseif R2I(Pow(2,power)) <= rest then
call UnitAddAbility(u,abilityAddHp[power])
call SetUnitAbilityLevel(u,abilityAddHp[power],2)
call UnitRemoveAbility(u,abilityAddHp[power])
set rest = rest-R2I(Pow(2,power))
set power = power-1
endif
endloop
elseif ammount < 0 then
set ammount = -ammount
set rest = ammount
loop
exitwhen rest <= 0
if R2I(Pow(2,power)) > rest then
set power = power-1
elseif R2I(Pow(2,power)) <= rest then
call UnitAddAbility(u,abilityRemoveHp[power])
call SetUnitAbilityLevel(u,abilityRemoveHp[power],2)
call UnitRemoveAbility(u,abilityRemoveHp[power])
set rest = rest-R2I(Pow(2,power))
set power = power-1
endif
endloop
endif
endfunction
function SetUnitMana takes unit u, integer ammount returns nothing
local integer power = 12
local integer rest
local integer loadedMana
local integer newMana
local integer iD = GetHandleId(u)
if ammount > 8191 then
set ammount = 8191
elseif GetUnitState(u,UNIT_STATE_MAX_MANA)+ammount < 0 then
set ammount = 0
endif
set loadedMana = LoadInteger(Hash,iD,HASH_MAX_MANA_BONUS_INDEX)
set newMana = loadedMana+(ammount-R2I(GetUnitState(u,UNIT_STATE_MAX_MANA)))
call SaveInteger(Hash,iD,HASH_MAX_MANA_BONUS_INDEX,newMana)
set ammount = ammount-R2I(GetUnitState(u,UNIT_STATE_MAX_MANA))
if ammount > 0 then
set rest = ammount
loop
exitwhen rest <= 0
if R2I(Pow(2,power)) > rest then
set power = power-1
elseif R2I(Pow(2,power)) <= rest then
call UnitAddAbility(u,abilityAddMana[power])
call SetUnitAbilityLevel(u,abilityAddMana[power],2)
call UnitRemoveAbility(u,abilityAddMana[power])
set rest = rest-R2I(Pow(2,power))
set power = power-1
endif
endloop
elseif ammount < 0 then
set ammount = -ammount
set rest = ammount
loop
exitwhen rest <= 0
if R2I(Pow(2,power)) > rest then
set power = power-1
elseif R2I(Pow(2,power)) <= rest then
call UnitAddAbility(u,abilityRemoveMana[power])
call SetUnitAbilityLevel(u,abilityRemoveMana[power],2)
call UnitRemoveAbility(u,abilityRemoveMana[power])
set rest = rest-R2I(Pow(2,power))
set power = power-1
endif
endloop
endif
endfunction
function SetUnitLifeRegeneration takes unit u, real ammount returns nothing
local integer iD = GetHandleId(u)
call SaveReal(Hash,iD,HASH_LIFE_REGENERATION_INDEX,ammount)
call GroupAddUnit(allUnits,u)
endfunction
function SetUnitManaRegeneration takes unit u, real ammount returns nothing
local integer iD = GetHandleId(u)
call SaveReal(Hash,iD,HASH_MANA_REGENERATION_INDEX,ammount)
call GroupAddUnit(allUnits,u)
endfunction
private function restoreParamatersCallback takes nothing returns nothing
local integer iD = GetHandleId(GetEnumUnit())
local real hpRegen = LoadReal(Hash,iD,HASH_LIFE_REGENERATION_INDEX)
local real manaRegen = LoadReal(Hash,iD,HASH_MANA_REGENERATION_INDEX)
call SetUnitState(GetEnumUnit(),UNIT_STATE_LIFE,GetUnitState(GetEnumUnit(),UNIT_STATE_LIFE)+hpRegen*restorationPeriod)
call SetUnitState(GetEnumUnit(),UNIT_STATE_MANA,GetUnitState(GetEnumUnit(),UNIT_STATE_MANA)+manaRegen*restorationPeriod)
endfunction
private function restoreParamaters takes nothing returns nothing
call ForGroup(allUnits,function restoreParamatersCallback)
endfunction
private function onMapEntering takes nothing returns nothing
if GetEnteringUnit()!=null then
call TriggerRegisterUnitEvent(GetTriggeringTrigger(),GetEnteringUnit(),EVENT_UNIT_DAMAGED)
endif
endfunction
private function TriggerRegisterUnitEventDamaged takes trigger detectDamageTrig returns nothing
local group groupEnumUnits = CreateGroup()
local unit enumUnit
call GroupEnumUnitsInRect(groupEnumUnits,bj_mapInitialPlayableArea,null)
loop
set enumUnit = FirstOfGroup(groupEnumUnits)
exitwhen enumUnit == null
call TriggerRegisterUnitEvent(detectDamageTrig,enumUnit,EVENT_UNIT_DAMAGED)
call GroupRemoveUnit(groupEnumUnits,enumUnit)
endloop
call TriggerRegisterEnterRegion(detectDamageTrig,wholeMap,null)
call TriggerAddAction(detectDamageTrig,function onMapEntering)
call DestroyGroup(groupEnumUnits)
set groupEnumUnits=null
set enumUnit=null
endfunction
private function damageTarget takes nothing returns nothing
local timer dealDamage = GetExpiredTimer()
local integer iD = GetHandleId(dealDamage)
local unit Attacked = LoadUnitHandle(Hash,iD,'trgD')
local unit Attacker = LoadUnitHandle(Hash,iD,'DMGS')
local real Damage = LoadReal(Hash,iD,'TDMG')
call SetUnitInvulnerable(Attacked,false)
call DisableTrigger(detectDamage)
call UnitDamageTarget(Attacker,Attacked,(Damage-GetUnitBlockDamageAmmount(Attacked))*(1-GetUnitBlockDamagePercent(Attacked)/100),true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
call EnableTrigger(detectDamage)
call DestroyTimer(dealDamage)
call FlushChildHashtable(Hash,iD)
set dealDamage = null
set Attacked = null
set Attacker = null
endfunction
private function onDamage takes nothing returns nothing
local timer dealDamage
local integer iD
local unit Attacked = GetTriggerUnit()
local real Damage = GetEventDamage()
local unit Attacker = GetEventDamageSource()
if GetWidgetLife(Attacked) <= Damage or GetWidgetLife(Attacked)+Damage+GetUnitBlockDamageAmmount(Attacked) > GetUnitState(Attacked,UNIT_STATE_MAX_LIFE) then
call SetUnitInvulnerable(Attacked,true)
set dealDamage = CreateTimer()
set iD = GetHandleId(dealDamage)
call TimerStart(dealDamage,0,false,function damageTarget)
call SaveUnitHandle(Hash,iD,'trgD',Attacked)
call SaveReal(Hash,iD,'TDMG',Damage)
call SaveUnitHandle(Hash,iD,'DMGS',Attacker)
elseif GetWidgetLife(Attacked) > Damage and GetWidgetLife(Attacked)+Damage+GetUnitBlockDamageAmmount(Attacked) <= GetUnitState(Attacked,UNIT_STATE_MAX_LIFE) then
if Damage > GetUnitBlockDamageAmmount(Attacked) then
call SetWidgetLife(Attacked,GetWidgetLife(Attacked)+GetUnitBlockDamageAmmount(Attacked)+(Damage-GetUnitBlockDamageAmmount(Attacked))*GetUnitBlockDamagePercent(Attacked)/100)
else
call SetWidgetLife(Attacked,GetWidgetLife(Attacked)+Damage)
endif
endif
set dealDamage = null
set Attacked = null
set Attacker = null
endfunction
private function Initialization takes nothing returns nothing
//Increase Armor
set abilityAddArmor[0] = 'aa00'
set abilityAddArmor[1] = 'aa01'
set abilityAddArmor[2] = 'aa02'
set abilityAddArmor[3] = 'aa03'
set abilityAddArmor[4] = 'aa04'
set abilityAddArmor[5] = 'aa05'
set abilityAddArmor[6] = 'aa06'
set abilityAddArmor[7] = 'aa07'
set abilityAddArmor[8] = 'aa08'
set abilityAddArmor[9] = 'aa09'
set abilityAddArmor[10] = 'aa10'
set abilityAddArmor[11] = 'aa11'
set abilityAddArmor[12] = 'aa12'
//Reduce Armor
set abilityRemoveArmor[0] = 'ra00'
set abilityRemoveArmor[1] = 'ra01'
set abilityRemoveArmor[2] = 'ra02'
set abilityRemoveArmor[3] = 'ra03'
set abilityRemoveArmor[4] = 'ra04'
set abilityRemoveArmor[5] = 'ra05'
set abilityRemoveArmor[6] = 'ra06'
set abilityRemoveArmor[7] = 'ra07'
set abilityRemoveArmor[8] = 'ra08'
set abilityRemoveArmor[9] = 'ra09'
set abilityRemoveArmor[10] = 'ra10'
set abilityRemoveArmor[11] = 'ra11'
set abilityRemoveArmor[12] = 'ra12'
set abilityRemoveArmor[13] = 'ra13'
//Increase HP
set abilityAddHp[0] = 'ah00'
set abilityAddHp[1] = 'ah01'
set abilityAddHp[2] = 'ah02'
set abilityAddHp[3] = 'ah03'
set abilityAddHp[4] = 'ah04'
set abilityAddHp[5] = 'ah05'
set abilityAddHp[6] = 'ah06'
set abilityAddHp[7] = 'ah07'
set abilityAddHp[8] = 'ah08'
set abilityAddHp[9] = 'ah09'
set abilityAddHp[10] = 'ah10'
set abilityAddHp[11] = 'ah11'
set abilityAddHp[12] = 'ah12'
set abilityAddHp[13] = 'ah13'
//Reduce HP
set abilityRemoveHp[0] = 'rh00'
set abilityRemoveHp[1] = 'rh01'
set abilityRemoveHp[2] = 'rh02'
set abilityRemoveHp[3] = 'rh03'
set abilityRemoveHp[4] = 'rh04'
set abilityRemoveHp[5] = 'rh05'
set abilityRemoveHp[6] = 'rh06'
set abilityRemoveHp[7] = 'rh07'
set abilityRemoveHp[8] = 'rh08'
set abilityRemoveHp[9] = 'rh09'
set abilityRemoveHp[10] = 'rh10'
set abilityRemoveHp[11] = 'rh11'
set abilityRemoveHp[12] = 'rh12'
//Increase Mana
set abilityAddMana[0] = 'am00'
set abilityAddMana[1] = 'am01'
set abilityAddMana[2] = 'am02'
set abilityAddMana[3] = 'am03'
set abilityAddMana[4] = 'am04'
set abilityAddMana[5] = 'am05'
set abilityAddMana[6] = 'am06'
set abilityAddMana[7] = 'am07'
set abilityAddMana[8] = 'am08'
set abilityAddMana[9] = 'am09'
set abilityAddMana[10] = 'am10'
set abilityAddMana[11] = 'am11'
set abilityAddMana[12] = 'am12'
//Reduce mana
set abilityRemoveMana[0] = 'rm00'
set abilityRemoveMana[1] = 'rm01'
set abilityRemoveMana[2] = 'rm02'
set abilityRemoveMana[3] = 'rm03'
set abilityRemoveMana[4] = 'rm04'
set abilityRemoveMana[5] = 'rm05'
set abilityRemoveMana[6] = 'rm06'
set abilityRemoveMana[7] = 'rm07'
set abilityRemoveMana[8] = 'rm08'
set abilityRemoveMana[9] = 'rm09'
set abilityRemoveMana[10] = 'rm10'
set abilityRemoveMana[11] = 'rm11'
set abilityRemoveMana[12] = 'rm12'
//Increace Bonus Damage
set abilityAddDamage[0] = 'ad00'
set abilityAddDamage[1] = 'ad01'
set abilityAddDamage[2] = 'ad02'
set abilityAddDamage[3] = 'ad03'
set abilityAddDamage[4] = 'ad04'
set abilityAddDamage[5] = 'ad05'
set abilityAddDamage[6] = 'ad06'
set abilityAddDamage[7] = 'ad07'
set abilityAddDamage[8] = 'ad08'
set abilityAddDamage[9] = 'ad09'
set abilityAddDamage[10] = 'ad10'
set abilityAddDamage[11] = 'ad11'
set abilityAddDamage[12] = 'ad12'
//Reduce Bonus Damage
set abilityRemoveDamage[0] = 'rd00'
set abilityRemoveDamage[1] = 'rd01'
set abilityRemoveDamage[2] = 'rd02'
set abilityRemoveDamage[3] = 'rd03'
set abilityRemoveDamage[4] = 'rd04'
set abilityRemoveDamage[5] = 'rd05'
set abilityRemoveDamage[6] = 'rd06'
set abilityRemoveDamage[7] = 'rd07'
set abilityRemoveDamage[8] = 'rd08'
set abilityRemoveDamage[9] = 'rd09'
set abilityRemoveDamage[10] = 'rd10'
set abilityRemoveDamage[11] = 'rd11'
set abilityRemoveDamage[12] = 'rd12'
//Increase Base Damage
set itemAddBaseDamage[0] = 'id00'
set itemAddBaseDamage[1] = 'id01'
set itemAddBaseDamage[2] = 'id02'
set itemAddBaseDamage[3] = 'id03'
set itemAddBaseDamage[4] = 'id04'
set itemAddBaseDamage[5] = 'id05'
set itemAddBaseDamage[6] = 'id06'
set itemAddBaseDamage[7] = 'id07'
set itemAddBaseDamage[8] = 'id08'
set itemAddBaseDamage[9] = 'id09'
set itemAddBaseDamage[10] = 'id10'
set itemAddBaseDamage[11] = 'id11'
set itemAddBaseDamage[12] = 'id12'
//Reduce Base Damage
set itemRemoveBaseDamage[0] = 'im00'
set itemRemoveBaseDamage[1] = 'im01'
set itemRemoveBaseDamage[2] = 'im02'
set itemRemoveBaseDamage[3] = 'im03'
set itemRemoveBaseDamage[4] = 'im04'
set itemRemoveBaseDamage[5] = 'im05'
set itemRemoveBaseDamage[6] = 'im06'
set itemRemoveBaseDamage[7] = 'im07'
set itemRemoveBaseDamage[8] = 'im08'
set itemRemoveBaseDamage[9] = 'im09'
set itemRemoveBaseDamage[10] = 'im10'
set itemRemoveBaseDamage[11] = 'im11'
set itemRemoveBaseDamage[12] = 'im12'
//Increase Attack Speed
set abilityAddAttackSpeed[0] = 'as00'
set abilityAddAttackSpeed[1] = 'as01'
set abilityAddAttackSpeed[2] = 'as02'
set abilityAddAttackSpeed[3] = 'as03'
set abilityAddAttackSpeed[4] = 'as04'
set abilityAddAttackSpeed[5] = 'as05'
set abilityAddAttackSpeed[6] = 'as06'
set abilityAddAttackSpeed[7] = 'as07'
set abilityAddAttackSpeed[8] = 'as08'
set restoration = CreateTimer()
call TimerStart(restoration,restorationPeriod,true,function restoreParamaters)
set wholeMap = CreateRegion()
call RegionAddRect(wholeMap, bj_mapInitialPlayableArea)
set detectDamage = CreateTrigger()
call TriggerRegisterUnitEventDamaged(detectDamage)
call TriggerAddAction(detectDamage,function onDamage)
endfunction
endlibrary