Sacrificial Lamb v1
1300
ID:
335
Family ID:
Author:
DaveMatthews
Rarity:
rare
Element:
darkness
Attack Type:
Decay
Attack Range:
850
Attack CD:
1
Damage:
1234-1234
Abil. Factor:
0.9
Status:
Approved

Description:

Sacrifices itself to boost nearby towers.

Latest Upload Comment:

Restored from 1.10
Specials:
+0.1 mana regen/lvl
Sacrifice
This tower loses 100% of its damage to boost the dps of a tower in 500 range by 30% of its total damage for 6 seconds. This buff has no effect on towers of the same family.

Level Bonus:
+0.6% bonus damage
Blood Spill
On attack, this tower has a 15% chance to lose 100% attack speed and boost the attack speed of all towers in 200 range by 50%, equally divided among them, for 6 seconds. Every time it casts Blood Spill, the tower gains 0.25 experience for every other tower affected. Cannot retrigger when the buff is already active. 

Level Bonus:
+1% attack speed 
+0.2% chance
Download

Toggle Triggers

Autocast

AUTOCAST_cooldown: 6 AUTOCAST_autoRange: 500 AUTOCAST_manacost: 90 AUTOCAST_range: 500 AUTOCAST_targetType: TARGET_TYPE_TOWERS AUTOCAST_numBuffsBeforeIdle: 1 caster_art: Abilities\Spells\Undead\CarrionSwarm\CarrionSwarmDamage.mdl target_art: Abilities\Spells\Undead\DeathPact\DeathPactCaster.mdl AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_BUFF AUTOCAST_buffType: dave_sacrifice_target AUTOCAST_isExtended: false AUTOCAST_targetSelf: false
private function onAutocast takes Tower tower returns nothing
    local Tower target = Event.getTarget()
    local Buff b

    if target.getFamily() != tower.getFamily() then
        if target.getBuffOfType(dave_sacrifice_target) != 0 then
            call dave_sacrifice_target.apply(tower, target, 0)
        else
            set b = dave_sacrifice_target.apply(tower, target, 0)
            set b.userReal = tower.getCurrentAttackDamageWithBonus()*(0.3+(0.006*tower.getLevel()))
            call target.modifyProperty(MOD_DPS_ADD, b.userReal) 
        endif
        
        call dave_sacrifice_altar.apply(tower, tower, tower.getLevel())
    endif
endfunction

Header

    globals
        //@export
        BuffType dave_sacrifice_target
        //@export
        BuffType dave_sacrifice_altar
        //@export
        BuffType dave_blood_target
        //@export
        BuffType dave_blood_altar
    endglobals
    
    function resetBonus takes Buff b returns nothing
        local Tower tower = b.getBuffedUnit()
       call tower.modifyProperty(MOD_DPS_ADD, -b.userReal)
    endfunction
    
    private function init takes nothing returns nothing
        local Modifier m = Modifier.create()
        local Modifier n = Modifier.create()
        local Modifier o = Modifier.create()
        
        set dave_blood_target = BuffType.create(6.0,0.0,true)
        call dave_blood_target.setBuffModifier(m)
        call m.addModification(MOD_ATTACKSPEED,0.0,0.01)
        call dave_blood_target.setBuffIcon( '@@0@@' )
        
        set dave_blood_altar = BuffType.create(6.0,0,false)
        call dave_blood_altar.setBuffModifier(n)
        call n.addModification(MOD_ATTACKSPEED,-1.0,0.0)
        call dave_blood_altar.setBuffIcon( '@@1@@' )
        
        set dave_sacrifice_target = BuffType.create(6.0,0,true)
        call dave_sacrifice_target.addEventOnCleanup(resetBonus)
        call dave_sacrifice_target.setBuffIcon( '@@2@@' )
        
        set dave_sacrifice_altar = BuffType.create(6.0,0,false)
        call dave_sacrifice_altar.setBuffModifier(o)
        call o.addModification(MOD_DAMAGE_ADD_PERC,-1.0,0)
        call dave_sacrifice_altar.setBuffIcon( '@@3@@' )
    endfunction

On Attack

ONATTACK_chance: 0.15 ONATTACK_chanceLevelAdd: 0.002
function onAttack takes Tower tower returns nothing
    local integer numTowers
    local integer level = tower.getLevel() 
    local Tower u
    local Buff b
    local Iterate it = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TOWERS, 200)

    set b = tower.getBuffOfType(dave_blood_altar)
    set numTowers = it.count() - 1

    if b == 0 then
      call SFXAtUnit("Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodKnight.mdl", tower.getUnit())
        loop
            set u = it.next()
            exitwhen u == 0
            if u != tower and numTowers > 0 then
                call dave_blood_target.apply(tower, u, (50 + level)/numTowers)
            endif
        endloop
        if numTowers > 0 then
            call dave_blood_altar.apply(tower, tower, level)
            call tower.addExp(0.25 * numTowers)
        endif
    else
      call it.destroy()    
    endif
endfunction