Spell Collector v1
1600
|
ID: 115
Family ID:
Author: cedi
Rarity: rare
Element: storm
Attack Type: Energy
Attack Range: 950
Attack CD: 2
Damage: 1080-1080
Abil. Factor: 0.3
Status: Approved
|
Magical Barrage
Whenever this tower attacks it has a 20% chance to launch a magical missile. Whenever a tower in 650 range casts a spell, the amount of missiles on attack is increased by 1 for a duration equal to the casting tower's ability's cooldown. The Spell Collector can shoot up to 10 missiles per attack. Each missile deals 2000 spell damage. Each additional missile has 5% higher crit chance and 10% higher crit damage than the previous one. Level Bonus: +0.8% chance +80 spell damage +0.2% spell crit chance +0.4% spell crit damage +1 max missiles every 5 levels |
Download
Toggle Triggers Header globals
//@export
ProjectileType cedi_spellCPT
//@export
BuffType cedi_spellGathering
//@export
BuffType cedi_spellInc
//@export
MultiboardValues cedi_spellCollectorMBValues
endglobals
function hitMissile takes Projectile P, Unit U returns nothing
local Tower C = P.getCaster()
if U != 0 and C != 0 then
call P.getCaster().doSpellDamage( U, (2000.0 + 80 * C.getLevel()) * C.userInt, C.calcSpellCrit( P.userReal, P.userReal2 ) )
endif
endfunction
function incCast takes Buff B returns nothing
local Tower C = B.getCaster()
local integer UID
set B = C.getBuffOfType(cedi_spellInc)
if B != 0 then
set B = cedi_spellInc.apply(C, C, B.getLevel() + 1)
else
set B = cedi_spellInc.apply(C, C, 1)
endif
set UID = B.getUID()
call TriggerSleepAction(Event.getAutocastType().getCooldown())
if B.getUID() == UID then
call B.setLevel(B.getLevel() - 1)
if B.getLevel() == 0 then
call B.removeBuff()
endif
endif
endfunction
function Launch takes nothing returns nothing
local timer t = GetExpiredTimer()
local Tower tower = GetTimerData( t )
local real chance = 0.05 + 0.002 * tower.getLevel()
local real crit = 0.1 + 0.004 * tower.getLevel()
local Projectile P
local Unit T = tower.userInt3
if T == 0 then
call ReleaseTimer( t )
set t = null
return
endif
if tower.userInt2 >= tower.userReal then
call ReleaseTimer( t )
set t = null
return
endif
set P = Projectile.createBezierInterpolationFromUnitToUnit( cedi_spellCPT, tower, 1.0, tower.calcSpellCritNoBonus(), tower, T, GetRandomReal( 0.25, 0.45 ), GetRandomReal( -0.3, 0.3 ), 0.0, true )
set P.userReal = chance * tower.userInt2
set P.userReal2 = crit * tower.userInt2
set P.z = 50.0
set tower.userInt2 = tower.userInt2 + 1
set t = null
endfunction
//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 cedi_spellCPT = ProjectileType.createInterpolate( "Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl", 1200.0 )
call cedi_spellCPT.setEventOnInterpolationFinished( hitMissile )
set cedi_spellGathering = BuffType.createAuraEffectType( true )
call cedi_spellGathering.setBuffIcon( '@@1@@' )
call cedi_spellGathering.addEventOnSpellCast( incCast )
set cedi_spellInc = BuffType.create( 20.0, 0.0, true )
call cedi_spellInc.setBuffIcon( '@@2@@' )
set cedi_spellCollectorMBValues = MultiboardValues.create(1)
call cedi_spellCollectorMBValues.setKey(0, "Spells Harvested")
endfunction
On Attack
ONATTACK_chance: 0.2
ONATTACK_chanceLevelAdd: 0.008
function onAttack takes Tower tower returns nothing
//local real chance = 0.05 + 0.002 * tower.getLevel()
//local real crit = 0.1 + 0.004 * tower.getLevel()
//local integer i = 0
local Buff B = tower.getBuffOfType( cedi_spellInc )
local integer max = 1
//local Projectile P
local Unit T = Event.getTarget()
local real r
local timer t = NewTimer()
if B != 0 then
set max = IMinBJ(B.getLevel() + 1,10+tower.getLevel()/5)
endif
set r = tower.getCurrentAttackspeed() / max
if r > 0.2 then
set r = 0.2
endif
set tower.userReal = max
set tower.userInt2 = 0 //i
set tower.userInt3 = T
call SetTimerData( t, tower )
call TimerStart( t, r, true, function Launch )
//loop
// exitwhen i >= max
// exitwhen T == 0
// set P = Projectile.createFromUnitToUnit( cedi_spellCPT, tower, 1.0, tower.calcSpellCritNoBonus(), tower, T, true, false, false )
// set P.userReal = chance * i
// set P.userReal2 = crit * i
// set P.z = 50.0
// set i = i + 1
// call TriggerSleepAction( 0.1 )
//endloop
endfunction
On Tower Creation function onCreate takes Tower tower returns nothing
set tower.userInt = 1 //first member
endfunction
On Tower Details
goldcost: 0
function onTowerDetails takes Tower tower returns MultiboardValues
local Buff B = tower.getBuffOfType(cedi_spellInc)
local integer lvl = 0
if B != 0 then
set lvl = IMinBJ(B.getLevel() + 1,10+tower.getLevel()/5)
endif
call cedi_spellCollectorMBValues.setValue(0, I2S(lvl))
return cedi_spellCollectorMBValues
endfunction
Tower Aura
AURA_auraEffect: cedi_spellGathering
AURA_power: 0
AURA_level: 0
AURA_auraRange: 650.0
AURA_targetType: TARGET_TYPE_TOWERS
AURA_levelAdd: 1
AURA_powerAdd: 1
AURA_targetSelf: true
|
Description:
Latest Upload Comment: