Mining Tools v1
20
lvl: 0

ID:

158

Author:

drol

Rarity:

uncommon

Status:

Approved

Description:

The basic equipment every miner needs to do his job.

Latest Upload Comment:

Restored from 1.10
Mining
Every 15 seconds there is a 40% chance to find 3 gold.

Level Bonus:
+2% chance
+1 gold at lvl 25
Download

Toggle Triggers

Header

goldcost: 0
    globals
    MultiboardValues drol_digItemMulti
    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 drol_digItemMulti = MultiboardValues.create(1)
    call drol_digItemMulti.setKey(0,"Gold found") 
    
    endfunction

On Item Creation

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

On Tower Details

goldcost: 0
function onTowerDetails takes Item itm returns MultiboardValues
    // Show total gold digged up
    call   drol_digItemMulti.setValue(0,I2S(itm.userInt))
    return drol_digItemMulti
endfunction

Periodic

PERIODIC_period: 15 goldcost: 20
function periodic takes Item itm returns nothing
    
    local Tower tower = itm.getCarrier()
    local Effect targetEffect 

    set targetEffect = Effect.createScaled("Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl", GetUnitX(tower.getUnit()), GetUnitY(tower.getUnit()), 0, 0, 0.8)
    call targetEffect.setLifetime(0.1) 
        
    if tower.calcChance(0.40 + tower.getLevel() * 0.02) then
        
        if(tower.getLevel() < 25) then
            call tower.getOwner().giveGold(3, tower.getUnit(), false, true)
            set itm.userInt = itm.userInt + 3
        else
            call tower.getOwner().giveGold(4, tower.getUnit(), false, true)
            set itm.userInt = itm.userInt + 4
        endif
    
    endif
endfunction