Jah'Rakal's Fury v1
1000
lvl: 28

ID:

142

Author:

Der_kleine_Tomy

Rarity:

unique

Status:

Approved

Description:

The essence of Jah'rakal.

Latest Upload Comment:

Restored from 1.10
Fervor
Each subsequent attack on the same target increases the carrier's attackspeed by 2% up to a maximum of 100%. Whenever the carrier acquires a new target, the bonus is reduced by 50%. The bonus is bound to the item.

Level Bonus:
-1% bonus reduction
Download

Toggle Triggers

Header

goldcost: 0
    globals
        MultiboardValues tomy_jahrakal_values
    endglobals
    
    //Do not remove or rename this function!
    //Put your initialization tasks here, this function will be called on map init
    private function init takes nothing returns nothing
        set tomy_jahrakal_values = MultiboardValues.create(1)
        call tomy_jahrakal_values.setKey(0, "Attackspeed Increase")
    endfunction

On Attack

goldcost: 1000 ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Item itm returns nothing
    // If last target == current target
    if itm.userInt == Event.getTarget() then
        if itm.userReal != 1.00 and itm.userReal + 0.02 > 1.00 then // 100% attackspeed limit
            // Add the remaining bonus (99% -> 101%; limit -> 100%; add 100% - 99% = 1%)
            call itm.getCarrier().modifyProperty(MOD_ATTACKSPEED, 1.00 - itm.userReal)
            set itm.userReal = 1.00
        else
            // Add bonus
            call itm.getCarrier().modifyProperty(MOD_ATTACKSPEED, 0.02)
            set itm.userReal = itm.userReal + 0.02
        endif
    else
        // Save current target
        set itm.userInt = Event.getTarget()
        // Temp variable to store the current bonus
        set itm.userReal2 = itm.userReal
        // Calculate the new bonus (Current bonus * (50% + towerlevel%))
        set itm.userReal = itm.userReal * (50.0 + itm.getCarrier().getLevel()) / 100
        // Change the bonus (new Bonus - current Bonus)
        call itm.getCarrier().modifyProperty(MOD_ATTACKSPEED, itm.userReal - itm.userReal2)
    endif
endfunction

On Item Creation

goldcost: 0
function onCreate takes Item itm returns nothing
    set itm.userReal = 0.00
    set itm.userInt = 0
endfunction

On Item Drop

goldcost: 0
function onDrop takes Item itm returns nothing
    // Remove bonus
    call itm.getCarrier().modifyProperty(MOD_ATTACKSPEED, -itm.userReal)
endfunction

On Item Pickup

goldcost: 0
function onPickup  takes Item itm returns nothing
    // Add bonus
    call itm.getCarrier().modifyProperty(MOD_ATTACKSPEED, itm.userReal)
endfunction

On Tower Details

goldcost: 0
function onTowerDetails takes Item itm returns MultiboardValues
    call tomy_jahrakal_values.setValue(0, I2S(R2I(itm.userReal * 100)) + "%") // No decimal places
    return tomy_jahrakal_values
endfunction