Arms Dealer v1
80
lvl: 0

ID:

244

Author:

limfa

Rarity:

rare

Status:

Approved

Description:

He can get rid of your illegal arms.

Latest Upload Comment:

Restored from 1.10
The Customer Is Boss
Bosses coming within 600 range of the carrier have a 25% chance to grant [25 + current wave] gold. Cannot trigger on the same boss twice.

Level Bonus:
+1 gold
Specials:
Specials:
-20% damage
-20% spell damage
+50% bounty collected
Download

Toggle Triggers

Header

goldcost: 0
    globals
        MultiboardValues limfa_dealerboard
    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 limfa_dealerboard = MultiboardValues.create(1)
        call limfa_dealerboard.setKey(0,"Arms Sold $")
    endfunction

On Item Creation

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

On Tower Details

goldcost: 80
function onTowerDetails takes Item itm returns MultiboardValues
    call limfa_dealerboard.setValue(0,I2S(itm.userInt2))
    return limfa_dealerboard
endfunction

On Unit Comes In Range

UNITINRANGE_targetType: TARGET_TYPE_CREEPS + TARGET_TYPE_SIZE_BOSS goldcost: 0 UNITINRANGE_range: 600
function onUnitInRange takes Item itm returns nothing
    local Tower t = itm.getCarrier()
    local Creep c = Event.getTarget()
    local Playor p = t.getOwner()
    local integer bossLevel = c.getSpawnLevel()
    local integer rewardValue
    
    if itm.userInt < bossLevel and t.calcChance(0.25) then
        set rewardValue = t.getLevel() + bossLevel + 25
        call p.giveGold(rewardValue, t.getUnit(), true, false)
        call p.displayFloatingText("Arms Sold $" +  I2S(rewardValue), t, 0, 255, 0)
        set itm.userInt = bossLevel
        set itm.userInt2 = itm.userInt2 + rewardValue
    endif
endfunction