[jass=Jass]
include "cj_types.j"
library LightFinger initializer init {
define{
private DMG = 250 //Урон
private Speed = 70 //Скорость (от 40-70 выглядит нормально)
private Area = 400 //Область урона (не забудьте поднять область у замедления на такую же, способность "Slow")
private Spell = 'A000'
private DamageUp = 50 //Сколько урона за уровень
private Per = 0.03 // скорость таймера
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
private DMGUP = DMG+(GetUnitAbilityLevel(Caster,Spell)*50)
}
globals
hashtable h = null
unit e = null
private unit Caster
endglobals
private function PreloadUnit takes int id returns nothing
bj_lastCreatedUnit = CreateUnit(Player(12), id, 0, 0, 0)
SetUnitVertexColor(bj_lastCreatedUnit, 255, 255, 255, 1)
KillUnit(bj_lastCreatedUnit)
endfunction
private function SR takes real x1, real y1, real x2, real y2 returns real
return SquareRoot((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))
endfunction
private function ShakeCamera2 takes nothing returns nothing
CameraSetSourceNoise(0, 0)
CameraSetTargetNoise(0, 0)
PauseTimer(GetExpiredTimer())
DestroyTimer(GetExpiredTimer())
endfunction
private function ShakeCamera takes real dur, real potency returns nothing
timer t = CreateTimer()
CameraSetTargetNoiseEx(2 * potency, 2 * Pow(10, potency), true)
CameraSetSourceNoiseEx(2 * potency, 2 * Pow(10, potency), true)
TimerStart(t, dur, false, function ShakeCamera2)
t = null
endfunction
private boolean CondFinger() {
return GetSpellAbilityId() == Spell
}
function CastFinger2 takes nothing returns nothing
timer t = GetExpiredTimer()
int id = GetHandleId(t)
unit u = LoadUnitHandle(h, id, 0)
unit d = LoadUnitHandle(h, id, 1)
real x = GetUnitX(d)
real y = GetUnitY(d)
real x1 = LoadReal(h, id, 2)
real y1 = LoadReal(h, id, 3)
real a = Atan2(y1 - y, x1 - x)
group g = CreateGroup()
player p = GetOwningPlayer(u)
if SR(x, y, x1, y1) > 52 {
x = x + Speed * Cos(a)
y = y + Speed * Sin(a)
SetUnitX(d, x)
SetUnitY(d, y)
SetUnitFacing(d, a * bj_RADTODEG)
bj_lastCreatedUnit = CreateUnit(p, 'e000', x, y, a * bj_RADTODEG)
UnitApplyTimedLife(bj_lastCreatedUnit, 0, 1)
SetUnitTimeScale(bj_lastCreatedUnit, 0)
UnitApplyTimedLife(CreateUnit(p, 'e004', x, y, a * bj_RADTODEG), 0, 1)
else
GroupEnumUnitsInRange(g, x1, y1, Area, null)
Caster = u
loop
e = FirstOfGroup(g)
exitwhen e == null
if IsUnitEnemy(e, p) and IsUnitType(e, UNIT_TYPE_DEAD) == false and GetUnitAbilityLevel(e, 'Aloc') == 0{
UnitDamageTarget(u, e, DMGUP, false, false, null, null, null)
}
GroupRemoveUnit(g, e)
endloop
Caster = null
bj_lastCreatedUnit = CreateUnit(p, 'e001', x, y, a * bj_RADTODEG)
UnitApplyTimedLife(bj_lastCreatedUnit, 0, 1)
IssueImmediateOrderById(bj_lastCreatedUnit, 852285)
UnitApplyTimedLife(CreateUnit(p, 'e002', x, y, a * bj_RADTODEG), 0, 1)
UnitApplyTimedLife(CreateUnit(p, 'e003', x, y, a * bj_RADTODEG), 0, 1)
DestroyEffect(AddSpecialEffect("war3mapImported\\NUKE2.mdx", x1, y1))
DestroyEffect(AddSpecialEffect("war3mapImported\\NewMassiveEX.mdx", x1, y1))
DestroyEffect(AddSpecialEffect("war3mapImported\\a-bomb.mdx", x1, y1))
DestroyEffect(AddSpecialEffect("war3mapImported\\NuclearExplosion.mdx", x1, y1))
ShakeCamera(0.5, 20)
RemoveUnit(d)
PauseTimer(t)
DestroyTimer(t)
DestroyEffect(LoadEffectHandle(h, id, 5))
FlushChildHashtable(h, id)
}
DestroyGroup(g)
p = null
u = null
t = null
g = null
d = null
endfunction
private void CastFinger(){
timer t = CreateTimer()
int id = GetHandleId(t)
unit u = GetTriggerUnit()
real x = GetUnitX(u)
real y = GetUnitY(u)
player p = GetOwningPlayer(u)
SaveUnitHandle(h, id, 0, u)
UnitApplyTimedLife(CreateUnit(p, 'e005', x, y, 0), 0, 1)
bj_lastCreatedUnit = CreateUnit(p, 'e000', x, y, GetUnitFacing(u))
SaveUnitHandle(h, id, 1, bj_lastCreatedUnit)
SetUnitTimeScale(bj_lastCreatedUnit, 0)
SaveEffectHandle(h, id, 5, AddSpecialEffectTarget("war3mapImported\\!guang small.mdx", u, "foot right"))
DestroyEffect(AddSpecialEffectTarget("war3mapImported\\WarpHolyCaster.mdx", u, "origin"))
DestroyEffect(AddSpecialEffectTarget("war3mapImported\\Consecrate.mdx", u, "chest"))
DestroyEffect(AddSpecialEffectTarget("war3mapImported\\HolyPhoenixMissle.mdx", u, "origin"))
SaveReal(h, id, 2, GetSpellTargetX())
SaveReal(h, id, 3, GetSpellTargetY())
TimerStart(t, Per, true, function CastFinger2)
t = null
p = null
u = null
}
private void init (){
trigger t = CreateTrigger()
integer i = 0
loop
TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
i++
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
TriggerAddAction(t, function CastFinger)
TriggerAddCondition(t, Condition(function CondFinger))
h = InitHashtable()
PreloadUnit('e000')
PreloadUnit('e001')
PreloadUnit('e002')
PreloadUnit('e003')
PreloadUnit('e004')
PreloadUnit('e005')
Preload("war3mapImported\\WarpHolyCaster.mdx")
Preload("war3mapImported\\Consecrate.mdx")
Preload("war3mapImported\\HolyPhoenixMissle.mdx")
Preload("war3mapImported\\!guang small.mdx")
Preload("war3mapImported\\NUKE2.mdx")
Preload("war3mapImported\\NewMassiveEX.mdx")
Preload("war3mapImported\\a-bomb.mdx")
Preload("war3mapImported\\NuclearExplosion.mdx")
t = null
}
}
[/code]