Teacher v1
70
|
ID: 427
Family ID:
Author: Deikorim / Limfa
Rarity: uncommon
Element: astral
Attack Type: Elemental
Attack Range: 900
Attack CD: 1.5
Damage: 86-90
Abil. Factor: 0.8
Status: Approved
|
Specials:
+20% exp gain
Knowledge
When the teacher attacks there's a 10% chance a random tower in 600 range will learn from her, gaining 1 experience. Level Bonus: +0.6% chance |
Download
Toggle Triggers Header globals
//@export
ProjectileType knowledge_green
//@export
ProjectileType knowledge_blue
//@export
ProjectileType knowledge_red
//@export
MultiboardValues limfa_teacherboard
endglobals
function hit takes Projectile p, Unit result returns nothing
local Tower t = p.getCaster()
if result.getUID() == p.userInt then
call result.addExp(p.userReal)
if Tower(p.userInt2).getUID() == t.getUID() then
set t.userReal2 = t.userReal2 + p.userReal * result.getProp_ExpReceived()
endif
endif
endfunction
//@export
function teacher_attack takes Tower tower, real xp returns nothing
local Iterate inRange
local Unit result
local ProjectileType pt
local Projectile p
local integer i
if tower.calcChance(0.10+0.006*tower.getLevel()) then
set inRange = Iterate.overUnitsInRangeOfCaster(tower,TARGET_TOWERS,600)
set result = inRange.nextRandom()
if result == tower then
set result = inRange.nextRandom()
endif
if result != 0 then
set i = GetRandomInt(1,3)
if i == 1 then
set pt = knowledge_green
elseif i == 2 then
set pt = knowledge_red
elseif i == 3 then
set pt = knowledge_blue
endif
set p = Projectile.createFromUnitToUnit(pt, tower, 1.0, 1.0, tower, result, true, false, true)
call p.setScale(0.7)
set p.userReal = xp
set p.userInt = result.getUID()
set p.userInt2 = tower.getUID()
call inRange.destroy()
endif
endif
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 limfa_teacherboard = MultiboardValues.create(1)
call limfa_teacherboard.setKey(0,"Xp Granted")
set knowledge_green = ProjectileType.create( "Objects\\InventoryItems\\tomeGreen\\tomeGreen.mdl", 20.0, 450.00 )
call knowledge_green.enableFreeRotation()
call knowledge_green.disableExplodeOnHit()
call knowledge_green.enableHoming( ProjectileTargetEvent.hit, 0 )
set knowledge_blue = ProjectileType.create( "Objects\\InventoryItems\\tomeBlue\\tomeBlue.mdl", 20.0, 450.00 )
call knowledge_blue.enableFreeRotation()
call knowledge_blue.disableExplodeOnHit()
call knowledge_blue.enableHoming( ProjectileTargetEvent.hit, 0 )
set knowledge_red = ProjectileType.create( "Objects\\InventoryItems\\tomeRed\\tomeRed.mdl", 20.0, 450.00 )
call knowledge_red.enableFreeRotation()
call knowledge_red.disableExplodeOnHit()
call knowledge_red.enableHoming( ProjectileTargetEvent.hit, 0 )
endfunction
On Attack
ONATTACK_chance: 1.0
ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
call teacher_attack(tower,1)
call SetUnitAnimationByIndex(tower.getUnit(), 3)
endfunction
On Tower Creation function onCreate takes Tower tower returns nothing
local Tower preceding = Event.getPrecedingTower()
if (preceding.getFamily() == tower.getFamily()) then
set tower.userReal2 = preceding.userReal2
else
set tower.userReal2 = 0
endif
endfunction
On Tower Details
goldcost: 0
function onTowerDetails takes Tower tower returns MultiboardValues
call limfa_teacherboard.setValue(0, formatFloat(tower.userReal2,1))
return limfa_teacherboard
endfunction
|
Description:
Latest Upload Comment: